Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
40 | #include "qtoolbox.h" | - |
41 | | - |
42 | #ifndef QT_NO_TOOLBOX | - |
43 | | - |
44 | #include <qapplication.h> | - |
45 | #include <qeventloop.h> | - |
46 | #include <qlayout.h> | - |
47 | #include <qlist.h> | - |
48 | #include <qpainter.h> | - |
49 | #include <qscrollarea.h> | - |
50 | #include <qstyle.h> | - |
51 | #include <qstyleoption.h> | - |
52 | #include <qtooltip.h> | - |
53 | #include <qabstractbutton.h> | - |
54 | | - |
55 | #include "qframe_p.h" | - |
56 | | - |
57 | QT_BEGIN_NAMESPACE | - |
58 | | - |
59 | class QToolBoxButton : public QAbstractButton | - |
60 | { | - |
61 | Q_OBJECT | - |
62 | public: | - |
63 | QToolBoxButton(QWidget *parent) | - |
64 | : QAbstractButton(parent), selected(false), indexInPage(-1) | - |
65 | { | - |
66 | setBackgroundRole(QPalette::Window); | - |
67 | setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); | - |
68 | setFocusPolicy(Qt::NoFocus); | - |
69 | } | - |
70 | | - |
71 | inline void setSelected(bool b) { selected = b; update(); } | - |
72 | inline void setIndex(int newIndex) { indexInPage = newIndex; } | - |
73 | | - |
74 | QSize sizeHint() const Q_DECL_OVERRIDE; | - |
75 | QSize minimumSizeHint() const Q_DECL_OVERRIDE; | - |
76 | | - |
77 | protected: | - |
78 | void initStyleOption(QStyleOptionToolBox *opt) const; | - |
79 | void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; | - |
80 | | - |
81 | private: | - |
82 | bool selected; | - |
83 | int indexInPage; | - |
84 | }; | - |
85 | | - |
86 | | - |
87 | class QToolBoxPrivate : public QFramePrivate | - |
88 | { | - |
89 | Q_DECLARE_PUBLIC(QToolBox) | - |
90 | public: | - |
91 | struct Page | - |
92 | { | - |
93 | QToolBoxButton *button; | - |
94 | QScrollArea *sv; | - |
95 | QWidget *widget; | - |
96 | | - |
97 | inline void setText(const QString &text) { button->setText(text); } | - |
98 | inline void setIcon(const QIcon &is) { button->setIcon(is); } | - |
99 | #ifndef QT_NO_TOOLTIP | - |
100 | inline void setToolTip(const QString &tip) { button->setToolTip(tip); } | - |
101 | inline QString toolTip() const { return button->toolTip(); } | - |
102 | #endif | - |
103 | inline QString text() const { return button->text(); } | - |
104 | inline QIcon icon() const { return button->icon(); } | - |
105 | | - |
106 | inline bool operator==(const Page& other) const | - |
107 | { | - |
108 | return widget == other.widget; | - |
109 | } | - |
110 | }; | - |
111 | typedef QList<Page> PageList; | - |
112 | | - |
113 | inline QToolBoxPrivate() | - |
114 | : currentPage(0) | - |
115 | { | - |
116 | } | - |
117 | void _q_buttonClicked(); | - |
118 | void _q_widgetDestroyed(QObject*); | - |
119 | | - |
120 | const Page *page(const QObjectQWidget *widget) const; | - |
121 | const Page *page(int index) const; | - |
122 | Page *page(int index); | - |
123 | | - |
124 | void updateTabs(); | - |
125 | void relayout(); | - |
126 | | - |
127 | PageList pageList; | - |
128 | QVBoxLayout *layout; | - |
129 | Page *currentPage; | - |
130 | }; | - |
131 | | - |
132 | const QToolBoxPrivate::Page *QToolBoxPrivate::page(const QObjectQWidget *widget) const | - |
133 | { | - |
134 | if (!widget)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
135 | return 0; never executed: return 0; | 0 |
136 | | - |
137 | for (PageList::ConstIterator i = pageList.constBegin(); i != pageList.constEnd(); ++i)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
138 | if ((*i).widget == widget)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
139 | return (const Page*) &(*i); never executed: return (const Page*) &(*i); | 0 |
140 | return 0; never executed: return 0; | 0 |
141 | } | - |
142 | | - |
143 | QToolBoxPrivate::Page *QToolBoxPrivate::page(int index) | - |
144 | { | - |
145 | if (index >= 0 && index < pageList.size()) | - |
146 | return &pageList[index]; | - |
147 | return 0; | - |
148 | } | - |
149 | | - |
150 | const QToolBoxPrivate::Page *QToolBoxPrivate::page(int index) const | - |
151 | { | - |
152 | if (index >= 0 && index < pageList.size()) | - |
153 | return &pageList.at(index); | - |
154 | return 0; | - |
155 | } | - |
156 | | - |
157 | void QToolBoxPrivate::updateTabs() | - |
158 | { | - |
159 | QToolBoxButton *lastButton = currentPage ? currentPage->button : 0; | - |
160 | bool after = false; | - |
161 | int index = 0; | - |
162 | for (index = 0; index < pageList.count(); ++index) { | - |
163 | const Page &page = pageList.at(index); | - |
164 | QToolBoxButton *tB = page.button; | - |
165 | | - |
166 | | - |
167 | tB->setIndex(index); | - |
168 | QWidget *tW = page.widget; | - |
169 | if (after) { | - |
170 | QPalette p = tB->palette(); | - |
171 | p.setColor(tB->backgroundRole(), tW->palette().color(tW->backgroundRole())); | - |
172 | tB->setPalette(p); | - |
173 | tB->update(); | - |
174 | } else if (tB->backgroundRole() != QPalette::Window) { | - |
175 | tB->setBackgroundRole(QPalette::Window); | - |
176 | tB->update(); | - |
177 | } | - |
178 | after = tB == lastButton; | - |
179 | } | - |
180 | } | - |
181 | | - |
182 | QSize QToolBoxButton::sizeHint() const | - |
183 | { | - |
184 | QSize iconSize(8, 8); | - |
185 | if (!icon().isNull()) { | - |
186 | int icone = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, parentWidget() ); | - |
187 | iconSize += QSize(icone + 2, icone); | - |
188 | } | - |
189 | QSize textSize = fontMetrics().size(Qt::TextShowMnemonic, text()) + QSize(0, 8); | - |
190 | | - |
191 | QSize total(iconSize.width() + textSize.width(), qMax(iconSize.height(), textSize.height())); | - |
192 | return total.expandedTo(QApplication::globalStrut()); | - |
193 | } | - |
194 | | - |
195 | QSize QToolBoxButton::minimumSizeHint() const | - |
196 | { | - |
197 | if (icon().isNull()) | - |
198 | return QSize(); | - |
199 | int icone = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, parentWidget() ); | - |
200 | return QSize(icone + 8, icone + 8); | - |
201 | } | - |
202 | | - |
203 | void QToolBoxButton::initStyleOption(QStyleOptionToolBox *option) const | - |
204 | { | - |
205 | if (!option) | - |
206 | return; | - |
207 | option->initFrom(this); | - |
208 | if (selected) | - |
209 | option->state |= QStyle::State_Selected; | - |
210 | if (isDown()) | - |
211 | option->state |= QStyle::State_Sunken; | - |
212 | option->text = text(); | - |
213 | option->icon = icon(); | - |
214 | | - |
215 | QToolBox *toolBox = static_cast<QToolBox *>(parentWidget()); | - |
216 | const int widgetCount = toolBox->count(); | - |
217 | const int currIndex = toolBox->currentIndex(); | - |
218 | if (widgetCount == 1) { | - |
219 | option->position = QStyleOptionToolBox::OnlyOneTab; | - |
220 | } else if (indexInPage == 0) { | - |
221 | option->position = QStyleOptionToolBox::Beginning; | - |
222 | } else if (indexInPage == widgetCount - 1) { | - |
223 | option->position = QStyleOptionToolBox::End; | - |
224 | } else { | - |
225 | option->position = QStyleOptionToolBox::Middle; | - |
226 | } | - |
227 | if (currIndex == indexInPage - 1) { | - |
228 | option->selectedPosition = QStyleOptionToolBox::PreviousIsSelected; | - |
229 | } else if (currIndex == indexInPage + 1) { | - |
230 | option->selectedPosition = QStyleOptionToolBox::NextIsSelected; | - |
231 | } else { | - |
232 | option->selectedPosition = QStyleOptionToolBox::NotAdjacent; | - |
233 | } | - |
234 | } | - |
235 | | - |
236 | void QToolBoxButton::paintEvent(QPaintEvent *) | - |
237 | { | - |
238 | QPainter paint(this); | - |
239 | QPainter *p = &paint; | - |
240 | QStyleOptionToolBox opt; | - |
241 | initStyleOption(&opt); | - |
242 | style()->drawControl(QStyle::CE_ToolBoxTab, &opt, p, parentWidget()); | - |
243 | } | - |
244 | | - |
245 | | - |
246 | | - |
247 | | - |
248 | | - |
249 | | - |
250 | | - |
251 | | - |
252 | | - |
253 | | - |
254 | | - |
255 | | - |
256 | | - |
257 | | - |
258 | | - |
259 | | - |
260 | | - |
261 | | - |
262 | | - |
263 | | - |
264 | | - |
265 | | - |
266 | | - |
267 | | - |
268 | | - |
269 | | - |
270 | | - |
271 | | - |
272 | | - |
273 | | - |
274 | | - |
275 | | - |
276 | | - |
277 | | - |
278 | | - |
279 | | - |
280 | | - |
281 | | - |
282 | | - |
283 | | - |
284 | | - |
285 | | - |
286 | | - |
287 | | - |
288 | | - |
289 | | - |
290 | | - |
291 | | - |
292 | | - |
293 | | - |
294 | QToolBox::QToolBox(QWidget *parent, Qt::WindowFlags f) | - |
295 | : QFrame(*new QToolBoxPrivate, parent, f) | - |
296 | { | - |
297 | Q_D(QToolBox); | - |
298 | d->layout = new QVBoxLayout(this); | - |
299 | d->layout->setMargin(0); | - |
300 | setBackgroundRole(QPalette::Button); | - |
301 | } | - |
302 | | - |
303 | | - |
304 | | - |
305 | | - |
306 | | - |
307 | QToolBox::~QToolBox() | - |
308 | { | - |
309 | } | - |
310 | | - |
311 | | - |
312 | | - |
313 | | - |
314 | | - |
315 | | - |
316 | | - |
317 | | - |
318 | | - |
319 | | - |
320 | | - |
321 | | - |
322 | | - |
323 | | - |
324 | | - |
325 | | - |
326 | | - |
327 | | - |
328 | | - |
329 | | - |
330 | | - |
331 | | - |
332 | | - |
333 | | - |
334 | | - |
335 | | - |
336 | | - |
337 | | - |
338 | | - |
339 | | - |
340 | | - |
341 | | - |
342 | int QToolBox::insertItem(int index, QWidget *widget, const QIcon &icon, const QString &text) | - |
343 | { | - |
344 | if (!widget) | - |
345 | return -1; | - |
346 | | - |
347 | Q_D(QToolBox); | - |
348 | connect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(_q_widgetDestroyed(QObject*))); | - |
349 | | - |
350 | QToolBoxPrivate::Page c; | - |
351 | c.widget = widget; | - |
352 | c.button = new QToolBoxButton(this); | - |
353 | c.button->setObjectName(QLatin1String("qt_toolbox_toolboxbutton")); | - |
354 | connect(c.button, SIGNAL(clicked()), this, SLOT(_q_buttonClicked())); | - |
355 | | - |
356 | c.sv = new QScrollArea(this); | - |
357 | c.sv->setWidget(widget); | - |
358 | c.sv->setWidgetResizable(true); | - |
359 | c.sv->hide(); | - |
360 | c.sv->setFrameStyle(QFrame::NoFrame); | - |
361 | | - |
362 | c.setText(text); | - |
363 | c.setIcon(icon); | - |
364 | | - |
365 | if (index < 0 || index >= (int)d->pageList.count()) { | - |
366 | index = d->pageList.count(); | - |
367 | d->pageList.append(c); | - |
368 | d->layout->addWidget(c.button); | - |
369 | d->layout->addWidget(c.sv); | - |
370 | if (index == 0) | - |
371 | setCurrentIndex(index); | - |
372 | } else { | - |
373 | d->pageList.insert(index, c); | - |
374 | d->relayout(); | - |
375 | if (d->currentPage) { | - |
376 | QWidget *current = d->currentPage->widget; | - |
377 | int oldindex = indexOf(current); | - |
378 | if (index <= oldindex) { | - |
379 | d->currentPage = 0; | - |
380 | setCurrentIndex(oldindex); | - |
381 | } | - |
382 | } | - |
383 | } | - |
384 | | - |
385 | c.button->show(); | - |
386 | | - |
387 | d->updateTabs(); | - |
388 | itemInserted(index); | - |
389 | return index; | - |
390 | } | - |
391 | | - |
392 | void QToolBoxPrivate::_q_buttonClicked() | - |
393 | { | - |
394 | Q_Q(QToolBox); | - |
395 | QToolBoxButton *tb = qobject_cast<QToolBoxButton*>(q->sender()); | - |
396 | QWidget* item = 0; | - |
397 | for (QToolBoxPrivate::PageList::ConstIterator i = pageList.constBegin(); i != pageList.constEnd(); ++i) | - |
398 | if ((*i).button == tb) { | - |
399 | item = (*i).widget; | - |
400 | break; | - |
401 | } | - |
402 | | - |
403 | q->setCurrentIndex(q->indexOf(item)); | - |
404 | } | - |
405 | | - |
406 | | - |
407 | | - |
408 | | - |
409 | | - |
410 | | - |
411 | | - |
412 | | - |
413 | int QToolBox::count() const | - |
414 | { | - |
415 | Q_D(const QToolBox); | - |
416 | return d->pageList.count(); | - |
417 | } | - |
418 | | - |
419 | void QToolBox::setCurrentIndex(int index) | - |
420 | { | - |
421 | Q_D(QToolBox); | - |
422 | QToolBoxPrivate::Page *c = d->page(index); | - |
423 | if (!c || d->currentPage == c) | - |
424 | return; | - |
425 | | - |
426 | c->button->setSelected(true); | - |
427 | if (d->currentPage) { | - |
428 | d->currentPage->sv->hide(); | - |
429 | d->currentPage->button->setSelected(false); | - |
430 | } | - |
431 | d->currentPage = c; | - |
432 | d->currentPage->sv->show(); | - |
433 | d->updateTabs(); | - |
434 | emit currentChanged(index); | - |
435 | } | - |
436 | | - |
437 | void QToolBoxPrivate::relayout() | - |
438 | { | - |
439 | Q_Q(QToolBox); | - |
440 | delete layout; | - |
441 | layout = new QVBoxLayout(q); | - |
442 | layout->setMargin(0); | - |
443 | for (QToolBoxPrivate::PageList::ConstIterator i = pageList.constBegin(); i != pageList.constEnd(); ++i) { | - |
444 | layout->addWidget((*i).button); | - |
445 | layout->addWidget((*i).sv); | - |
446 | } | - |
447 | } | - |
448 | | - |
449 | void QToolBoxPrivate::_q_widgetDestroyed(QObject *object) | - |
450 | { | - |
451 | Q_Q(QToolBox); | - |
452 | | - |
453 | QWidget *p = (QWidget*)object; | - |
454 | | - |
455 | const QToolBoxPrivate::Page *constc = page(objectp); | - |
456 | if (!p || !c)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
457 | return; never executed: return; | 0 |
458 | | - |
459 | layout->removeWidget(c->sv); | - |
460 | layout->removeWidget(c->button); | - |
461 | c->sv->deleteLater(); | - |
462 | delete c->button; | - |
463 | | - |
464 | bool removeCurrent = c == currentPage; | - |
465 | pageList.removeAll(*c); | - |
466 | | - |
467 | if (!pageList.count()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
468 | currentPage = 0; | - |
469 | emit q->currentChanged(-1); | - |
470 | } else if (removeCurrent) { never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
| 0 |
471 | currentPage = 0; | - |
472 | q->setCurrentIndex(0); | - |
473 | } never executed: end of block | 0 |
474 | } never executed: end of block | 0 |
475 | | - |
476 | | - |
477 | | - |
478 | | - |
479 | | - |
480 | | - |
481 | void QToolBox::removeItem(int index) | - |
482 | { | - |
483 | Q_D(QToolBox); | - |
484 | if (QWidget *w = widget(index)) { | - |
485 | disconnect(w, SIGNAL(destroyed(QObject*)), this, SLOT(_q_widgetDestroyed(QObject*))); | - |
486 | w->setParent(this); | - |
487 | | - |
488 | d->_q_widgetDestroyed(w); | - |
489 | itemRemoved(index); | - |
490 | } | - |
491 | } | - |
492 | | - |
493 | | - |
494 | | - |
495 | | - |
496 | | - |
497 | | - |
498 | | - |
499 | | - |
500 | | - |
501 | | - |
502 | | - |
503 | | - |
504 | int QToolBox::currentIndex() const | - |
505 | { | - |
506 | Q_D(const QToolBox); | - |
507 | return d->currentPage ? indexOf(d->currentPage->widget) : -1; | - |
508 | } | - |
509 | | - |
510 | | - |
511 | | - |
512 | | - |
513 | | - |
514 | | - |
515 | | - |
516 | QWidget * QToolBox::currentWidget() const | - |
517 | { | - |
518 | Q_D(const QToolBox); | - |
519 | return d->currentPage ? d->currentPage->widget : 0; | - |
520 | } | - |
521 | | - |
522 | | - |
523 | | - |
524 | | - |
525 | | - |
526 | | - |
527 | void QToolBox::setCurrentWidget(QWidget *widget) | - |
528 | { | - |
529 | int i = indexOf(widget); | - |
530 | if (i >= 0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
| setCurrentIndexTRUE | never evaluated | FALSE | never evaluated |
Q_UNLIKELY(i );TRUE | never evaluated | FALSE | never evaluated |
| |
| elseTRUE | never evaluated | FALSE | never evaluated |
< 0))TRUE | never evaluated | FALSE | never evaluated |
| |
531 | qWarning("QToolBox::setCurrentWidget: widget not contained in tool box"); never executed: QMessageLogger(__FILE__, 531, __PRETTY_FUNCTION__).warning("QToolBox::setCurrentWidget: widget not contained in tool box"); | 0 |
532 | else | - |
533 | setCurrentIndex(i never executed: setCurrentIndex(i); );never executed: setCurrentIndex(i); | 0 |
534 | } | - |
535 | | - |
536 | | - |
537 | | - |
538 | | - |
539 | | - |
540 | | - |
541 | QWidget *QToolBox::widget(int index) const | - |
542 | { | - |
543 | Q_D(const QToolBox); | - |
544 | if (index < 0 || index >= (int) d->pageList.size()) | - |
545 | return 0; | - |
546 | return d->pageList.at(index).widget; | - |
547 | } | - |
548 | | - |
549 | | - |
550 | | - |
551 | | - |
552 | | - |
553 | | - |
554 | int QToolBox::indexOf(QWidget *widget) const | - |
555 | { | - |
556 | Q_D(const QToolBox); | - |
557 | const QToolBoxPrivate::Page *c = (widget ? d->page(widget) : 0); | - |
558 | return c ? d->pageList.indexOf(*c) : -1; | - |
559 | } | - |
560 | | - |
561 | | - |
562 | | - |
563 | | - |
564 | | - |
565 | | - |
566 | void QToolBox::setItemEnabled(int index, bool enabled) | - |
567 | { | - |
568 | Q_D(QToolBox); | - |
569 | QToolBoxPrivate::Page *c = d->page(index); | - |
570 | if (!c) | - |
571 | return; | - |
572 | | - |
573 | c->button->setEnabled(enabled); | - |
574 | if (!enabled && c == d->currentPage) { | - |
575 | int curIndexUp = index; | - |
576 | int curIndexDown = curIndexUp; | - |
577 | const int count = d->pageList.count(); | - |
578 | while (curIndexUp > 0 || curIndexDown < count-1) { | - |
579 | if (curIndexDown < count-1) { | - |
580 | if (d->page(++curIndexDown)->button->isEnabled()) { | - |
581 | index = curIndexDown; | - |
582 | break; | - |
583 | } | - |
584 | } | - |
585 | if (curIndexUp > 0) { | - |
586 | if (d->page(--curIndexUp)->button->isEnabled()) { | - |
587 | index = curIndexUp; | - |
588 | break; | - |
589 | } | - |
590 | } | - |
591 | } | - |
592 | setCurrentIndex(index); | - |
593 | } | - |
594 | } | - |
595 | | - |
596 | | - |
597 | | - |
598 | | - |
599 | | - |
600 | | - |
601 | | - |
602 | | - |
603 | | - |
604 | | - |
605 | | - |
606 | | - |
607 | | - |
608 | | - |
609 | void QToolBox::setItemText(int index, const QString &text) | - |
610 | { | - |
611 | Q_D(QToolBox); | - |
612 | QToolBoxPrivate::Page *c = d->page(index); | - |
613 | if (c) | - |
614 | c->setText(text); | - |
615 | } | - |
616 | | - |
617 | | - |
618 | | - |
619 | | - |
620 | | - |
621 | void QToolBox::setItemIcon(int index, const QIcon &icon) | - |
622 | { | - |
623 | Q_D(QToolBox); | - |
624 | QToolBoxPrivate::Page *c = d->page(index); | - |
625 | if (c) | - |
626 | c->setIcon(icon); | - |
627 | } | - |
628 | | - |
629 | #ifndef QT_NO_TOOLTIP | - |
630 | | - |
631 | | - |
632 | | - |
633 | | - |
634 | void QToolBox::setItemToolTip(int index, const QString &toolTip) | - |
635 | { | - |
636 | Q_D(QToolBox); | - |
637 | QToolBoxPrivate::Page *c = d->page(index); | - |
638 | if (c) | - |
639 | c->setToolTip(toolTip); | - |
640 | } | - |
641 | #endif // QT_NO_TOOLTIP | - |
642 | | - |
643 | | - |
644 | | - |
645 | | - |
646 | | - |
647 | bool QToolBox::isItemEnabled(int index) const | - |
648 | { | - |
649 | Q_D(const QToolBox); | - |
650 | const QToolBoxPrivate::Page *c = d->page(index); | - |
651 | return c && c->button->isEnabled(); | - |
652 | } | - |
653 | | - |
654 | | - |
655 | | - |
656 | | - |
657 | | - |
658 | | - |
659 | QString QToolBox::itemText(int index) const | - |
660 | { | - |
661 | Q_D(const QToolBox); | - |
662 | const QToolBoxPrivate::Page *c = d->page(index); | - |
663 | return (c ? c->text() : QString()); | - |
664 | } | - |
665 | | - |
666 | | - |
667 | | - |
668 | | - |
669 | | - |
670 | | - |
671 | QIcon QToolBox::itemIcon(int index) const | - |
672 | { | - |
673 | Q_D(const QToolBox); | - |
674 | const QToolBoxPrivate::Page *c = d->page(index); | - |
675 | return (c ? c->icon() : QIcon()); | - |
676 | } | - |
677 | | - |
678 | #ifndef QT_NO_TOOLTIP | - |
679 | | - |
680 | | - |
681 | | - |
682 | | - |
683 | | - |
684 | QString QToolBox::itemToolTip(int index) const | - |
685 | { | - |
686 | Q_D(const QToolBox); | - |
687 | const QToolBoxPrivate::Page *c = d->page(index); | - |
688 | return (c ? c->toolTip() : QString()); | - |
689 | } | - |
690 | #endif // QT_NO_TOOLTIP | - |
691 | | - |
692 | | - |
693 | void QToolBox::showEvent(QShowEvent *e) | - |
694 | { | - |
695 | QWidget::showEvent(e); | - |
696 | } | - |
697 | | - |
698 | | - |
699 | void QToolBox::changeEvent(QEvent *ev) | - |
700 | { | - |
701 | Q_D(QToolBox); | - |
702 | if(ev->type() == QEvent::StyleChange) | - |
703 | d->updateTabs(); | - |
704 | QFrame::changeEvent(ev); | - |
705 | } | - |
706 | | - |
707 | | - |
708 | | - |
709 | | - |
710 | | - |
711 | | - |
712 | | - |
713 | void QToolBox::itemInserted(int index) | - |
714 | { | - |
715 | Q_UNUSED(index) | - |
716 | } | - |
717 | | - |
718 | | - |
719 | | - |
720 | | - |
721 | | - |
722 | | - |
723 | | - |
724 | void QToolBox::itemRemoved(int index) | - |
725 | { | - |
726 | Q_UNUSED(index) | - |
727 | } | - |
728 | | - |
729 | | - |
730 | bool QToolBox::event(QEvent *e) | - |
731 | { | - |
732 | return QFrame::event(e); | - |
733 | } | - |
734 | | - |
735 | QT_END_NAMESPACE | - |
736 | | - |
737 | #include "moc_qtoolbox.cpp" | - |
738 | #include "qtoolbox.moc" | - |
739 | | - |
740 | #endif //QT_NO_TOOLBOX | - |
| | |