summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-06-28 14:11:46 (UTC)
committer mickeyl <mickeyl>2003-06-28 14:11:46 (UTC)
commit50e4e1e8876372bf9dbb0c32acc93c65434738d5 (patch) (unidiff)
treec430a08b75b7008d9e717df7be96c6479f1bebe5
parent5bb184fd350f1e6352b6f41fbb18b59d2d3d7403 (diff)
downloadopie-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
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/olistview.cpp6
-rw-r--r--libopie2/opieui/olistview.h11
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
@@ -46,16 +46,17 @@
46OListView::OListView( QWidget *parent, const char *name ) 46OListView::OListView( QWidget *parent, const char *name )
47 :QListView( parent, name ) 47 :QListView( parent, name )
48{ 48{
49 //FIXME: get from global settings and calculate ==> see oglobalsettings.* 49 //FIXME: get from global settings and calculate ==> see oglobalsettings.*
50 50
51 m_alternateBackground = QColor( 238, 246, 255 ); 51 m_alternateBackground = QColor( 238, 246, 255 );
52 m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine ); 52 m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine );
53 m_fullWidth = true; 53 m_fullWidth = true;
54 connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*)));
54} 55}
55 56
56OListView::~OListView() 57OListView::~OListView()
57{ 58{
58} 59}
59 60
60void OListView::setFullWidth( bool fullWidth ) 61void OListView::setFullWidth( bool fullWidth )
61{ 62{
@@ -122,16 +123,21 @@ const QPen& OListView::columnSeparator() const
122} 123}
123 124
124void OListView::setColumnSeparator( const QPen& p ) 125void OListView::setColumnSeparator( const QPen& p )
125{ 126{
126 m_columnSeparator = p; 127 m_columnSeparator = p;
127 repaint(); 128 repaint();
128} 129}
129 130
131void OListView::expand(QListViewItem *item)
132{
133 ((OListViewItem*)item)->expand();
134}
135
130OListViewItem* OListView::childFactory() 136OListViewItem* OListView::childFactory()
131{ 137{
132 return new OListViewItem( this ); 138 return new OListViewItem( this );
133} 139}
134 140
135#ifndef QT_NO_DATASTREAM 141#ifndef QT_NO_DATASTREAM
136void OListView::serializeTo( QDataStream& s ) const 142void OListView::serializeTo( QDataStream& s ) const
137{ 143{
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
@@ -117,16 +117,22 @@ class OListView: public QListView
117 */ 117 */
118 virtual void serializeTo( QDataStream& stream ) const; 118 virtual void serializeTo( QDataStream& stream ) const;
119 /** 119 /**
120 * Serialize this object from a @ref QDataStream @a stream 120 * Serialize this object from a @ref QDataStream @a stream
121 */ 121 */
122 virtual void serializeFrom( QDataStream& s ); 122 virtual void serializeFrom( QDataStream& s );
123#endif 123#endif
124 124
125protected slots:
126 /**
127 * expand the current OListViewItem
128 */
129 void expand(QListViewItem*);
130
125 private: 131 private:
126 QColor m_alternateBackground; 132 QColor m_alternateBackground;
127 bool m_fullWidth; 133 bool m_fullWidth;
128 QPen m_columnSeparator; 134 QPen m_columnSeparator;
129}; 135};
130 136
131#ifndef QT_NO_DATASTREAM 137#ifndef QT_NO_DATASTREAM
132/** 138/**
@@ -215,16 +221,21 @@ class OListViewItem: public QListViewItem
215 221
216 /** 222 /**
217 * serialize this object to or from a @ref QDataStream 223 * serialize this object to or from a @ref QDataStream
218 * @param s the stream used to serialize this object. 224 * @param s the stream used to serialize this object.
219 */ 225 */
220 virtual void serializeFrom( QDataStream& s ); 226 virtual void serializeFrom( QDataStream& s );
221 #endif 227 #endif
222 228
229 /**
230 * expand the the item
231 */
232 virtual void expand(){};
233
223 private: 234 private:
224 bool m_known; 235 bool m_known;
225 bool m_odd; 236 bool m_odd;
226}; 237};
227 238
228#ifndef QT_NO_DATASTREAM 239#ifndef QT_NO_DATASTREAM
229/** 240/**
230 * @relates QListViewItem 241 * @relates QListViewItem