author | hgs |
Fri, 15 Oct 2010 12:29:39 +0300 | |
changeset 80 | d6dafc5d983f |
parent 26 | dc7c549001d5 |
permissions | -rw-r--r-- |
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/******************************************************************************* |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. This program and the accompanying materials |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* which accompanies this distribution, and is available at |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* http://www.eclipse.org/legal/epl-v10.html |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* Contributors: |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Nokia Corporation - initial implementation |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
*******************************************************************************/ |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
#ifndef SWT_LISTDATAMODEL_H |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
#define SWT_LISTDATAMODEL_H |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
#include <QAbstractListModel> |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
#include <QItemDelegate> |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
#include <QTextLayout> |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
#include <QItemSelection> |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
#include <QList> |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include "jniutils.h" |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
class QListView; |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
namespace Java { namespace eSWT { |
80 | 27 |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
class ListItem |
80 | 30 |
{ |
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
public: |
80 | 32 |
ListItem( const QString& aText ); |
33 |
virtual ~ListItem(); |
|
34 |
const QString& text() const; |
|
35 |
virtual const QPixmap* image() const; |
|
36 |
void setText(const QString& string); |
|
37 |
Qt::CheckState checkState() const; |
|
38 |
void setCheckState( Qt::CheckState state ); |
|
39 |
||
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
protected: |
80 | 41 |
Qt::CheckState state; |
42 |
QString txt; |
|
43 |
}; |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
45 |
class ListBoxItem : public ListItem |
80 | 46 |
{ |
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
public: |
80 | 48 |
ListBoxItem(const QString& aDetailText, const QPixmap* aDetailImages, const int aDetailImageCount, |
49 |
const QString& aHeadingText, const QPixmap* aHeadingImages, const int aHeadingImageCount ); |
|
50 |
~ListBoxItem(); |
|
51 |
const QString& headingText() const; |
|
52 |
const QList<QPixmap>& detailImages() const ; |
|
53 |
const QList<QPixmap>& headingImages() const; |
|
54 |
int detailImageCount() const; |
|
55 |
int headingImageCount() const; |
|
56 |
void setContentsToNull(); |
|
57 |
||
58 |
||
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
private: |
80 | 60 |
QString headingTxt; |
61 |
QList<QPixmap> detailImgs; |
|
62 |
QList<QPixmap> headingImgs; |
|
63 |
}; |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
class ListModel : public QAbstractListModel |
80 | 66 |
{ |
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
67 |
public: |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
68 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
69 |
ListModel( int type, int style, QListView *parent ); |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
70 |
~ListModel(); |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
71 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
72 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
73 |
/** |
80 | 74 |
* from QAbstractListModel |
75 |
*/ |
|
76 |
int rowCount(const QModelIndex& parent) const; |
|
77 |
QVariant data(const QModelIndex& index, int role) const; |
|
78 |
Qt::ItemFlags flags ( const QModelIndex& index ) const; |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
|
80 | 80 |
/** |
81 |
* called by JNI, these calls are delegated to protected methods from QAbstractListModel |
|
82 |
*/ |
|
83 |
void beginInsertRows( const QModelIndex& parent, int first, int last ); |
|
84 |
void endInsertRows(); |
|
85 |
void beginRemoveRows( const QModelIndex& parent, int first, int last ); |
|
86 |
void endRemoveRows(); |
|
87 |
void emitLayoutAboutToBeChanged(); |
|
88 |
void emitLayoutChanged(); |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
89 |
|
80 | 90 |
/** |
91 |
* called by JNI |
|
92 |
*/ |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
93 |
static ListModel* createDataModel( int type, int style, QListView *parent ); |
80 | 94 |
const QString& itemString( const int row ) const; |
95 |
jobjectArray itemStrings( JNIEnv* aJniEnv ); |
|
96 |
int indexOf( const QString& string, const int start ) const; |
|
97 |
int insertPosition(const QString& string, const bool ascent = true ); |
|
98 |
void setCheckState( const QItemSelection& selection, Qt::CheckState state ); |
|
99 |
void remove( const int row ); |
|
100 |
void appendItem( const QString& string ); |
|
101 |
void appendItem( const QString& string, const QPixmap* pixmap ); |
|
102 |
void insertItem( const int row, const QString& string ); |
|
103 |
void insertItem( const int row, const QString& string, const QPixmap* pixmap ); |
|
104 |
virtual void appendItem(const QString& aDetailText, const QPixmap* aDetailImages, const int aDetailImageCount, |
|
105 |
const QString& aHeadingText, const QPixmap* aHeadingImages, const int aHeadingImageCount ); |
|
106 |
virtual int itemHeight(); |
|
107 |
virtual void clearList(); |
|
108 |
virtual void setItemContentsToNull( const int row ); |
|
109 |
||
110 |
/** |
|
111 |
* called by other native classes |
|
112 |
*/ |
|
113 |
int style() const; |
|
114 |
||
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
115 |
protected: |
80 | 116 |
virtual ListItem* createItem( const QString& string ); |
117 |
virtual ListItem* createItem( const QString& string, const QPixmap* pixmap ); |
|
118 |
virtual ListItem* createItem(const QString& aDetailText, const QPixmap* aDetailImages, const int aDetailImageCount, |
|
119 |
const QString& aHeadingText, const QPixmap* aHeadingImages, const int aHeadingImageCount ); |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
120 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
121 |
protected: |
80 | 122 |
const int listType; |
123 |
const int layoutStyle; |
|
124 |
/** |
|
125 |
* data body |
|
126 |
*/ |
|
127 |
QList<ListItem*> list; |
|
128 |
}; |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
129 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
130 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
131 |
class ListBoxModel : public ListModel |
80 | 132 |
{ |
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
133 |
public: |
80 | 134 |
ListBoxModel( int type, int style, QListView *parent ); |
135 |
~ListBoxModel(); |
|
136 |
||
137 |
/** |
|
138 |
* from ListModel |
|
139 |
*/ |
|
140 |
void clearList(); |
|
141 |
void appendItem(const QString& aDetailText, const QPixmap* aDetailImages, const int aDetailImageCount, |
|
142 |
const QString& aHeadingText, const QPixmap* aHeadingImages, const int aHeadingImageCount ); |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
143 |
|
80 | 144 |
/** |
145 |
* Below 5 methods provide item data |
|
146 |
*/ |
|
147 |
const QString& headingText(const int row) const; |
|
148 |
int detailImageCount( const int row ) const; |
|
149 |
int headingImageCount( const int row ) const; |
|
150 |
const QList<QPixmap>& detailImages(const int row ) const; |
|
151 |
const QList<QPixmap>& headingImages( const int row ) const; |
|
152 |
||
153 |
/** |
|
154 |
* called by ListBoxDelegate to save cached layout data to ListModel |
|
155 |
* so that the ListBoxDelegate does not have to compute layout data from scratch |
|
156 |
* whenever drawing a list item. |
|
157 |
*/ |
|
158 |
void updateLayoutData( const int row, const int rowHeight, const QPoint detailTxtSize, |
|
159 |
const QPoint headingTxtSize, const int detailImgWidth, const int headingImgWidth ) const; |
|
160 |
||
161 |
/** |
|
162 |
* Below 10 methods provide cached layout data |
|
163 |
*/ |
|
164 |
const int& detailImageWidth(const int index ) const; |
|
165 |
const int& headingImageWidth(const int index ) const; |
|
166 |
QPoint detailTextSize() const; |
|
167 |
QPoint headingTextSize() const; |
|
168 |
int detailImageCount() const; |
|
169 |
int headingImageCount() const; |
|
170 |
QPoint detailImageSize(const int row) const; |
|
171 |
QPoint headingImageSize(const int row) const; |
|
172 |
int rowWithMaxDetailTextSize() const; |
|
173 |
int rowWithMaxHeadingTextSize() const; |
|
174 |
void setItemContentsToNull( const int row ); |
|
175 |
||
176 |
protected: |
|
177 |
/** |
|
178 |
* from ListModel |
|
179 |
*/ |
|
180 |
ListItem* createItem(const QString& aDetailText, const QPixmap* aDetailImages, const int aDetailImageCount, |
|
181 |
const QString& aHeadingText, const QPixmap* aHeadingImages, const int aHeadingImageCount ); |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
182 |
private: |
80 | 183 |
/** |
184 |
* layout data |
|
185 |
*/ |
|
186 |
||
187 |
/** |
|
188 |
* holds the index which item has the largest detail text size |
|
189 |
*/ |
|
190 |
int detailTxtIndex; |
|
191 |
||
192 |
/** |
|
193 |
* holds the index which item has the largest heading text size |
|
194 |
*/ |
|
195 |
int headingTxtIndex; |
|
196 |
||
197 |
/** |
|
198 |
* holds the largest detail text size |
|
199 |
*/ |
|
200 |
mutable QPoint detailTxtSize; |
|
201 |
||
202 |
/** |
|
203 |
* holds the largest heading text size |
|
204 |
*/ |
|
205 |
mutable QPoint headingTxtSize; |
|
206 |
||
207 |
/** |
|
208 |
* holds the amount of columns for detail images |
|
209 |
*/ |
|
210 |
int detailImgCount; |
|
211 |
||
212 |
/** |
|
213 |
* holds the amount of columns for heading images |
|
214 |
*/ |
|
215 |
int headingImgCount; |
|
216 |
||
217 |
/** |
|
218 |
* holds maximum height of images |
|
219 |
*/ |
|
220 |
int imgHeight; |
|
221 |
||
222 |
/** |
|
223 |
* holds widths for every detail image columns |
|
224 |
*/ |
|
225 |
int* detailImgWidths; |
|
226 |
||
227 |
/** |
|
228 |
* holds widths for every heading image columns |
|
229 |
*/ |
|
230 |
int* headingImgWidths; |
|
231 |
||
232 |
/** |
|
233 |
* holds heights for every rows |
|
234 |
*/ |
|
235 |
mutable int* rowHeights; |
|
236 |
||
237 |
/** |
|
238 |
* holds entire width for all of detail images. |
|
239 |
*/ |
|
240 |
mutable int detailImgWidth; |
|
241 |
||
242 |
/** |
|
243 |
* holds entire width for all of heading images. |
|
244 |
*/ |
|
245 |
mutable int headingImgWidth; |
|
246 |
}; |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
247 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
248 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
249 |
class ListBoxItemDelegate : public QItemDelegate |
80 | 250 |
{ |
251 |
Q_OBJECT |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
252 |
public: |
80 | 253 |
ListBoxItemDelegate( QObject* parent ); |
254 |
||
255 |
// from QItemDelegate |
|
256 |
void paint(QPainter * painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const; |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
257 |
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
258 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
259 |
// called from JNI |
80 | 260 |
void setHeadingFont( QFont* font ); |
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
261 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
262 |
private: |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
263 |
|
80 | 264 |
/** |
265 |
* compute sizes of checkbox, detailtext, headingtext, detailImage and headingImage. |
|
266 |
*/ |
|
267 |
void computeSizes( const QModelIndex& index, const QStyleOptionViewItem& option, QSize* checkSize, |
|
268 |
QSize *headingImageSize, QSize* detailImageSize, QSize* headingTextSize, QSize* detailTextSize) const; |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
269 |
|
80 | 270 |
/** |
271 |
* add margins to checkbox, detailtext, headingtext, detailImage and headingImage. |
|
272 |
*/ |
|
273 |
void addMargins( const QStyleOptionViewItem &option, QSize* checkSize, |
|
274 |
QSize* headingImageSize, QSize* detailImageSize, QSize* headingTextSize, QSize* detailTextSize ) const; |
|
275 |
||
276 |
/** |
|
277 |
* compute item entire size for the item |
|
278 |
*/ |
|
279 |
QSize computeSize( const QStyleOptionViewItem &option, const QSize& check, const QSize& headingImage, |
|
280 |
const QSize& detailImage, const QSize& headingText, const QSize& detailText ) const; |
|
281 |
||
282 |
/** |
|
283 |
* layout checkbox, detailtext, headingtext, detailImage and headingImage within a given rectangle |
|
284 |
* and adjust sizes and positions according to alignments from option |
|
285 |
*/ |
|
286 |
void layoutRects( const QStyleOptionViewItem &option, QRect* check, QRect *headingImage, |
|
287 |
QRect* detailImage, QRect* headingText, QRect* detailText, bool hint ) const; |
|
288 |
||
289 |
/** |
|
290 |
* layout checkbox, detailtext, headingtext, detailImage and headingImage within a given rectangle |
|
291 |
*/ |
|
292 |
void doLayout( const QStyleOptionViewItem &option, QRect* checkRect, QRect* headingImageRect, |
|
293 |
QRect* detailImageRect, QRect* headingTextRect, QRect* detailTextRect ) const; |
|
294 |
QStyleOptionViewItem setOptions(const QModelIndex &index, const QStyleOptionViewItem &option) const; |
|
295 |
||
296 |
QRect textRectangle(const int width, const QFont &font, const QString &text) const; |
|
297 |
||
298 |
int margin( const QStyleOptionViewItem &option ) const; |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
299 |
|
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
300 |
private: |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
301 |
void drawImages( QPainter* painter, const QStyleOptionViewItem &option, |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
302 |
const QRect imageRect, const QList<QPixmap>& images, const int* imageWidths, const int imageCount ) const; |
80 | 303 |
|
304 |
private: |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
305 |
|
80 | 306 |
/** |
307 |
* not own |
|
308 |
*/ |
|
309 |
const ListBoxModel* dataModel; |
|
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
310 |
mutable QTextLayout textLayout; |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
311 |
QFont* headingFont; |
80 | 312 |
}; |
313 |
||
21
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
314 |
}} |
2a9601315dfc
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
315 |
#endif // SWT_LISTDATAMODEL_H |