Diffstat (limited to 'noncore/net/wellenreiter/cornucopia') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/cornucopia/olistview.cpp | 14 | ||||
-rw-r--r-- | noncore/net/wellenreiter/cornucopia/olistview.h | 26 |
2 files changed, 25 insertions, 15 deletions
diff --git a/noncore/net/wellenreiter/cornucopia/olistview.cpp b/noncore/net/wellenreiter/cornucopia/olistview.cpp index f2d3730..c292eb9 100644 --- a/noncore/net/wellenreiter/cornucopia/olistview.cpp +++ b/noncore/net/wellenreiter/cornucopia/olistview.cpp | |||
@@ -123,6 +123,11 @@ void OListView::setColumnSeparator( const QPen& p ) | |||
123 | repaint(); | 123 | repaint(); |
124 | } | 124 | } |
125 | 125 | ||
126 | OListViewItem* OListView::childFactory() | ||
127 | { | ||
128 | return new OListViewItem( this ); | ||
129 | } | ||
130 | |||
126 | #ifndef QT_NO_DATASTREAM | 131 | #ifndef QT_NO_DATASTREAM |
127 | void OListView::serializeTo( QDataStream& s ) const | 132 | void OListView::serializeTo( QDataStream& s ) const |
128 | { | 133 | { |
@@ -180,7 +185,7 @@ void OListView::serializeFrom( QDataStream& s ) | |||
180 | 185 | ||
181 | for ( int i = 0; i < items; ++i ) | 186 | for ( int i = 0; i < items; ++i ) |
182 | { | 187 | { |
183 | OListViewItem* item = new OListViewItem( this ); | 188 | OListViewItem* item = childFactory(); |
184 | s >> *item; | 189 | s >> *item; |
185 | } | 190 | } |
186 | 191 | ||
@@ -337,6 +342,11 @@ void OListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, in | |||
337 | p->drawLine( width-1, 0, width-1, height() ); | 342 | p->drawLine( width-1, 0, width-1, height() ); |
338 | } | 343 | } |
339 | 344 | ||
345 | OListViewItem* OListViewItem::childFactory() | ||
346 | { | ||
347 | return new OListViewItem( this ); | ||
348 | } | ||
349 | |||
340 | #ifndef QT_NO_DATASTREAM | 350 | #ifndef QT_NO_DATASTREAM |
341 | void OListViewItem::serializeTo( QDataStream& s ) const | 351 | void OListViewItem::serializeTo( QDataStream& s ) const |
342 | { | 352 | { |
@@ -388,7 +398,7 @@ void OListViewItem::serializeFrom( QDataStream& s ) | |||
388 | 398 | ||
389 | for ( int i = 0; i < items; ++i ) | 399 | for ( int i = 0; i < items; ++i ) |
390 | { | 400 | { |
391 | OListViewItem* item = new OListViewItem( this ); | 401 | OListViewItem* item = childFactory(); |
392 | s >> (*item); | 402 | s >> (*item); |
393 | } | 403 | } |
394 | 404 | ||
diff --git a/noncore/net/wellenreiter/cornucopia/olistview.h b/noncore/net/wellenreiter/cornucopia/olistview.h index 9df5500..8911e22 100644 --- a/noncore/net/wellenreiter/cornucopia/olistview.h +++ b/noncore/net/wellenreiter/cornucopia/olistview.h | |||
@@ -38,7 +38,7 @@ | |||
38 | #include <qpen.h> | 38 | #include <qpen.h> |
39 | #include <qdatastream.h> | 39 | #include <qdatastream.h> |
40 | 40 | ||
41 | class OListViewFactory; | 41 | class OListViewItem; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * A @ref QListView variant featuring visual and functional enhancements | 44 | * A @ref QListView variant featuring visual and functional enhancements |
@@ -115,6 +115,12 @@ class OListViewFactory; | |||
115 | */ | 115 | */ |
116 | const QPen& columnSeparator() const; | 116 | const QPen& columnSeparator() const; |
117 | 117 | ||
118 | /** | ||
119 | * create a list view item as child of this object | ||
120 | * @return the new object | ||
121 | */ | ||
122 | virtual OListViewItem* childFactory(); | ||
123 | |||
118 | #ifndef QT_NO_DATASTREAM | 124 | #ifndef QT_NO_DATASTREAM |
119 | /** | 125 | /** |
120 | * serialize this object to a @ref QDataStream | 126 | * serialize this object to a @ref QDataStream |
@@ -129,22 +135,10 @@ class OListViewFactory; | |||
129 | virtual void serializeFrom( QDataStream& s ); | 135 | virtual void serializeFrom( QDataStream& s ); |
130 | #endif | 136 | #endif |
131 | 137 | ||
132 | /** | ||
133 | * returns a factory for OListView classes | ||
134 | * creates one on the fly if it doesn't exist | ||
135 | * @return the XML Factory | ||
136 | */ | ||
137 | #ifndef QT_NO_XML | ||
138 | //OListViewFactory* Factory(); | ||
139 | #endif | ||
140 | |||
141 | private: | 138 | private: |
142 | QColor m_alternateBackground; | 139 | QColor m_alternateBackground; |
143 | bool m_fullWidth; | 140 | bool m_fullWidth; |
144 | QPen m_columnSeparator; | 141 | QPen m_columnSeparator; |
145 | #ifndef QT_NO_XML | ||
146 | //OListViewFactory* m_Factory; | ||
147 | #endif | ||
148 | }; | 142 | }; |
149 | 143 | ||
150 | #ifndef QT_NO_DATASTREAM | 144 | #ifndef QT_NO_DATASTREAM |
@@ -201,6 +195,12 @@ class OListViewItem: public QListViewItem | |||
201 | void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); | 195 | void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); |
202 | void init(); | 196 | void init(); |
203 | 197 | ||
198 | /** | ||
199 | * create a list view item as child of this object | ||
200 | * @return the new object | ||
201 | */ | ||
202 | virtual OListViewItem* childFactory(); | ||
203 | |||
204 | #ifndef QT_NO_DATASTREAM | 204 | #ifndef QT_NO_DATASTREAM |
205 | /** | 205 | /** |
206 | * serialize this object to or from a @ref QDataStream | 206 | * serialize this object to or from a @ref QDataStream |