widgets/qtoolbox.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8class QToolBoxButton : public QAbstractButton -
9{ -
10 public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); struct QPrivateSignal {}; -
11public: -
12 QToolBoxButton(QWidget *parent) -
13 : QAbstractButton(parent), selected(false), indexInPage(-1) -
14 { -
15 setBackgroundRole(QPalette::Window); -
16 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); -
17 setFocusPolicy(Qt::NoFocus); -
18 }
executed: }
Execution Count:22
22
19 -
20 inline void setSelected(bool b) { selected = b; update(); }
executed: }
Execution Count:28
28
21 inline void setIndex(int newIndex) { indexInPage = newIndex; }
executed: }
Execution Count:124
124
22 -
23 QSize sizeHint() const; -
24 QSize minimumSizeHint() const; -
25 -
26protected: -
27 void initStyleOption(QStyleOptionToolBox *opt) const; -
28 void paintEvent(QPaintEvent *); -
29 -
30private: -
31 bool selected; -
32 int indexInPage; -
33}; -
34 -
35 -
36class QToolBoxPrivate : public QFramePrivate -
37{ -
38 inline QToolBox* q_func() { return static_cast<QToolBox *>(q_ptr); } inline const QToolBox* q_func() const { return static_cast<const QToolBox *>(q_ptr); } friend class QToolBox; -
39public: -
40 struct Page -
41 { -
42 QToolBoxButton *button; -
43 QScrollArea *sv; -
44 QWidget *widget; -
45 -
46 inline void setText(const QString &text) { button->setText(text); }
executed: }
Execution Count:26
26
47 inline void setIcon(const QIcon &is) { button->setIcon(is); }
executed: }
Execution Count:22
22
48 -
49 inline void setToolTip(const QString &tip) { button->setToolTip(tip); }
never executed: }
0
50 inline QString toolTip() const { return button->toolTip(); }
never executed: return button->toolTip();
0
51 -
52 inline QString text() const { return button->text(); }
executed: return button->text();
Execution Count:4
4
53 inline QIcon icon() const { return button->icon(); }
never executed: return button->icon();
0
54 -
55 inline bool operator==(const Page& other) const -
56 { -
57 return widget == other.widget;
executed: return widget == other.widget;
Execution Count:152
152
58 } -
59 }; -
60 typedef QList<Page> PageList; -
61 -
62 inline QToolBoxPrivate() -
63 : currentPage(0) -
64 { -
65 }
executed: }
Execution Count:6
6
66 void _q_buttonClicked(); -
67 void _q_widgetDestroyed(QObject*); -
68 -
69 Page *page(QWidget *widget) const; -
70 const Page *page(int index) const; -
71 Page *page(int index); -
72 -
73 void updateTabs(); -
74 void relayout(); -
75 -
76 PageList pageList; -
77 QVBoxLayout *layout; -
78 Page *currentPage; -
79}; -
80 -
81QToolBoxPrivate::Page *QToolBoxPrivate::page(QWidget *widget) const -
82{ -
83 if (!widget)
partially evaluated: !widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:73
0-73
84 return 0;
never executed: return 0;
0
85 -
86 for (PageList::ConstIterator i = pageList.constBegin(); i != pageList.constEnd(); ++i)
evaluated: i != pageList.constEnd()
TRUEFALSE
yes
Evaluation Count:153
yes
Evaluation Count:2
2-153
87 if ((*i).widget == widget)
evaluated: (*i).widget == widget
TRUEFALSE
yes
Evaluation Count:71
yes
Evaluation Count:82
71-82
88 return (Page*) &(*i);
executed: return (Page*) &(*i);
Execution Count:71
71
89 return 0;
executed: return 0;
Execution Count:2
2
90} -
91 -
92QToolBoxPrivate::Page *QToolBoxPrivate::page(int index) -
93{ -
94 if (index >= 0 && index < pageList.size())
evaluated: index >= 0
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:1
evaluated: index < pageList.size()
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:2
1-39
95 return &pageList[index];
executed: return &pageList[index];
Execution Count:37
37
96 return 0;
executed: return 0;
Execution Count:3
3
97} -
98 -
99const QToolBoxPrivate::Page *QToolBoxPrivate::page(int index) const -
100{ -
101 if (index >= 0 && index < pageList.size())
partially evaluated: index >= 0
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
partially evaluated: index < pageList.size()
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
102 return &pageList.at(index);
executed: return &pageList.at(index);
Execution Count:4
4
103 return 0;
never executed: return 0;
0
104} -
105 -
106void QToolBoxPrivate::updateTabs() -
107{ -
108 QToolBoxButton *lastButton = currentPage ? currentPage->button : 0;
partially evaluated: currentPage
TRUEFALSE
yes
Evaluation Count:41
no
Evaluation Count:0
0-41
109 bool after = false; -
110 int index = 0; -
111 for (index = 0; index < pageList.count(); ++index) {
evaluated: index < pageList.count()
TRUEFALSE
yes
Evaluation Count:124
yes
Evaluation Count:41
41-124
112 const Page &page = pageList.at(index); -
113 QToolBoxButton *tB = page.button; -
114 -
115 -
116 tB->setIndex(index); -
117 QWidget *tW = page.widget; -
118 if (after) {
evaluated: after
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:94
30-94
119 QPalette p = tB->palette(); -
120 p.setColor(tB->backgroundRole(), tW->palette().color(tW->backgroundRole())); -
121 tB->setPalette(p); -
122 tB->update(); -
123 } else if (tB->backgroundRole() != QPalette::Window) {
executed: }
Execution Count:30
partially evaluated: tB->backgroundRole() != QPalette::Window
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:94
0-94
124 tB->setBackgroundRole(QPalette::Window); -
125 tB->update(); -
126 }
never executed: }
0
127 after = tB == lastButton; -
128 }
executed: }
Execution Count:124
124
129}
executed: }
Execution Count:41
41
130 -
131QSize QToolBoxButton::sizeHint() const -
132{ -
133 QSize iconSize(8, 8); -
134 if (!icon().isNull()) {
never evaluated: !icon().isNull()
0
135 int icone = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, parentWidget() ); -
136 iconSize += QSize(icone + 2, icone); -
137 }
never executed: }
0
138 QSize textSize = fontMetrics().size(Qt::TextShowMnemonic, text()) + QSize(0, 8); -
139 -
140 QSize total(iconSize.width() + textSize.width(), qMax(iconSize.height(), textSize.height())); -
141 return total.expandedTo(QApplication::globalStrut());
never executed: return total.expandedTo(QApplication::globalStrut());
0
142} -
143 -
144QSize QToolBoxButton::minimumSizeHint() const -
145{ -
146 if (icon().isNull())
never evaluated: icon().isNull()
0
147 return QSize();
never executed: return QSize();
0
148 int icone = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, parentWidget() ); -
149 return QSize(icone + 8, icone + 8);
never executed: return QSize(icone + 8, icone + 8);
0
150} -
151 -
152void QToolBoxButton::initStyleOption(QStyleOptionToolBox *option) const -
153{ -
154 if (!option)
never evaluated: !option
0
155 return;
never executed: return;
0
156 option->initFrom(this); -
157 if (selected)
never evaluated: selected
0
158 option->state |= QStyle::State_Selected;
never executed: option->state |= QStyle::State_Selected;
0
159 if (isDown())
never evaluated: isDown()
0
160 option->state |= QStyle::State_Sunken;
never executed: option->state |= QStyle::State_Sunken;
0
161 option->text = text(); -
162 option->icon = icon(); -
163 -
164 if (QStyleOptionToolBoxV2 *optionV2 = qstyleoption_cast<QStyleOptionToolBoxV2 *>(option)) {
never evaluated: QStyleOptionToolBoxV2 *optionV2 = qstyleoption_cast<QStyleOptionToolBoxV2 *>(option)
0
165 QToolBox *toolBox = static_cast<QToolBox *>(parentWidget()); -
166 int widgetCount = toolBox->count(); -
167 int currIndex = toolBox->currentIndex(); -
168 if (widgetCount == 1) {
never evaluated: widgetCount == 1
0
169 optionV2->position = QStyleOptionToolBoxV2::OnlyOneTab; -
170 } else if (indexInPage == 0) {
never evaluated: indexInPage == 0
never executed: }
0
171 optionV2->position = QStyleOptionToolBoxV2::Beginning; -
172 } else if (indexInPage == widgetCount - 1) {
never evaluated: indexInPage == widgetCount - 1
never executed: }
0
173 optionV2->position = QStyleOptionToolBoxV2::End; -
174 } else {
never executed: }
0
175 optionV2->position = QStyleOptionToolBoxV2::Middle; -
176 }
never executed: }
0
177 if (currIndex == indexInPage - 1) {
never evaluated: currIndex == indexInPage - 1
0
178 optionV2->selectedPosition = QStyleOptionToolBoxV2::PreviousIsSelected; -
179 } else if (currIndex == indexInPage + 1) {
never evaluated: currIndex == indexInPage + 1
never executed: }
0
180 optionV2->selectedPosition = QStyleOptionToolBoxV2::NextIsSelected; -
181 } else {
never executed: }
0
182 optionV2->selectedPosition = QStyleOptionToolBoxV2::NotAdjacent; -
183 }
never executed: }
0
184 } -
185}
never executed: }
0
186 -
187void QToolBoxButton::paintEvent(QPaintEvent *) -
188{ -
189 QPainter paint(this); -
190 QString text = QAbstractButton::text(); -
191 QPainter *p = &paint; -
192 QStyleOptionToolBoxV2 opt; -
193 initStyleOption(&opt); -
194 style()->drawControl(QStyle::CE_ToolBoxTab, &opt, p, parentWidget()); -
195}
never executed: }
0
196QToolBox::QToolBox(QWidget *parent, Qt::WindowFlags f) -
197 : QFrame(*new QToolBoxPrivate, parent, f) -
198{ -
199 QToolBoxPrivate * const d = d_func(); -
200 d->layout = new QVBoxLayout(this); -
201 d->layout->setMargin(0); -
202 setBackgroundRole(QPalette::Button); -
203}
executed: }
Execution Count:6
6
204 -
205 -
206 -
207 -
208 -
209QToolBox::~QToolBox() -
210{ -
211} -
212int QToolBox::insertItem(int index, QWidget *widget, const QIcon &icon, const QString &text) -
213{ -
214 if (!widget)
partially evaluated: !widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
0-22
215 return -1;
never executed: return -1;
0
216 -
217 QToolBoxPrivate * const d = d_func(); -
218 connect(widget, "2""destroyed(QObject*)", this, "1""_q_widgetDestroyed(QObject*)"); -
219 -
220 QToolBoxPrivate::Page c; -
221 c.widget = widget; -
222 c.button = new QToolBoxButton(this); -
223 c.button->setObjectName(QLatin1String("qt_toolbox_toolboxbutton")); -
224 connect(c.button, "2""clicked()", this, "1""_q_buttonClicked()"); -
225 -
226 c.sv = new QScrollArea(this); -
227 c.sv->setWidget(widget); -
228 c.sv->setWidgetResizable(true); -
229 c.sv->hide(); -
230 c.sv->setFrameStyle(QFrame::NoFrame); -
231 -
232 c.setText(text); -
233 c.setIcon(icon); -
234 -
235 if (index < 0 || index >= (int)d->pageList.count()) {
evaluated: index < 0
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:8
partially evaluated: index >= (int)d->pageList.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-14
236 index = d->pageList.count(); -
237 d->pageList.append(c); -
238 d->layout->addWidget(c.button); -
239 d->layout->addWidget(c.sv); -
240 if (index == 0)
evaluated: index == 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:9
5-9
241 setCurrentIndex(index);
executed: setCurrentIndex(index);
Execution Count:5
5
242 } else {
executed: }
Execution Count:14
14
243 d->pageList.insert(index, c); -
244 d->relayout(); -
245 if (d->currentPage) {
partially evaluated: d->currentPage
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
246 QWidget *current = d->currentPage->widget; -
247 int oldindex = indexOf(current); -
248 if (index <= oldindex) {
evaluated: index <= oldindex
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
249 d->currentPage = 0; -
250 setCurrentIndex(oldindex); -
251 }
executed: }
Execution Count:4
4
252 }
executed: }
Execution Count:8
8
253 }
executed: }
Execution Count:8
8
254 -
255 c.button->show(); -
256 -
257 d->updateTabs(); -
258 itemInserted(index); -
259 return index;
executed: return index;
Execution Count:22
22
260} -
261 -
262void QToolBoxPrivate::_q_buttonClicked() -
263{ -
264 QToolBox * const q = q_func(); -
265 QToolBoxButton *tb = qobject_cast<QToolBoxButton*>(q->sender()); -
266 QWidget* item = 0; -
267 for (QToolBoxPrivate::PageList::ConstIterator i = pageList.constBegin(); i != pageList.constEnd(); ++i)
never evaluated: i != pageList.constEnd()
0
268 if ((*i).button == tb) {
never evaluated: (*i).button == tb
0
269 item = (*i).widget; -
270 break;
never executed: break;
0
271 } -
272 -
273 q->setCurrentIndex(q->indexOf(item)); -
274}
never executed: }
0
275int QToolBox::count() const -
276{ -
277 const QToolBoxPrivate * const d = d_func(); -
278 return d->pageList.count();
executed: return d->pageList.count();
Execution Count:36
36
279} -
280 -
281void QToolBox::setCurrentIndex(int index) -
282{ -
283 QToolBoxPrivate * const d = d_func(); -
284 QToolBoxPrivate::Page *c = d->page(index); -
285 if (!c || d->currentPage == c)
evaluated: !c
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:21
evaluated: d->currentPage == c
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:19
2-21
286 return;
executed: return;
Execution Count:5
5
287 -
288 c->button->setSelected(true); -
289 if (d->currentPage) {
evaluated: d->currentPage
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:10
9-10
290 d->currentPage->sv->hide(); -
291 d->currentPage->button->setSelected(false); -
292 }
executed: }
Execution Count:9
9
293 d->currentPage = c; -
294 d->currentPage->sv->show(); -
295 d->updateTabs(); -
296 currentChanged(index); -
297}
executed: }
Execution Count:19
19
298 -
299void QToolBoxPrivate::relayout() -
300{ -
301 QToolBox * const q = q_func(); -
302 delete layout; -
303 layout = new QVBoxLayout(q); -
304 layout->setMargin(0); -
305 for (QToolBoxPrivate::PageList::ConstIterator i = pageList.constBegin(); i != pageList.constEnd(); ++i) {
evaluated: i != pageList.constEnd()
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:8
8-28
306 layout->addWidget((*i).button); -
307 layout->addWidget((*i).sv); -
308 }
executed: }
Execution Count:28
28
309}
executed: }
Execution Count:8
8
310 -
311void QToolBoxPrivate::_q_widgetDestroyed(QObject *object) -
312{ -
313 QToolBox * const q = q_func(); -
314 -
315 QWidget *p = (QWidget*)object; -
316 -
317 QToolBoxPrivate::Page *c = page(p); -
318 if (!p || !c)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: !c
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
319 return;
never executed: return;
0
320 -
321 layout->removeWidget(c->sv); -
322 layout->removeWidget(c->button); -
323 c->sv->deleteLater(); -
324 delete c->button; -
325 -
326 bool removeCurrent = c == currentPage; -
327 pageList.removeAll(*c); -
328 -
329 if (!pageList.count()) {
evaluated: !pageList.count()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
330 currentPage = 0; -
331 q->currentChanged(-1); -
332 } else if (removeCurrent) {
evaluated: removeCurrent
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
executed: }
Execution Count:1
1-2
333 currentPage = 0; -
334 q->setCurrentIndex(0); -
335 }
executed: }
Execution Count:1
1
336} -
337 -
338 -
339 -
340 -
341 -
342 -
343void QToolBox::removeItem(int index) -
344{ -
345 QToolBoxPrivate * const d = d_func(); -
346 if (QWidget *w = widget(index)) {
partially evaluated: QWidget *w = widget(index)
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
347 disconnect(w, "2""destroyed(QObject*)", this, "1""_q_widgetDestroyed(QObject*)"); -
348 w->setParent(this); -
349 -
350 d->_q_widgetDestroyed(w); -
351 itemRemoved(index); -
352 }
executed: }
Execution Count:3
3
353}
executed: }
Execution Count:3
3
354int QToolBox::currentIndex() const -
355{ -
356 const QToolBoxPrivate * const d = d_func(); -
357 return d->currentPage ? indexOf(d->currentPage->widget) : -1;
executed: return d->currentPage ? indexOf(d->currentPage->widget) : -1;
Execution Count:20
20
358} -
359 -
360 -
361 -
362 -
363 -
364 -
365 -
366QWidget * QToolBox::currentWidget() const -
367{ -
368 const QToolBoxPrivate * const d = d_func(); -
369 return d->currentPage ? d->currentPage->widget : 0;
executed: return d->currentPage ? d->currentPage->widget : 0;
Execution Count:3
3
370} -
371 -
372 -
373 -
374 -
375 -
376 -
377void QToolBox::setCurrentWidget(QWidget *widget) -
378{ -
379 int i = indexOf(widget); -
380 if (i >= 0)
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
381 setCurrentIndex(i);
executed: setCurrentIndex(i);
Execution Count:2
2
382 else -
383 QMessageLogger("widgets/qtoolbox.cpp", 538, __PRETTY_FUNCTION__).warning("QToolBox::setCurrentWidget: widget not contained in tool box");
executed: QMessageLogger("widgets/qtoolbox.cpp", 538, __PRETTY_FUNCTION__).warning("QToolBox::setCurrentWidget: widget not contained in tool box");
Execution Count:1
1
384} -
385 -
386 -
387 -
388 -
389 -
390 -
391QWidget *QToolBox::widget(int index) const -
392{ -
393 const QToolBoxPrivate * const d = d_func(); -
394 if (index < 0 || index >= (int) d->pageList.size())
partially evaluated: index < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
evaluated: index >= (int) d->pageList.size()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:13
0-14
395 return 0;
executed: return 0;
Execution Count:1
1
396 return d->pageList.at(index).widget;
executed: return d->pageList.at(index).widget;
Execution Count:13
13
397} -
398 -
399 -
400 -
401 -
402 -
403 -
404int QToolBox::indexOf(QWidget *widget) const -
405{ -
406 const QToolBoxPrivate * const d = d_func(); -
407 QToolBoxPrivate::Page *c = (widget ? d->page(widget) : 0);
evaluated: widget
TRUEFALSE
yes
Evaluation Count:69
yes
Evaluation Count:1
1-69
408 return c ? d->pageList.indexOf(*c) : -1;
executed: return c ? d->pageList.indexOf(*c) : -1;
Execution Count:70
70
409} -
410 -
411 -
412 -
413 -
414 -
415 -
416void QToolBox::setItemEnabled(int index, bool enabled) -
417{ -
418 QToolBoxPrivate * const d = d_func(); -
419 QToolBoxPrivate::Page *c = d->page(index); -
420 if (!c)
partially evaluated: !c
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
421 return;
never executed: return;
0
422 -
423 c->button->setEnabled(enabled); -
424 if (!enabled && c == d->currentPage) {
evaluated: !enabled
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
evaluated: c == d->currentPage
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-4
425 int curIndexUp = index; -
426 int curIndexDown = curIndexUp; -
427 const int count = d->pageList.count(); -
428 while (curIndexUp > 0 || curIndexDown < count-1) {
evaluated: curIndexUp > 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4
evaluated: curIndexDown < count-1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-4
429 if (curIndexDown < count-1) {
evaluated: curIndexDown < count-1
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
430 if (d->page(++curIndexDown)->button->isEnabled()) {
evaluated: d->page(++curIndexDown)->button->isEnabled()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
1-4
431 index = curIndexDown; -
432 break;
executed: break;
Execution Count:1
1
433 } -
434 }
executed: }
Execution Count:4
4
435 if (curIndexUp > 0) {
evaluated: curIndexUp > 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-3
436 if (d->page(--curIndexUp)->button->isEnabled()) {
evaluated: d->page(--curIndexUp)->button->isEnabled()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
437 index = curIndexUp; -
438 break;
executed: break;
Execution Count:1
1
439 } -
440 }
executed: }
Execution Count:1
1
441 }
executed: }
Execution Count:4
4
442 setCurrentIndex(index); -
443 }
executed: }
Execution Count:3
3
444}
executed: }
Execution Count:5
5
445void QToolBox::setItemText(int index, const QString &text) -
446{ -
447 QToolBoxPrivate * const d = d_func(); -
448 QToolBoxPrivate::Page *c = d->page(index); -
449 if (c)
partially evaluated: c
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
450 c->setText(text);
executed: c->setText(text);
Execution Count:4
4
451}
executed: }
Execution Count:4
4
452 -
453 -
454 -
455 -
456 -
457void QToolBox::setItemIcon(int index, const QIcon &icon) -
458{ -
459 QToolBoxPrivate * const d = d_func(); -
460 QToolBoxPrivate::Page *c = d->page(index); -
461 if (c)
never evaluated: c
0
462 c->setIcon(icon);
never executed: c->setIcon(icon);
0
463}
never executed: }
0
464 -
465 -
466 -
467 -
468 -
469 -
470void QToolBox::setItemToolTip(int index, const QString &toolTip) -
471{ -
472 QToolBoxPrivate * const d = d_func(); -
473 QToolBoxPrivate::Page *c = d->page(index); -
474 if (c)
never evaluated: c
0
475 c->setToolTip(toolTip);
never executed: c->setToolTip(toolTip);
0
476}
never executed: }
0
477 -
478 -
479 -
480 -
481 -
482 -
483bool QToolBox::isItemEnabled(int index) const -
484{ -
485 const QToolBoxPrivate * const d = d_func(); -
486 const QToolBoxPrivate::Page *c = d->page(index); -
487 return c && c->button->isEnabled();
never executed: return c && c->button->isEnabled();
0
488} -
489 -
490 -
491 -
492 -
493 -
494 -
495QString QToolBox::itemText(int index) const -
496{ -
497 const QToolBoxPrivate * const d = d_func(); -
498 const QToolBoxPrivate::Page *c = d->page(index); -
499 return (c ? c->text() : QString());
executed: return (c ? c->text() : QString());
Execution Count:4
4
500} -
501 -
502 -
503 -
504 -
505 -
506 -
507QIcon QToolBox::itemIcon(int index) const -
508{ -
509 const QToolBoxPrivate * const d = d_func(); -
510 const QToolBoxPrivate::Page *c = d->page(index); -
511 return (c ? c->icon() : QIcon());
never executed: return (c ? c->icon() : QIcon());
0
512} -
513 -
514 -
515 -
516 -
517 -
518 -
519 -
520QString QToolBox::itemToolTip(int index) const -
521{ -
522 const QToolBoxPrivate * const d = d_func(); -
523 const QToolBoxPrivate::Page *c = d->page(index); -
524 return (c ? c->toolTip() : QString());
never executed: return (c ? c->toolTip() : QString());
0
525} -
526 -
527 -
528 -
529void QToolBox::showEvent(QShowEvent *e) -
530{ -
531 QWidget::showEvent(e); -
532}
executed: }
Execution Count:1
1
533 -
534 -
535void QToolBox::changeEvent(QEvent *ev) -
536{ -
537 QToolBoxPrivate * const d = d_func(); -
538 if(ev->type() == QEvent::StyleChange)
partially evaluated: ev->type() == QEvent::StyleChange
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
539 d->updateTabs();
never executed: d->updateTabs();
0
540 QFrame::changeEvent(ev); -
541}
executed: }
Execution Count:6
6
542 -
543 -
544 -
545 -
546 -
547 -
548 -
549void QToolBox::itemInserted(int index) -
550{ -
551 (void)index; -
552}
executed: }
Execution Count:22
22
553 -
554 -
555 -
556 -
557 -
558 -
559 -
560void QToolBox::itemRemoved(int index) -
561{ -
562 (void)index; -
563}
executed: }
Execution Count:3
3
564 -
565 -
566bool QToolBox::event(QEvent *e) -
567{ -
568 return QFrame::event(e);
executed: return QFrame::event(e);
Execution Count:160
160
569} -
570 -
571 -
572 -
573 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial