-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 @@ | |||
38 | /* OPIE */ | 38 | /* OPIE */ |
39 | 39 | ||
40 | #include <opie2/olistview.h> | 40 | #include <opie2/olistview.h> |
41 | 41 | ||
42 | /*====================================================================================== | 42 | /*====================================================================================== |
43 | * OListView | 43 | * OListView |
44 | *======================================================================================*/ | 44 | *======================================================================================*/ |
45 | 45 | ||
46 | OListView::OListView( QWidget *parent, const char *name ) | 46 | OListView::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 | ||
56 | OListView::~OListView() | 57 | OListView::~OListView() |
57 | { | 58 | { |
58 | } | 59 | } |
59 | 60 | ||
60 | void OListView::setFullWidth( bool fullWidth ) | 61 | void OListView::setFullWidth( bool fullWidth ) |
61 | { | 62 | { |
62 | m_fullWidth = m_fullWidth; | 63 | m_fullWidth = m_fullWidth; |
63 | #if QT_VERSION > 290 | 64 | #if QT_VERSION > 290 |
64 | header()->setStretchEnabled( fullWidth, columns()-1 ); | 65 | header()->setStretchEnabled( fullWidth, columns()-1 ); |
65 | #endif | 66 | #endif |
66 | } | 67 | } |
67 | 68 | ||
68 | bool OListView::fullWidth() const | 69 | bool OListView::fullWidth() const |
69 | { | 70 | { |
@@ -114,32 +115,37 @@ void OListView::setAlternateBackground( const QColor &c ) | |||
114 | { | 115 | { |
115 | m_alternateBackground = c; | 116 | m_alternateBackground = c; |
116 | repaint(); | 117 | repaint(); |
117 | } | 118 | } |
118 | 119 | ||
119 | const QPen& OListView::columnSeparator() const | 120 | const QPen& OListView::columnSeparator() const |
120 | { | 121 | { |
121 | return m_columnSeparator; | 122 | return m_columnSeparator; |
122 | } | 123 | } |
123 | 124 | ||
124 | void OListView::setColumnSeparator( const QPen& p ) | 125 | void OListView::setColumnSeparator( const QPen& p ) |
125 | { | 126 | { |
126 | m_columnSeparator = p; | 127 | m_columnSeparator = p; |
127 | repaint(); | 128 | repaint(); |
128 | } | 129 | } |
129 | 130 | ||
131 | void OListView::expand(QListViewItem *item) | ||
132 | { | ||
133 | ((OListViewItem*)item)->expand(); | ||
134 | } | ||
135 | |||
130 | OListViewItem* OListView::childFactory() | 136 | OListViewItem* 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 |
136 | void OListView::serializeTo( QDataStream& s ) const | 142 | void OListView::serializeTo( QDataStream& s ) const |
137 | { | 143 | { |
138 | #warning Caution... the binary format is still under construction... | 144 | #warning Caution... the binary format is still under construction... |
139 | qDebug( "storing OListView..." ); | 145 | qDebug( "storing OListView..." ); |
140 | 146 | ||
141 | // store number of columns and the labels | 147 | // store number of columns and the labels |
142 | s << columns(); | 148 | s << columns(); |
143 | for ( int i = 0; i < columns(); ++i ) | 149 | for ( int i = 0; i < columns(); ++i ) |
144 | s << columnText( i ); | 150 | s << columnText( i ); |
145 | 151 | ||
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 | |||
109 | /** | 109 | /** |
110 | * Create a list view item as child of this object | 110 | * Create a list view item as child of this object |
111 | * @returns the new object | 111 | * @returns the new object |
112 | */ | 112 | */ |
113 | virtual OListViewItem* childFactory(); | 113 | virtual OListViewItem* childFactory(); |
114 | #ifndef QT_NO_DATASTREAM | 114 | #ifndef QT_NO_DATASTREAM |
115 | /** | 115 | /** |
116 | * Serialize this object to @ref QDataStream @a stream | 116 | * Serialize this object to @ref QDataStream @a stream |
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 | ||
125 | protected 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 | /** |
133 | * @relates OListView | 139 | * @relates OListView |
134 | * Writes @a listview to the @a stream and returns a reference to the stream. | 140 | * Writes @a listview to the @a stream and returns a reference to the stream. |
135 | */ | 141 | */ |
136 | QDataStream& operator<<( QDataStream& stream, const OListView& listview ); | 142 | QDataStream& operator<<( QDataStream& stream, const OListView& listview ); |
137 | /** | 143 | /** |
138 | * @relates OListView | 144 | * @relates OListView |
139 | * Reads @a listview from the @a stream and returns a reference to the stream. | 145 | * Reads @a listview from the @a stream and returns a reference to the stream. |
140 | */ | 146 | */ |
@@ -207,32 +213,37 @@ class OListViewItem: public QListViewItem | |||
207 | */ | 213 | */ |
208 | virtual OListViewItem* childFactory(); | 214 | virtual OListViewItem* childFactory(); |
209 | #ifndef QT_NO_DATASTREAM | 215 | #ifndef QT_NO_DATASTREAM |
210 | /** | 216 | /** |
211 | * serialize this object to or from a @ref QDataStream | 217 | * serialize this object to or from a @ref QDataStream |
212 | * @param s the stream used to serialize this object. | 218 | * @param s the stream used to serialize this object. |
213 | */ | 219 | */ |
214 | virtual void serializeTo( QDataStream& s ) const; | 220 | virtual void serializeTo( QDataStream& s ) const; |
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 |
231 | * Writes listview @a item and all subitems recursively to @a stream | 242 | * Writes listview @a item and all subitems recursively to @a stream |
232 | * and returns a reference to the stream. | 243 | * and returns a reference to the stream. |
233 | */ | 244 | */ |
234 | QDataStream& operator<<( QDataStream& stream, const OListViewItem& item ); | 245 | QDataStream& operator<<( QDataStream& stream, const OListViewItem& item ); |
235 | /** | 246 | /** |
236 | * @relates QListViewItem | 247 | * @relates QListViewItem |
237 | * Reads listview @a item from @a stream and returns a reference to the stream. | 248 | * Reads listview @a item from @a stream and returns a reference to the stream. |
238 | */ | 249 | */ |