summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/cornucopia
Side-by-side diff
Diffstat (limited to 'noncore/net/wellenreiter/cornucopia') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/cornucopia/olistview.cpp14
-rw-r--r--noncore/net/wellenreiter/cornucopia/olistview.h26
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 )
repaint();
}
+OListViewItem* OListView::childFactory()
+{
+ return new OListViewItem( this );
+}
+
#ifndef QT_NO_DATASTREAM
void OListView::serializeTo( QDataStream& s ) const
{
@@ -180,7 +185,7 @@ void OListView::serializeFrom( QDataStream& s )
for ( int i = 0; i < items; ++i )
{
- OListViewItem* item = new OListViewItem( this );
+ OListViewItem* item = childFactory();
s >> *item;
}
@@ -337,6 +342,11 @@ void OListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, in
p->drawLine( width-1, 0, width-1, height() );
}
+OListViewItem* OListViewItem::childFactory()
+{
+ return new OListViewItem( this );
+}
+
#ifndef QT_NO_DATASTREAM
void OListViewItem::serializeTo( QDataStream& s ) const
{
@@ -388,7 +398,7 @@ void OListViewItem::serializeFrom( QDataStream& s )
for ( int i = 0; i < items; ++i )
{
- OListViewItem* item = new OListViewItem( this );
+ OListViewItem* item = childFactory();
s >> (*item);
}
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 @@
#include <qpen.h>
#include <qdatastream.h>
-class OListViewFactory;
+class OListViewItem;
/**
* A @ref QListView variant featuring visual and functional enhancements
@@ -115,6 +115,12 @@ class OListViewFactory;
*/
const QPen& columnSeparator() const;
+ /**
+ * create a list view item as child of this object
+ * @return the new object
+ */
+ virtual OListViewItem* childFactory();
+
#ifndef QT_NO_DATASTREAM
/**
* serialize this object to a @ref QDataStream
@@ -129,22 +135,10 @@ class OListViewFactory;
virtual void serializeFrom( QDataStream& s );
#endif
- /**
- * returns a factory for OListView classes
- * creates one on the fly if it doesn't exist
- * @return the XML Factory
- */
- #ifndef QT_NO_XML
- //OListViewFactory* Factory();
- #endif
-
private:
QColor m_alternateBackground;
bool m_fullWidth;
QPen m_columnSeparator;
- #ifndef QT_NO_XML
- //OListViewFactory* m_Factory;
- #endif
};
#ifndef QT_NO_DATASTREAM
@@ -201,6 +195,12 @@ class OListViewItem: public QListViewItem
void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment );
void init();
+ /**
+ * create a list view item as child of this object
+ * @return the new object
+ */
+ virtual OListViewItem* childFactory();
+
#ifndef QT_NO_DATASTREAM
/**
* serialize this object to or from a @ref QDataStream