author | mickeyl <mickeyl> | 2003-06-28 14:11:46 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-06-28 14:11:46 (UTC) |
commit | 50e4e1e8876372bf9dbb0c32acc93c65434738d5 (patch) (side-by-side diff) | |
tree | c430a08b75b7008d9e717df7be96c6479f1bebe5 | |
parent | 5bb184fd350f1e6352b6f41fbb18b59d2d3d7403 (diff) | |
download | opie-50e4e1e8876372bf9dbb0c32acc93c65434738d5.zip opie-50e4e1e8876372bf9dbb0c32acc93c65434738d5.tar.gz opie-50e4e1e8876372bf9dbb0c32acc93c65434738d5.tar.bz2 |
support OListViewItem specific overload of expand to give those the chance
to compute stuff "just in time" - this is also known as lazy computation
patch by tille
-rw-r--r-- | libopie2/opieui/olistview.cpp | 6 | ||||
-rw-r--r-- | libopie2/opieui/olistview.h | 11 |
2 files changed, 17 insertions, 0 deletions
diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp index 8f290d3..ec503dd 100644 --- a/libopie2/opieui/olistview.cpp +++ b/libopie2/opieui/olistview.cpp @@ -38,32 +38,33 @@ /* OPIE */ #include <opie2/olistview.h> /*====================================================================================== * OListView *======================================================================================*/ OListView::OListView( QWidget *parent, const char *name ) :QListView( parent, name ) { //FIXME: get from global settings and calculate ==> see oglobalsettings.* m_alternateBackground = QColor( 238, 246, 255 ); m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine ); m_fullWidth = true; + connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*))); } OListView::~OListView() { } void OListView::setFullWidth( bool fullWidth ) { m_fullWidth = m_fullWidth; #if QT_VERSION > 290 header()->setStretchEnabled( fullWidth, columns()-1 ); #endif } bool OListView::fullWidth() const { @@ -114,32 +115,37 @@ void OListView::setAlternateBackground( const QColor &c ) { m_alternateBackground = c; repaint(); } const QPen& OListView::columnSeparator() const { return m_columnSeparator; } void OListView::setColumnSeparator( const QPen& p ) { m_columnSeparator = p; repaint(); } +void OListView::expand(QListViewItem *item) +{ + ((OListViewItem*)item)->expand(); +} + OListViewItem* OListView::childFactory() { return new OListViewItem( this ); } #ifndef QT_NO_DATASTREAM void OListView::serializeTo( QDataStream& s ) const { #warning Caution... the binary format is still under construction... qDebug( "storing OListView..." ); // store number of columns and the labels s << columns(); for ( int i = 0; i < columns(); ++i ) s << columnText( i ); diff --git a/libopie2/opieui/olistview.h b/libopie2/opieui/olistview.h index 109e309..a00b43a 100644 --- a/libopie2/opieui/olistview.h +++ b/libopie2/opieui/olistview.h @@ -109,32 +109,38 @@ class OListView: public QListView /** * Create a list view item as child of this object * @returns the new object */ virtual OListViewItem* childFactory(); #ifndef QT_NO_DATASTREAM /** * Serialize this object to @ref QDataStream @a stream */ virtual void serializeTo( QDataStream& stream ) const; /** * Serialize this object from a @ref QDataStream @a stream */ virtual void serializeFrom( QDataStream& s ); #endif +protected slots: + /** + * expand the current OListViewItem + */ + void expand(QListViewItem*); + private: QColor m_alternateBackground; bool m_fullWidth; QPen m_columnSeparator; }; #ifndef QT_NO_DATASTREAM /** * @relates OListView * Writes @a listview to the @a stream and returns a reference to the stream. */ QDataStream& operator<<( QDataStream& stream, const OListView& listview ); /** * @relates OListView * Reads @a listview from the @a stream and returns a reference to the stream. */ @@ -207,32 +213,37 @@ class OListViewItem: public QListViewItem */ virtual OListViewItem* childFactory(); #ifndef QT_NO_DATASTREAM /** * serialize this object to or from a @ref QDataStream * @param s the stream used to serialize this object. */ virtual void serializeTo( QDataStream& s ) const; /** * serialize this object to or from a @ref QDataStream * @param s the stream used to serialize this object. */ virtual void serializeFrom( QDataStream& s ); #endif + /** + * expand the the item + */ + virtual void expand(){}; + private: bool m_known; bool m_odd; }; #ifndef QT_NO_DATASTREAM /** * @relates QListViewItem * Writes listview @a item and all subitems recursively to @a stream * and returns a reference to the stream. */ QDataStream& operator<<( QDataStream& stream, const OListViewItem& item ); /** * @relates QListViewItem * Reads listview @a item from @a stream and returns a reference to the stream. */ |