Diffstat (limited to 'libopie2/opieui/olistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/olistview.cpp | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp index 2b2f09a..8f97cc6 100644 --- a/libopie2/opieui/olistview.cpp +++ b/libopie2/opieui/olistview.cpp @@ -220,2 +220,3 @@ OListViewItem::OListViewItem(QListView *parent) + OListViewItem::OListViewItem(QListViewItem *parent) @@ -226,2 +227,3 @@ OListViewItem::OListViewItem(QListViewItem *parent) + OListViewItem::OListViewItem(QListView *parent, QListViewItem *after) @@ -232,2 +234,3 @@ OListViewItem::OListViewItem(QListView *parent, QListViewItem *after) + OListViewItem::OListViewItem(QListViewItem *parent, QListViewItem *after) @@ -238,2 +241,3 @@ OListViewItem::OListViewItem(QListViewItem *parent, QListViewItem *after) + OListViewItem::OListViewItem(QListView *parent, @@ -246,2 +250,3 @@ OListViewItem::OListViewItem(QListView *parent, + OListViewItem::OListViewItem(QListViewItem *parent, @@ -254,2 +259,3 @@ OListViewItem::OListViewItem(QListViewItem *parent, + OListViewItem::OListViewItem(QListView *parent, QListViewItem *after, @@ -262,2 +268,3 @@ OListViewItem::OListViewItem(QListView *parent, QListViewItem *after, + OListViewItem::OListViewItem(QListViewItem *parent, QListViewItem *after, @@ -270,2 +277,3 @@ OListViewItem::OListViewItem(QListViewItem *parent, QListViewItem *after, + OListViewItem::~OListViewItem() @@ -274,2 +282,3 @@ OListViewItem::~OListViewItem() + void OListViewItem::init() @@ -279,2 +288,3 @@ void OListViewItem::init() + const QColor &OListViewItem::backgroundColor() @@ -285,2 +295,3 @@ const QColor &OListViewItem::backgroundColor() + bool OListViewItem::isAlternate() @@ -328,2 +339,3 @@ bool OListViewItem::isAlternate() + void OListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) @@ -350,2 +362,3 @@ void OListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, in + OListViewItem* OListViewItem::childFactory() @@ -355,2 +368,3 @@ OListViewItem* OListViewItem::childFactory() + #ifndef QT_NO_DATASTREAM @@ -387,2 +401,4 @@ void OListViewItem::serializeTo( QDataStream& s ) const } + + void OListViewItem::serializeFrom( QDataStream& s ) @@ -413,2 +429,3 @@ void OListViewItem::serializeFrom( QDataStream& s ) + QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi ) @@ -418,2 +435,3 @@ QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi ) + QDataStream& operator>>( QDataStream& s, OListViewItem& lvi ) @@ -423 +441,92 @@ QDataStream& operator>>( QDataStream& s, OListViewItem& lvi ) #endif // QT_NO_DATASTREAM + + +/*====================================================================================== + * ONamedListView + *======================================================================================*/ + +ONamedListView::ONamedListView( QWidget *parent, const char *name ) + :OListView( parent, name ) +{ +} + + +ONamedListView::~ONamedListView() +{ +} + + +void ONamedListView::addColumns( const QStringList& columns ) +{ + for ( QStringList::ConstIterator it = columns.begin(); it != columns.end(); ++it ) + { + qDebug( "adding column %s", (const char*) *it ); + addColumn( *it ); + } +} + + +/*====================================================================================== + * ONamedListViewItem + *======================================================================================*/ + +ONamedListViewItem::ONamedListViewItem( QListView* parent, const QStringList& texts ) + :OListViewItem( parent ) +{ + setText( texts ); +} + + +ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, const QStringList& texts ) + :OListViewItem( parent ) +{ + setText( texts ); +} + + +ONamedListViewItem::ONamedListViewItem( QListView* parent, QListViewItem* after, const QStringList& texts ) + :OListViewItem( parent, after ) +{ + setText( texts ); +} + + +ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, QListViewItem* after, const QStringList& texts ) + :OListViewItem( parent, after ) +{ + setText( texts ); +} + + +ONamedListViewItem::~ONamedListViewItem() +{ +} + + +void ONamedListViewItem::setText( const QStringList& texts ) +{ + int col = 0; + for ( QStringList::ConstIterator it = texts.begin(); it != texts.end(); ++it ) + { + qDebug( "setting column %d = text %s", col, (const char*) *it ); + OListViewItem::setText( col++, *it ); + } + +} + + +void ONamedListViewItem::setText( const QString& column, const QString& text ) +{ + //FIXME: If used excessively, this will slow down performance of updates + //FIXME: because of the linear search over all column texts. + //FIXME: I will optimize later by using a hash map. + for ( int i = 0; i < listView()->columns(); ++i ) + { + if ( listView()->columnText( i ) == column ) + { + OListViewItem::setText( i, text ); + return; + } + } + qWarning( "ONamedListViewItem::setText(): Warning! Columntext '%s' not found.", (const char*) column ); +} |