author | mickeyl <mickeyl> | 2003-03-02 17:35:53 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-03-02 17:35:53 (UTC) |
commit | b3b0d6ec136e550029b9cae7fb714d47071ea5b4 (patch) (unidiff) | |
tree | 9cc1fb741bb548c90915487572c49a1ae48e33eb /noncore/net/wellenreiter/cornucopia/olistview.cpp | |
parent | d0e64d0c7961de1c3ecb886ae76c6701f268d767 (diff) | |
download | opie-b3b0d6ec136e550029b9cae7fb714d47071ea5b4.zip opie-b3b0d6ec136e550029b9cae7fb714d47071ea5b4.tar.gz opie-b3b0d6ec136e550029b9cae7fb714d47071ea5b4.tar.bz2 |
add child item factory to allow subclasses adding custom data items
Diffstat (limited to 'noncore/net/wellenreiter/cornucopia/olistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/cornucopia/olistview.cpp | 14 |
1 files changed, 12 insertions, 2 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 | |||
@@ -122,8 +122,13 @@ void OListView::setColumnSeparator( const QPen& p ) | |||
122 | m_columnSeparator = p; | 122 | m_columnSeparator = 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 | { |
129 | #warning Caution... the binary format is still under construction... | 134 | #warning Caution... the binary format is still under construction... |
@@ -179,9 +184,9 @@ void OListView::serializeFrom( QDataStream& s ) | |||
179 | qDebug( "read number of items = %d", items ); | 184 | qDebug( "read number of items = %d", items ); |
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 | ||
187 | qDebug( "OListView loaded." ); | 192 | qDebug( "OListView loaded." ); |
@@ -336,8 +341,13 @@ void OListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, in | |||
336 | p->setPen( pen ); | 341 | p->setPen( pen ); |
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 | { |
343 | #warning Caution... the binary format is still under construction... | 353 | #warning Caution... the binary format is still under construction... |
@@ -387,9 +397,9 @@ void OListViewItem::serializeFrom( QDataStream& s ) | |||
387 | qDebug( "read number of items = %d", items ); | 397 | qDebug( "read number of items = %d", items ); |
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 | ||
395 | qDebug( "OListViewItem loaded." ); | 405 | qDebug( "OListViewItem loaded." ); |