itemviews/qstyleditemdelegate.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qstyleditemdelegate.h" -
43 -
44#ifndef QT_NO_ITEMVIEWS -
45#include <qabstractitemmodel.h> -
46#include <qapplication.h> -
47#include <qpa/qplatformintegration.h> -
48#include <qpa/qplatformdrag.h> -
49#include <private/qguiapplication_p.h> -
50#include <qbrush.h> -
51#include <qlineedit.h> -
52#include <qtextedit.h> -
53#include <qplaintextedit.h> -
54#include <qpainter.h> -
55#include <qpalette.h> -
56#include <qpoint.h> -
57#include <qrect.h> -
58#include <qsize.h> -
59#include <qstyle.h> -
60#include <qdatetime.h> -
61#include <qstyleoption.h> -
62#include <qevent.h> -
63#include <qpixmap.h> -
64#include <qbitmap.h> -
65#include <qpixmapcache.h> -
66#include <qitemeditorfactory.h> -
67#include <private/qitemeditorfactory_p.h> -
68#include <qmetaobject.h> -
69#include <qtextlayout.h> -
70#include <private/qobject_p.h> -
71#include <private/qdnd_p.h> -
72#include <private/qtextengine_p.h> -
73#include <private/qlayoutengine_p.h> -
74#include <qdebug.h> -
75#include <qlocale.h> -
76#include <qdialog.h> -
77#include <qtableview.h> -
78 -
79#include <limits.h> -
80 -
81QT_BEGIN_NAMESPACE -
82 -
83class QStyledItemDelegatePrivate : public QObjectPrivate -
84{ -
85 Q_DECLARE_PUBLIC(QStyledItemDelegate) -
86 -
87public: -
88 QStyledItemDelegatePrivate() : factory(0) { }
executed: }
Execution Count:4211
4211
89 -
90 static const QWidget *widget(const QStyleOptionViewItem &option) -
91 { -
92 return option.widget;
executed: return option.widget;
Execution Count:164027
164027
93 } -
94 -
95 const QItemEditorFactory *editorFactory() const -
96 { -
97 return factory ? factory : QItemEditorFactory::defaultFactory();
executed: return factory ? factory : QItemEditorFactory::defaultFactory();
Execution Count:86
86
98 } -
99 -
100 void _q_commitDataAndCloseEditor(QWidget *editor) -
101 { -
102 Q_Q(QStyledItemDelegate);
executed (the execution status of this line is deduced): QStyledItemDelegate * const q = q_func();
-
103 emit q->commitData(editor);
executed (the execution status of this line is deduced): q->commitData(editor);
-
104 emit q->closeEditor(editor, QAbstractItemDelegate::SubmitModelCache);
executed (the execution status of this line is deduced): q->closeEditor(editor, QAbstractItemDelegate::SubmitModelCache);
-
105 }
executed: }
Execution Count:12
12
106 QItemEditorFactory *factory; -
107}; -
108 -
109/*! -
110 \class QStyledItemDelegate -
111 -
112 \brief The QStyledItemDelegate class provides display and editing facilities for -
113 data items from a model. -
114 -
115 \ingroup model-view -
116 \inmodule QtWidgets -
117 -
118 \since 4.4 -
119 -
120 When displaying data from models in Qt item views, e.g., a -
121 QTableView, the individual items are drawn by a delegate. Also, -
122 when an item is edited, it provides an editor widget, which is -
123 placed on top of the item view while editing takes place. -
124 QStyledItemDelegate is the default delegate for all Qt item -
125 views, and is installed upon them when they are created. -
126 -
127 The QStyledItemDelegate class is one of the \l{Model/View Classes} -
128 and is part of Qt's \l{Model/View Programming}{model/view -
129 framework}. The delegate allows the display and editing of items -
130 to be developed independently from the model and view. -
131 -
132 The data of items in models are assigned an -
133 \l{Qt::}{ItemDataRole}; each item can store a QVariant for each -
134 role. QStyledItemDelegate implements display and editing for the -
135 most common datatypes expected by users, including booleans, -
136 integers, and strings. -
137 -
138 The data will be drawn differently depending on which role they -
139 have in the model. The following table describes the roles and the -
140 data types the delegate can handle for each of them. It is often -
141 sufficient to ensure that the model returns appropriate data for -
142 each of the roles to determine the appearance of items in views. -
143 -
144 \table -
145 \header \li Role \li Accepted Types -
146 \omit -
147 \row \li \l Qt::AccessibleDescriptionRole \li QString -
148 \row \li \l Qt::AccessibleTextRole \li QString -
149 \endomit -
150 \row \li \l Qt::BackgroundRole \li QBrush -
151 \row \li \l Qt::BackgroundColorRole \li QColor (obsolete; use Qt::BackgroundRole instead) -
152 \row \li \l Qt::CheckStateRole \li Qt::CheckState -
153 \row \li \l Qt::DecorationRole \li QIcon, QPixmap, QImage and QColor -
154 \row \li \l Qt::DisplayRole \li QString and types with a string representation -
155 \row \li \l Qt::EditRole \li See QItemEditorFactory for details -
156 \row \li \l Qt::FontRole \li QFont -
157 \row \li \l Qt::SizeHintRole \li QSize -
158 \omit -
159 \row \li \l Qt::StatusTipRole \li -
160 \endomit -
161 \row \li \l Qt::TextAlignmentRole \li Qt::Alignment -
162 \row \li \l Qt::ForegroundRole \li QBrush -
163 \row \li \l Qt::TextColorRole \li QColor (obsolete; use Qt::ForegroundRole instead) -
164 \omit -
165 \row \li \l Qt::ToolTipRole -
166 \row \li \l Qt::WhatsThisRole -
167 \endomit -
168 \endtable -
169 -
170 Editors are created with a QItemEditorFactory; a default static -
171 instance provided by QItemEditorFactory is installed on all item -
172 delegates. You can set a custom factory using -
173 setItemEditorFactory() or set a new default factory with -
174 QItemEditorFactory::setDefaultFactory(). It is the data stored in -
175 the item model with the \l{Qt::}{EditRole} that is edited. See the -
176 QItemEditorFactory class for a more high-level introduction to -
177 item editor factories. The \l{Color Editor Factory Example}{Color -
178 Editor Factory} example shows how to create custom editors with a -
179 factory. -
180 -
181 \section1 Subclassing QStyledItemDelegate -
182 -
183 If the delegate does not support painting of the data types you -
184 need or you want to customize the drawing of items, you need to -
185 subclass QStyledItemDelegate, and reimplement paint() and possibly -
186 sizeHint(). The paint() function is called individually for each -
187 item, and with sizeHint(), you can specify the hint for each -
188 of them. -
189 -
190 When reimplementing paint(), one would typically handle the -
191 datatypes one would like to draw and use the superclass -
192 implementation for other types. -
193 -
194 The painting of check box indicators are performed by the current -
195 style. The style also specifies the size and the bounding -
196 rectangles in which to draw the data for the different data roles. -
197 The bounding rectangle of the item itself is also calculated by -
198 the style. When drawing already supported datatypes, it is -
199 therefore a good idea to ask the style for these bounding -
200 rectangles. The QStyle class description describes this in -
201 more detail. -
202 -
203 If you wish to change any of the bounding rectangles calculated by -
204 the style or the painting of check box indicators, you can -
205 subclass QStyle. Note, however, that the size of the items can -
206 also be affected by reimplementing sizeHint(). -
207 -
208 It is possible for a custom delegate to provide editors -
209 without the use of an editor item factory. In this case, the -
210 following virtual functions must be reimplemented: -
211 -
212 \list -
213 \li createEditor() returns the widget used to change data from the model -
214 and can be reimplemented to customize editing behavior. -
215 \li setEditorData() provides the widget with data to manipulate. -
216 \li updateEditorGeometry() ensures that the editor is displayed correctly -
217 with respect to the item view. -
218 \li setModelData() returns updated data to the model. -
219 \endlist -
220 -
221 The \l{Star Delegate Example}{Star Delegate} example creates -
222 editors by reimplementing these methods. -
223 -
224 \section1 QStyledItemDelegate vs. QItemDelegate -
225 -
226 Since Qt 4.4, there are two delegate classes: QItemDelegate and -
227 QStyledItemDelegate. However, the default delegate is QStyledItemDelegate. -
228 These two classes are independent alternatives to painting and providing -
229 editors for items in views. The difference between them is that -
230 QStyledItemDelegate uses the current style to paint its items. We therefore -
231 recommend using QStyledItemDelegate as the base class when implementing -
232 custom delegates or when working with Qt style sheets. The code required -
233 for either class should be equal unless the custom delegate needs to use -
234 the style for drawing. -
235 -
236 If you wish to customize the painting of item views, you should -
237 implement a custom style. Please see the QStyle class -
238 documentation for details. -
239 -
240 \sa {Delegate Classes}, QItemDelegate, QAbstractItemDelegate, QStyle, -
241 {Spin Box Delegate Example}, {Star Delegate Example}, {Color -
242 Editor Factory Example} -
243*/ -
244 -
245 -
246/*! -
247 Constructs an item delegate with the given \a parent. -
248*/ -
249QStyledItemDelegate::QStyledItemDelegate(QObject *parent) -
250 : QAbstractItemDelegate(*new QStyledItemDelegatePrivate(), parent) -
251{ -
252}
executed: }
Execution Count:4211
4211
253 -
254/*! -
255 Destroys the item delegate. -
256*/ -
257QStyledItemDelegate::~QStyledItemDelegate() -
258{ -
259} -
260 -
261/*! -
262 This function returns the string that the delegate will use to display the -
263 Qt::DisplayRole of the model in \a locale. \a value is the value of the Qt::DisplayRole -
264 provided by the model. -
265 -
266 The default implementation uses the QLocale::toString to convert \a value into -
267 a QString. -
268 -
269 This function is not called for empty model indices, i.e., indices for which -
270 the model returns an invalid QVariant. -
271 -
272 \sa QAbstractItemModel::data() -
273*/ -
274QString QStyledItemDelegate::displayText(const QVariant &value, const QLocale& locale) const -
275{ -
276 QString text;
executed (the execution status of this line is deduced): QString text;
-
277 switch (value.userType()) { -
278 case QMetaType::Float: -
279 case QVariant::Double: -
280 text = locale.toString(value.toReal());
executed (the execution status of this line is deduced): text = locale.toString(value.toReal());
-
281 break;
executed: break;
Execution Count:11
11
282 case QVariant::Int: -
283 case QVariant::LongLong: -
284 text = locale.toString(value.toLongLong());
executed (the execution status of this line is deduced): text = locale.toString(value.toLongLong());
-
285 break;
executed: break;
Execution Count:4094
4094
286 case QVariant::UInt: -
287 case QVariant::ULongLong: -
288 text = locale.toString(value.toULongLong());
executed (the execution status of this line is deduced): text = locale.toString(value.toULongLong());
-
289 break;
executed: break;
Execution Count:12
12
290 case QVariant::Date: -
291 text = locale.toString(value.toDate(), QLocale::ShortFormat);
executed (the execution status of this line is deduced): text = locale.toString(value.toDate(), QLocale::ShortFormat);
-
292 break;
executed: break;
Execution Count:6
6
293 case QVariant::Time: -
294 text = locale.toString(value.toTime(), QLocale::ShortFormat);
executed (the execution status of this line is deduced): text = locale.toString(value.toTime(), QLocale::ShortFormat);
-
295 break;
executed: break;
Execution Count:7
7
296 case QVariant::DateTime: -
297 text = locale.toString(value.toDateTime().date(), QLocale::ShortFormat);
executed (the execution status of this line is deduced): text = locale.toString(value.toDateTime().date(), QLocale::ShortFormat);
-
298 text += QLatin1Char(' ');
executed (the execution status of this line is deduced): text += QLatin1Char(' ');
-
299 text += locale.toString(value.toDateTime().time(), QLocale::ShortFormat);
executed (the execution status of this line is deduced): text += locale.toString(value.toDateTime().time(), QLocale::ShortFormat);
-
300 break;
executed: break;
Execution Count:6
6
301 default: -
302 // convert new lines into line separators -
303 text = value.toString();
executed (the execution status of this line is deduced): text = value.toString();
-
304 for (int i = 0; i < text.count(); ++i) {
evaluated: i < text.count()
TRUEFALSE
yes
Evaluation Count:1217894
yes
Evaluation Count:120595
120595-1217894
305 if (text.at(i) == QLatin1Char('\n'))
evaluated: text.at(i) == QLatin1Char('\n')
TRUEFALSE
yes
Evaluation Count:9048
yes
Evaluation Count:1208846
9048-1208846
306 text[i] = QChar::LineSeparator;
executed: text[i] = QChar::LineSeparator;
Execution Count:9048
9048
307 }
executed: }
Execution Count:1217894
1217894
308 break;
executed: break;
Execution Count:120595
120595
309 } -
310 return text;
executed: return text;
Execution Count:124731
124731
311} -
312 -
313/*! -
314 Initialize \a option with the values using the index \a index. This method -
315 is useful for subclasses when they need a QStyleOptionViewItem, but don't want -
316 to fill in all the information themselves. -
317 -
318 \sa QStyleOption::initFrom() -
319*/ -
320void QStyledItemDelegate::initStyleOption(QStyleOptionViewItem *option, -
321 const QModelIndex &index) const -
322{ -
323 QVariant value = index.data(Qt::FontRole);
executed (the execution status of this line is deduced): QVariant value = index.data(Qt::FontRole);
-
324 if (value.isValid() && !value.isNull()) {
partially evaluated: value.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:164154
never evaluated: !value.isNull()
0-164154
325 option->font = qvariant_cast<QFont>(value).resolve(option->font);
never executed (the execution status of this line is deduced): option->font = qvariant_cast<QFont>(value).resolve(option->font);
-
326 option->fontMetrics = QFontMetrics(option->font);
never executed (the execution status of this line is deduced): option->fontMetrics = QFontMetrics(option->font);
-
327 }
never executed: }
0
328 -
329 value = index.data(Qt::TextAlignmentRole);
executed (the execution status of this line is deduced): value = index.data(Qt::TextAlignmentRole);
-
330 if (value.isValid() && !value.isNull())
evaluated: value.isValid()
TRUEFALSE
yes
Evaluation Count:1019
yes
Evaluation Count:163135
partially evaluated: !value.isNull()
TRUEFALSE
yes
Evaluation Count:1019
no
Evaluation Count:0
0-163135
331 option->displayAlignment = Qt::Alignment(value.toInt());
executed: option->displayAlignment = Qt::Alignment(value.toInt());
Execution Count:1019
1019
332 -
333 value = index.data(Qt::ForegroundRole);
executed (the execution status of this line is deduced): value = index.data(Qt::ForegroundRole);
-
334 if (value.canConvert<QBrush>())
evaluated: value.canConvert<QBrush>()
TRUEFALSE
yes
Evaluation Count:53155
yes
Evaluation Count:110999
53155-110999
335 option->palette.setBrush(QPalette::Text, qvariant_cast<QBrush>(value));
executed: option->palette.setBrush(QPalette::Text, qvariant_cast<QBrush>(value));
Execution Count:53155
53155
336 -
337 option->index = index;
executed (the execution status of this line is deduced): option->index = index;
-
338 value = index.data(Qt::CheckStateRole);
executed (the execution status of this line is deduced): value = index.data(Qt::CheckStateRole);
-
339 if (value.isValid() && !value.isNull()) {
evaluated: value.isValid()
TRUEFALSE
yes
Evaluation Count:90
yes
Evaluation Count:164064
partially evaluated: !value.isNull()
TRUEFALSE
yes
Evaluation Count:90
no
Evaluation Count:0
0-164064
340 option->features |= QStyleOptionViewItem::HasCheckIndicator;
executed (the execution status of this line is deduced): option->features |= QStyleOptionViewItem::HasCheckIndicator;
-
341 option->checkState = static_cast<Qt::CheckState>(value.toInt());
executed (the execution status of this line is deduced): option->checkState = static_cast<Qt::CheckState>(value.toInt());
-
342 }
executed: }
Execution Count:90
90
343 -
344 value = index.data(Qt::DecorationRole);
executed (the execution status of this line is deduced): value = index.data(Qt::DecorationRole);
-
345 if (value.isValid() && !value.isNull()) {
evaluated: value.isValid()
TRUEFALSE
yes
Evaluation Count:27582
yes
Evaluation Count:136572
evaluated: !value.isNull()
TRUEFALSE
yes
Evaluation Count:27525
yes
Evaluation Count:57
57-136572
346 option->features |= QStyleOptionViewItem::HasDecoration;
executed (the execution status of this line is deduced): option->features |= QStyleOptionViewItem::HasDecoration;
-
347 switch (value.type()) { -
348 case QVariant::Icon: { -
349 option->icon = qvariant_cast<QIcon>(value);
executed (the execution status of this line is deduced): option->icon = qvariant_cast<QIcon>(value);
-
350 QIcon::Mode mode;
executed (the execution status of this line is deduced): QIcon::Mode mode;
-
351 if (!(option->state & QStyle::State_Enabled))
partially evaluated: !(option->state & QStyle::State_Enabled)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:27525
0-27525
352 mode = QIcon::Disabled;
never executed: mode = QIcon::Disabled;
0
353 else if (option->state & QStyle::State_Selected)
evaluated: option->state & QStyle::State_Selected
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:27504
21-27504
354 mode = QIcon::Selected;
executed: mode = QIcon::Selected;
Execution Count:21
21
355 else -
356 mode = QIcon::Normal;
executed: mode = QIcon::Normal;
Execution Count:27504
27504
357 QIcon::State state = option->state & QStyle::State_Open ? QIcon::On : QIcon::Off;
evaluated: option->state & QStyle::State_Open
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:27509
16-27509
358 option->decorationSize = option->icon.actualSize(option->decorationSize, mode, state);
executed (the execution status of this line is deduced): option->decorationSize = option->icon.actualSize(option->decorationSize, mode, state);
-
359 break;
executed: break;
Execution Count:27525
27525
360 } -
361 case QVariant::Color: { -
362 QPixmap pixmap(option->decorationSize);
never executed (the execution status of this line is deduced): QPixmap pixmap(option->decorationSize);
-
363 pixmap.fill(qvariant_cast<QColor>(value));
never executed (the execution status of this line is deduced): pixmap.fill(qvariant_cast<QColor>(value));
-
364 option->icon = QIcon(pixmap);
never executed (the execution status of this line is deduced): option->icon = QIcon(pixmap);
-
365 break;
never executed: break;
0
366 } -
367 case QVariant::Image: { -
368 QImage image = qvariant_cast<QImage>(value);
never executed (the execution status of this line is deduced): QImage image = qvariant_cast<QImage>(value);
-
369 option->icon = QIcon(QPixmap::fromImage(image));
never executed (the execution status of this line is deduced): option->icon = QIcon(QPixmap::fromImage(image));
-
370 option->decorationSize = image.size();
never executed (the execution status of this line is deduced): option->decorationSize = image.size();
-
371 break;
never executed: break;
0
372 } -
373 case QVariant::Pixmap: { -
374 QPixmap pixmap = qvariant_cast<QPixmap>(value);
never executed (the execution status of this line is deduced): QPixmap pixmap = qvariant_cast<QPixmap>(value);
-
375 option->icon = QIcon(pixmap);
never executed (the execution status of this line is deduced): option->icon = QIcon(pixmap);
-
376 option->decorationSize = pixmap.size();
never executed (the execution status of this line is deduced): option->decorationSize = pixmap.size();
-
377 break;
never executed: break;
0
378 } -
379 default: -
380 break;
never executed: break;
0
381 } -
382 }
executed: }
Execution Count:27525
27525
383 -
384 value = index.data(Qt::DisplayRole);
executed (the execution status of this line is deduced): value = index.data(Qt::DisplayRole);
-
385 if (value.isValid() && !value.isNull()) {
evaluated: value.isValid()
TRUEFALSE
yes
Evaluation Count:124741
yes
Evaluation Count:39413
evaluated: !value.isNull()
TRUEFALSE
yes
Evaluation Count:124731
yes
Evaluation Count:10
10-124741
386 option->features |= QStyleOptionViewItem::HasDisplay;
executed (the execution status of this line is deduced): option->features |= QStyleOptionViewItem::HasDisplay;
-
387 option->text = displayText(value, option->locale);
executed (the execution status of this line is deduced): option->text = displayText(value, option->locale);
-
388 }
executed: }
Execution Count:124731
124731
389 -
390 option->backgroundBrush = qvariant_cast<QBrush>(index.data(Qt::BackgroundRole));
executed (the execution status of this line is deduced): option->backgroundBrush = qvariant_cast<QBrush>(index.data(Qt::BackgroundRole));
-
391}
executed: }
Execution Count:164154
164154
392 -
393/*! -
394 Renders the delegate using the given \a painter and style \a option for -
395 the item specified by \a index. -
396 -
397 This function paints the item using the view's QStyle. -
398 -
399 When reimplementing paint in a subclass. Use the initStyleOption() -
400 to set up the \a option in the same way as the -
401 QStyledItemDelegate. -
402 -
403 Whenever possible, use the \a option while painting. -
404 Especially its \l{QStyleOption::}{rect} variable to decide -
405 where to draw and its \l{QStyleOption::}{state} to determine -
406 if it is enabled or selected. -
407 -
408 After painting, you should ensure that the painter is returned to -
409 its the state it was supplied in when this function was called. -
410 For example, it may be useful to call QPainter::save() before -
411 painting and QPainter::restore() afterwards. -
412 -
413 \sa QItemDelegate::paint(), QStyle::drawControl(), QStyle::CE_ItemViewItem -
414*/ -
415void QStyledItemDelegate::paint(QPainter *painter, -
416 const QStyleOptionViewItem &option, const QModelIndex &index) const -
417{ -
418 Q_ASSERT(index.isValid());
executed (the execution status of this line is deduced): qt_noop();
-
419 -
420 QStyleOptionViewItem opt = option;
executed (the execution status of this line is deduced): QStyleOptionViewItem opt = option;
-
421 initStyleOption(&opt, index);
executed (the execution status of this line is deduced): initStyleOption(&opt, index);
-
422 -
423 const QWidget *widget = QStyledItemDelegatePrivate::widget(option);
executed (the execution status of this line is deduced): const QWidget *widget = QStyledItemDelegatePrivate::widget(option);
-
424 QStyle *style = widget ? widget->style() : QApplication::style();
partially evaluated: widget
TRUEFALSE
yes
Evaluation Count:13241
no
Evaluation Count:0
0-13241
425 style->drawControl(QStyle::CE_ItemViewItem, &opt, painter, widget);
executed (the execution status of this line is deduced): style->drawControl(QStyle::CE_ItemViewItem, &opt, painter, widget);
-
426}
executed: }
Execution Count:13241
13241
427 -
428/*! -
429 Returns the size needed by the delegate to display the item -
430 specified by \a index, taking into account the style information -
431 provided by \a option. -
432 -
433 This function uses the view's QStyle to determine the size of the -
434 item. -
435 -
436 \sa QStyle::sizeFromContents(), QStyle::CT_ItemViewItem -
437*/ -
438QSize QStyledItemDelegate::sizeHint(const QStyleOptionViewItem &option, -
439 const QModelIndex &index) const -
440{ -
441 QVariant value = index.data(Qt::SizeHintRole);
executed (the execution status of this line is deduced): QVariant value = index.data(Qt::SizeHintRole);
-
442 if (value.isValid())
evaluated: value.isValid()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:150673
10-150673
443 return qvariant_cast<QSize>(value);
executed: return qvariant_cast<QSize>(value);
Execution Count:10
10
444 -
445 QStyleOptionViewItem opt = option;
executed (the execution status of this line is deduced): QStyleOptionViewItem opt = option;
-
446 initStyleOption(&opt, index);
executed (the execution status of this line is deduced): initStyleOption(&opt, index);
-
447 const QWidget *widget = QStyledItemDelegatePrivate::widget(option);
executed (the execution status of this line is deduced): const QWidget *widget = QStyledItemDelegatePrivate::widget(option);
-
448 QStyle *style = widget ? widget->style() : QApplication::style();
partially evaluated: widget
TRUEFALSE
yes
Evaluation Count:150673
no
Evaluation Count:0
0-150673
449 return style->sizeFromContents(QStyle::CT_ItemViewItem, &opt, QSize(), widget);
executed: return style->sizeFromContents(QStyle::CT_ItemViewItem, &opt, QSize(), widget);
Execution Count:150673
150673
450} -
451 -
452/*! -
453 Returns the widget used to edit the item specified by \a index -
454 for editing. The \a parent widget and style \a option are used to -
455 control how the editor widget appears. -
456 -
457 \sa QAbstractItemDelegate::createEditor() -
458*/ -
459QWidget *QStyledItemDelegate::createEditor(QWidget *parent, -
460 const QStyleOptionViewItem &, -
461 const QModelIndex &index) const -
462{ -
463 Q_D(const QStyledItemDelegate);
executed (the execution status of this line is deduced): const QStyledItemDelegatePrivate * const d = d_func();
-
464 if (!index.isValid())
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:86
20-86
465 return 0;
executed: return 0;
Execution Count:20
20
466 return d->editorFactory()->createEditor(index.data(Qt::EditRole).userType(), parent);
executed: return d->editorFactory()->createEditor(index.data(Qt::EditRole).userType(), parent);
Execution Count:86
86
467} -
468 -
469/*! -
470 Sets the data to be displayed and edited by the \a editor from the -
471 data model item specified by the model \a index. -
472 -
473 The default implementation stores the data in the \a editor -
474 widget's \l {Qt's Property System} {user property}. -
475 -
476 \sa QMetaProperty::isUser() -
477*/ -
478void QStyledItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const -
479{ -
480#ifdef QT_NO_PROPERTIES -
481 Q_UNUSED(editor); -
482 Q_UNUSED(index); -
483#else -
484 QVariant v = index.data(Qt::EditRole);
executed (the execution status of this line is deduced): QVariant v = index.data(Qt::EditRole);
-
485 QByteArray n = editor->metaObject()->userProperty().name();
executed (the execution status of this line is deduced): QByteArray n = editor->metaObject()->userProperty().name();
-
486 -
487 if (!n.isEmpty()) {
partially evaluated: !n.isEmpty()
TRUEFALSE
yes
Evaluation Count:115
no
Evaluation Count:0
0-115
488 if (!v.isValid())
evaluated: !v.isValid()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:97
18-97
489 v = QVariant(editor->property(n).userType(), (const void *)0);
executed: v = QVariant(editor->property(n).userType(), (const void *)0);
Execution Count:18
18
490 editor->setProperty(n, v);
executed (the execution status of this line is deduced): editor->setProperty(n, v);
-
491 }
executed: }
Execution Count:115
115
492#endif -
493}
executed: }
Execution Count:115
115
494 -
495/*! -
496 Gets data from the \a editor widget and stores it in the specified -
497 \a model at the item \a index. -
498 -
499 The default implementation gets the value to be stored in the data -
500 model from the \a editor widget's \l {Qt's Property System} {user -
501 property}. -
502 -
503 \sa QMetaProperty::isUser() -
504*/ -
505void QStyledItemDelegate::setModelData(QWidget *editor, -
506 QAbstractItemModel *model, -
507 const QModelIndex &index) const -
508{ -
509#ifdef QT_NO_PROPERTIES -
510 Q_UNUSED(model); -
511 Q_UNUSED(editor); -
512 Q_UNUSED(index); -
513#else -
514 Q_D(const QStyledItemDelegate);
executed (the execution status of this line is deduced): const QStyledItemDelegatePrivate * const d = d_func();
-
515 Q_ASSERT(model);
executed (the execution status of this line is deduced): qt_noop();
-
516 Q_ASSERT(editor);
executed (the execution status of this line is deduced): qt_noop();
-
517 QByteArray n = editor->metaObject()->userProperty().name();
executed (the execution status of this line is deduced): QByteArray n = editor->metaObject()->userProperty().name();
-
518 if (n.isEmpty())
partially evaluated: n.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:40
0-40
519 n = d->editorFactory()->valuePropertyName(
never executed: n = d->editorFactory()->valuePropertyName( model->data(index, Qt::EditRole).userType());
0
520 model->data(index, Qt::EditRole).userType());
never executed: n = d->editorFactory()->valuePropertyName( model->data(index, Qt::EditRole).userType());
0
521 if (!n.isEmpty())
partially evaluated: !n.isEmpty()
TRUEFALSE
yes
Evaluation Count:40
no
Evaluation Count:0
0-40
522 model->setData(index, editor->property(n), Qt::EditRole);
executed: model->setData(index, editor->property(n), Qt::EditRole);
Execution Count:40
40
523#endif -
524}
executed: }
Execution Count:40
40
525 -
526/*! -
527 Updates the \a editor for the item specified by \a index -
528 according to the style \a option given. -
529*/ -
530void QStyledItemDelegate::updateEditorGeometry(QWidget *editor, -
531 const QStyleOptionViewItem &option, -
532 const QModelIndex &index) const -
533{ -
534 if (!editor)
partially evaluated: !editor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:111
0-111
535 return;
never executed: return;
0
536 Q_ASSERT(index.isValid());
executed (the execution status of this line is deduced): qt_noop();
-
537 const QWidget *widget = QStyledItemDelegatePrivate::widget(option);
executed (the execution status of this line is deduced): const QWidget *widget = QStyledItemDelegatePrivate::widget(option);
-
538 -
539 QStyleOptionViewItem opt = option;
executed (the execution status of this line is deduced): QStyleOptionViewItem opt = option;
-
540 initStyleOption(&opt, index);
executed (the execution status of this line is deduced): initStyleOption(&opt, index);
-
541 // let the editor take up all available space -
542 //if the editor is not a QLineEdit -
543 //or it is in a QTableView -
544#if !defined(QT_NO_TABLEVIEW) && !defined(QT_NO_LINEEDIT) -
545 if (qobject_cast<QExpandingLineEdit*>(editor) && !qobject_cast<const QTableView*>(widget))
evaluated: qobject_cast<QExpandingLineEdit*>(editor)
TRUEFALSE
yes
Evaluation Count:86
yes
Evaluation Count:25
evaluated: !qobject_cast<const QTableView*>(widget)
TRUEFALSE
yes
Evaluation Count:59
yes
Evaluation Count:27
25-86
546 opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, editor);
executed: opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, editor);
Execution Count:59
59
547 else -
548#endif -
549 opt.showDecorationSelected = true;
executed: opt.showDecorationSelected = true;
Execution Count:52
52
550 -
551 QStyle *style = widget ? widget->style() : QApplication::style();
partially evaluated: widget
TRUEFALSE
yes
Evaluation Count:111
no
Evaluation Count:0
0-111
552 QRect geom = style->subElementRect(QStyle::SE_ItemViewItemText, &opt, widget);
executed (the execution status of this line is deduced): QRect geom = style->subElementRect(QStyle::SE_ItemViewItemText, &opt, widget);
-
553 if ( editor->layoutDirection() == Qt::RightToLeft) {
partially evaluated: editor->layoutDirection() == Qt::RightToLeft
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:111
0-111
554 const int delta = qSmartMinSize(editor).width() - geom.width();
never executed (the execution status of this line is deduced): const int delta = qSmartMinSize(editor).width() - geom.width();
-
555 if (delta > 0) {
never evaluated: delta > 0
0
556 //we need to widen the geometry -
557 geom.adjust(-delta, 0, 0, 0);
never executed (the execution status of this line is deduced): geom.adjust(-delta, 0, 0, 0);
-
558 }
never executed: }
0
559 }
never executed: }
0
560 -
561 editor->setGeometry(geom);
executed (the execution status of this line is deduced): editor->setGeometry(geom);
-
562}
executed: }
Execution Count:111
111
563 -
564/*! -
565 Returns the editor factory used by the item delegate. -
566 If no editor factory is set, the function will return null. -
567 -
568 \sa setItemEditorFactory() -
569*/ -
570QItemEditorFactory *QStyledItemDelegate::itemEditorFactory() const -
571{ -
572 Q_D(const QStyledItemDelegate);
never executed (the execution status of this line is deduced): const QStyledItemDelegatePrivate * const d = d_func();
-
573 return d->factory;
never executed: return d->factory;
0
574} -
575 -
576/*! -
577 Sets the editor factory to be used by the item delegate to be the \a factory -
578 specified. If no editor factory is set, the item delegate will use the -
579 default editor factory. -
580 -
581 \sa itemEditorFactory() -
582*/ -
583void QStyledItemDelegate::setItemEditorFactory(QItemEditorFactory *factory) -
584{ -
585 Q_D(QStyledItemDelegate);
never executed (the execution status of this line is deduced): QStyledItemDelegatePrivate * const d = d_func();
-
586 d->factory = factory;
never executed (the execution status of this line is deduced): d->factory = factory;
-
587}
never executed: }
0
588 -
589 -
590/*! -
591 \fn bool QStyledItemDelegate::eventFilter(QObject *editor, QEvent *event) -
592 -
593 Returns true if the given \a editor is a valid QWidget and the -
594 given \a event is handled; otherwise returns false. The following -
595 key press events are handled by default: -
596 -
597 \list -
598 \li \uicontrol Tab -
599 \li \uicontrol Backtab -
600 \li \uicontrol Enter -
601 \li \uicontrol Return -
602 \li \uicontrol Esc -
603 \endlist -
604 -
605 In the case of \uicontrol Tab, \uicontrol Backtab, \uicontrol Enter and \uicontrol Return -
606 key press events, the \a editor's data is comitted to the model -
607 and the editor is closed. If the \a event is a \uicontrol Tab key press -
608 the view will open an editor on the next item in the -
609 view. Likewise, if the \a event is a \uicontrol Backtab key press the -
610 view will open an editor on the \e previous item in the view. -
611 -
612 If the event is a \uicontrol Esc key press event, the \a editor is -
613 closed \e without committing its data. -
614 -
615 \sa commitData(), closeEditor() -
616*/ -
617bool QStyledItemDelegate::eventFilter(QObject *object, QEvent *event) -
618{ -
619 QWidget *editor = qobject_cast<QWidget*>(object);
executed (the execution status of this line is deduced): QWidget *editor = qobject_cast<QWidget*>(object);
-
620 if (!editor)
partially evaluated: !editor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:952
0-952
621 return false;
never executed: return false;
0
622 if (event->type() == QEvent::KeyPress) {
evaluated: event->type() == QEvent::KeyPress
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:921
31-921
623 switch (static_cast<QKeyEvent *>(event)->key()) { -
624 case Qt::Key_Tab: -
625 emit commitData(editor);
never executed (the execution status of this line is deduced): commitData(editor);
-
626 emit closeEditor(editor, QAbstractItemDelegate::EditNextItem);
never executed (the execution status of this line is deduced): closeEditor(editor, QAbstractItemDelegate::EditNextItem);
-
627 return true;
never executed: return true;
0
628 case Qt::Key_Backtab: -
629 emit commitData(editor);
never executed (the execution status of this line is deduced): commitData(editor);
-
630 emit closeEditor(editor, QAbstractItemDelegate::EditPreviousItem);
never executed (the execution status of this line is deduced): closeEditor(editor, QAbstractItemDelegate::EditPreviousItem);
-
631 return true;
never executed: return true;
0
632 case Qt::Key_Enter: -
633 case Qt::Key_Return: -
634#ifndef QT_NO_TEXTEDIT -
635 if (qobject_cast<QTextEdit *>(editor) || qobject_cast<QPlainTextEdit *>(editor))
partially evaluated: qobject_cast<QTextEdit *>(editor)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
partially evaluated: qobject_cast<QPlainTextEdit *>(editor)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
636 return false; // don't filter enter key events for QTextEdit
never executed: return false;
0
637 // We want the editor to be able to process the key press -
638 // before committing the data (e.g. so it can do -
639 // validation/fixup of the input). -
640#endif // QT_NO_TEXTEDIT -
641#ifndef QT_NO_LINEEDIT -
642 if (QLineEdit *e = qobject_cast<QLineEdit*>(editor))
evaluated: QLineEdit *e = qobject_cast<QLineEdit*>(editor)
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:1
1-11
643 if (!e->hasAcceptableInput())
partially evaluated: !e->hasAcceptableInput()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
0-11
644 return false;
never executed: return false;
0
645#endif // QT_NO_LINEEDIT -
646 QMetaObject::invokeMethod(this, "_q_commitDataAndCloseEditor",
executed (the execution status of this line is deduced): QMetaObject::invokeMethod(this, "_q_commitDataAndCloseEditor",
-
647 Qt::QueuedConnection, Q_ARG(QWidget*, editor));
executed (the execution status of this line is deduced): Qt::QueuedConnection, QArgument<QWidget* >("QWidget*", editor));
-
648 return false;
executed: return false;
Execution Count:12
12
649 case Qt::Key_Escape: -
650 // don't commit data -
651 emit closeEditor(editor, QAbstractItemDelegate::RevertModelCache);
never executed (the execution status of this line is deduced): closeEditor(editor, QAbstractItemDelegate::RevertModelCache);
-
652 break;
never executed: break;
0
653 default: -
654 return false;
executed: return false;
Execution Count:19
19
655 } -
656 if (editor->parentWidget())
never evaluated: editor->parentWidget()
0
657 editor->parentWidget()->setFocus();
never executed: editor->parentWidget()->setFocus();
0
658 return true;
never executed: return true;
0
659 } else if (event->type() == QEvent::FocusOut || (event->type() == QEvent::Hide && editor->isWindow())) {
evaluated: event->type() == QEvent::FocusOut
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:892
evaluated: event->type() == QEvent::Hide
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:872
partially evaluated: editor->isWindow()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20
0-892
660 //the Hide event will take care of he editors that are in fact complete dialogs -
661 if (!editor->isActiveWindow() || (QApplication::focusWidget() != editor)) {
evaluated: !editor->isActiveWindow()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:24
partially evaluated: (QApplication::focusWidget() != editor)
TRUEFALSE
yes
Evaluation Count:24
no
Evaluation Count:0
0-24
662 QWidget *w = QApplication::focusWidget();
executed (the execution status of this line is deduced): QWidget *w = QApplication::focusWidget();
-
663 while (w) { // don't worry about focus changes internally in the editor
evaluated: w
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:29
24-29
664 if (w == editor)
partially evaluated: w == editor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24
0-24
665 return false;
never executed: return false;
0
666 w = w->parentWidget();
executed (the execution status of this line is deduced): w = w->parentWidget();
-
667 }
executed: }
Execution Count:24
24
668#ifndef QT_NO_DRAGANDDROP -
669 // The window may lose focus during an drag operation. -
670 // i.e when dragging involves the taskbar on Windows. -
671 QPlatformDrag *platformDrag = QGuiApplicationPrivate::instance()->platformIntegration()->drag();
executed (the execution status of this line is deduced): QPlatformDrag *platformDrag = QGuiApplicationPrivate::instance()->platformIntegration()->drag();
-
672 if (platformDrag && platformDrag->currentDrag()) {
partially evaluated: platformDrag
TRUEFALSE
yes
Evaluation Count:29
no
Evaluation Count:0
partially evaluated: platformDrag->currentDrag()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:29
0-29
673 return false;
never executed: return false;
0
674 } -
675#endif -
676 -
677 emit commitData(editor);
executed (the execution status of this line is deduced): commitData(editor);
-
678 emit closeEditor(editor, NoHint);
executed (the execution status of this line is deduced): closeEditor(editor, NoHint);
-
679 }
executed: }
Execution Count:29
29
680 } else if (event->type() == QEvent::ShortcutOverride) {
executed: }
Execution Count:29
evaluated: event->type() == QEvent::ShortcutOverride
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:861
29-861
681 if (static_cast<QKeyEvent*>(event)->key() == Qt::Key_Escape) {
partially evaluated: static_cast<QKeyEvent*>(event)->key() == Qt::Key_Escape
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
0-31
682 event->accept();
never executed (the execution status of this line is deduced): event->accept();
-
683 return true;
never executed: return true;
0
684 } -
685 }
executed: }
Execution Count:31
31
686 return false;
executed: return false;
Execution Count:921
921
687} -
688 -
689/*! -
690 \reimp -
691*/ -
692bool QStyledItemDelegate::editorEvent(QEvent *event, -
693 QAbstractItemModel *model, -
694 const QStyleOptionViewItem &option, -
695 const QModelIndex &index) -
696{ -
697 Q_ASSERT(event);
executed (the execution status of this line is deduced): qt_noop();
-
698 Q_ASSERT(model);
executed (the execution status of this line is deduced): qt_noop();
-
699 -
700 // make sure that the item is checkable -
701 Qt::ItemFlags flags = model->flags(index);
executed (the execution status of this line is deduced): Qt::ItemFlags flags = model->flags(index);
-
702 if (!(flags & Qt::ItemIsUserCheckable) || !(option.state & QStyle::State_Enabled)
evaluated: !(flags & Qt::ItemIsUserCheckable)
TRUEFALSE
yes
Evaluation Count:1553
yes
Evaluation Count:4327
partially evaluated: !(option.state & QStyle::State_Enabled)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4327
0-4327
703 || !(flags & Qt::ItemIsEnabled))
partially evaluated: !(flags & Qt::ItemIsEnabled)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4327
0-4327
704 return false;
executed: return false;
Execution Count:1553
1553
705 -
706 // make sure that we have a check state -
707 QVariant value = index.data(Qt::CheckStateRole);
executed (the execution status of this line is deduced): QVariant value = index.data(Qt::CheckStateRole);
-
708 if (!value.isValid())
evaluated: !value.isValid()
TRUEFALSE
yes
Evaluation Count:4325
yes
Evaluation Count:2
2-4325
709 return false;
executed: return false;
Execution Count:4325
4325
710 -
711 const QWidget *widget = QStyledItemDelegatePrivate::widget(option);
never executed (the execution status of this line is deduced): const QWidget *widget = QStyledItemDelegatePrivate::widget(option);
-
712 QStyle *style = widget ? widget->style() : QApplication::style();
partially evaluated: widget
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
713 -
714 // make sure that we have the right event type -
715 if ((event->type() == QEvent::MouseButtonRelease)
evaluated: (event->type() == QEvent::MouseButtonRelease)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
716 || (event->type() == QEvent::MouseButtonDblClick)
partially evaluated: (event->type() == QEvent::MouseButtonDblClick)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
717 || (event->type() == QEvent::MouseButtonPress)) {
partially evaluated: (event->type() == QEvent::MouseButtonPress)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
718 QStyleOptionViewItem viewOpt(option);
executed (the execution status of this line is deduced): QStyleOptionViewItem viewOpt(option);
-
719 initStyleOption(&viewOpt, index);
executed (the execution status of this line is deduced): initStyleOption(&viewOpt, index);
-
720 QRect checkRect = style->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &viewOpt, widget);
executed (the execution status of this line is deduced): QRect checkRect = style->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &viewOpt, widget);
-
721 QMouseEvent *me = static_cast<QMouseEvent*>(event);
executed (the execution status of this line is deduced): QMouseEvent *me = static_cast<QMouseEvent*>(event);
-
722 if (me->button() != Qt::LeftButton || !checkRect.contains(me->pos()))
partially evaluated: me->button() != Qt::LeftButton
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: !checkRect.contains(me->pos())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
723 return false;
never executed: return false;
0
724 -
725 if ((event->type() == QEvent::MouseButtonPress)
evaluated: (event->type() == QEvent::MouseButtonPress)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
726 || (event->type() == QEvent::MouseButtonDblClick))
partially evaluated: (event->type() == QEvent::MouseButtonDblClick)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
727 return true;
executed: return true;
Execution Count:1
1
728 -
729 } else if (event->type() == QEvent::KeyPress) {
executed: }
Execution Count:1
never evaluated: event->type() == QEvent::KeyPress
0-1
730 if (static_cast<QKeyEvent*>(event)->key() != Qt::Key_Space
never evaluated: static_cast<QKeyEvent*>(event)->key() != Qt::Key_Space
0
731 && static_cast<QKeyEvent*>(event)->key() != Qt::Key_Select)
never evaluated: static_cast<QKeyEvent*>(event)->key() != Qt::Key_Select
0
732 return false;
never executed: return false;
0
733 } else {
never executed: }
0
734 return false;
never executed: return false;
0
735 } -
736 -
737 Qt::CheckState state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked
partially evaluated: static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
738 ? Qt::Unchecked : Qt::Checked);
executed (the execution status of this line is deduced): ? Qt::Unchecked : Qt::Checked);
-
739 return model->setData(index, state, Qt::CheckStateRole);
executed: return model->setData(index, state, Qt::CheckStateRole);
Execution Count:1
1
740} -
741 -
742QT_END_NAMESPACE -
743 -
744#include "moc_qstyleditemdelegate.cpp" -
745 -
746#endif // QT_NO_ITEMVIEWS -
747 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial