Qt 4.8
qtoolbar.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 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 "qtoolbar.h"
43 
44 #ifndef QT_NO_TOOLBAR
45 
46 #include <qapplication.h>
47 #include <qcombobox.h>
48 #include <qevent.h>
49 #include <qlayout.h>
50 #include <qmainwindow.h>
51 #include <qmenu.h>
52 #include <qmenubar.h>
53 #include <qrubberband.h>
54 #include <qsignalmapper.h>
55 #include <qstylepainter.h>
56 #include <qtoolbutton.h>
57 #include <qwidgetaction.h>
58 #include <qtimer.h>
59 #include <private/qwidgetaction_p.h>
60 #ifdef Q_WS_MAC
61 #include <private/qt_mac_p.h>
62 #include <private/qt_cocoa_helpers_mac_p.h>
63 #endif
64 
65 #include <private/qmainwindowlayout_p.h>
66 
67 #include "qtoolbar_p.h"
68 #include "qtoolbarseparator_p.h"
69 #include "qtoolbarlayout_p.h"
70 
71 #include "qdebug.h"
72 
73 #define POPUP_TIMER_INTERVAL 500
74 
76 
77 #ifdef Q_WS_MAC
79 {
80  if (!(parentWidget->windowFlags() & Qt::CustomizeWindowHint))
81  parentWidget->setWindowFlags(parentWidget->windowFlags() | Qt::MacWindowToolBarButtonHint);
82 }
83 #endif
84 
85 // qmainwindow.cpp
87 
88 /******************************************************************************
89 ** QToolBarPrivate
90 */
91 
93 {
94  Q_Q(QToolBar);
96  q->setBackgroundRole(QPalette::Button);
97  q->setAttribute(Qt::WA_Hover);
98  q->setAttribute(Qt::WA_X11NetWmWindowTypeToolBar);
99 
100  QStyle *style = q->style();
101  int e = style->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q);
102  iconSize = QSize(e, e);
103 
104  layout = new QToolBarLayout(q);
106 
107 #ifdef Q_WS_MAC
108  if (q->parentWidget() && q->parentWidget()->isWindow()) {
109  // Make sure that the window has the "toolbar" button.
111  qt_mac_updateToolBarButtonHint(parentWidget);
112  reinterpret_cast<QToolBar *>(parentWidget)->d_func()->createWinId(); // Please let me create your winId...
113  extern OSWindowRef qt_mac_window_for(const QWidget *); // qwidget_mac.cpp
114  macWindowToolbarShow(q->parentWidget(), true);
115  }
116 #endif
117 
118  toggleViewAction = new QAction(q);
119  toggleViewAction->setCheckable(true);
120  q->setMovable(q->style()->styleHint(QStyle::SH_ToolBar_Movable, 0, q ));
121  QObject::connect(toggleViewAction, SIGNAL(triggered(bool)), q, SLOT(_q_toggleView(bool)));
122 }
123 
125 {
126  Q_Q(QToolBar);
127  if (b == q->isHidden()) {
128  if (b)
129  q->show();
130  else
131  q->close();
132  }
133 }
134 
136 {
137  Q_Q(QToolBar);
138  if (!explicitIconSize) {
139  // iconSize not explicitly set
140  q->setIconSize(sz);
141  explicitIconSize = false;
142  }
143 }
144 
146 {
147  Q_Q(QToolBar);
149  q->setToolButtonStyle(style);
150  explicitToolButtonStyle = false;
151  }
152 }
153 
155 {
156  Q_Q(QToolBar);
157  Qt::WindowFlags flags = floating ? Qt::Tool : Qt::Widget;
158 
159  flags |= Qt::FramelessWindowHint;
160 
161  if (unplug) {
163 #ifdef Q_WS_MAC
164  flags |= Qt::WindowStaysOnTopHint;
165 #endif
166  }
167 
168  q->setWindowFlags(flags);
169 }
170 
171 void QToolBarPrivate::setWindowState(bool floating, bool unplug, const QRect &rect)
172 {
173  Q_Q(QToolBar);
174  bool visible = !q->isHidden();
175  bool wasFloating = q->isFloating(); // ...is also currently using popup menus
176 
177  q->hide();
178 
179  updateWindowFlags(floating, unplug);
180 
181  if (floating != wasFloating)
183 
184  if (!rect.isNull())
185  q->setGeometry(rect);
186 
187  if (visible)
188  q->show();
189 
190  if (floating != wasFloating)
191  emit q->topLevelChanged(floating);
192 }
193 
195 {
196  Q_Q(QToolBar);
197 
198  if (state != 0)
199  return;
200 
202  Q_ASSERT(win != 0);
204  Q_ASSERT(layout != 0);
205  if (layout->pluggingWidget != 0) // the main window is animating a docking operation
206  return;
207 
208  state = new DragState;
209  state->pressPos = pos;
210  state->dragging = false;
211  state->moving = false;
212  state->widgetItem = 0;
213 
214  if (q->isRightToLeft())
215  state->pressPos = QPoint(q->width() - state->pressPos.x(), state->pressPos.y());
216 }
217 
218 void QToolBarPrivate::startDrag(bool moving)
219 {
220  Q_Q(QToolBar);
221 
222  Q_ASSERT(state != 0);
223 
224  if ((moving && state->moving) || state->dragging)
225  return;
226 
228  Q_ASSERT(win != 0);
230  Q_ASSERT(layout != 0);
231 
232  if (!moving) {
233  state->widgetItem = layout->unplug(q);
234 #if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)
235  if (q->isWindow()) {
236  setWindowState(true, true); //set it to floating
237  }
238 #endif
239  Q_ASSERT(state->widgetItem != 0);
240  }
241  state->dragging = !moving;
242  state->moving = moving;
243 }
244 
246 {
247  Q_Q(QToolBar);
248  Q_ASSERT(state != 0);
249 
250  q->releaseMouse();
251 
252  if (state->dragging) {
253  QMainWindowLayout *layout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget()));
254  Q_ASSERT(layout != 0);
255 
256  if (!layout->plug(state->widgetItem)) {
257  if (q->isFloatable()) {
258  layout->restore();
259 #if defined(Q_WS_X11) || defined(Q_WS_MAC)
260  setWindowState(true); // gets rid of the X11BypassWindowManager window flag
261  // and activates the resizer
262 #endif
263  q->activateWindow();
264  } else {
265  layout->revert(state->widgetItem);
266  }
267  }
268  }
269 
270  delete state;
271  state = 0;
272 }
273 
275 {
276  Q_Q(QToolBar);
278  q->initStyleOption(&opt);
279  if (q->style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, q).contains(event->pos()) == false) {
280 #ifdef Q_WS_MAC
281  // When using the unified toolbar on Mac OS X the user can can click and
282  // drag between toolbar contents to move the window. Make this work by
283  // implementing the standard mouse-dragging code and then call
284  // window->move() in mouseMoveEvent below.
285  if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parent)) {
286  if (mainWindow->toolBarArea(q) == Qt::TopToolBarArea
287  && mainWindow->unifiedTitleAndToolBarOnMac()
288  && q->childAt(event->pos()) == 0) {
289  macWindowDragging = true;
290  macWindowDragPressPosition = event->pos();
291  return true;
292  }
293  }
294 #endif
295  return false;
296  }
297 
298  if (event->button() != Qt::LeftButton)
299  return true;
300 
301  if (!layout->movable())
302  return true;
303 
304  initDrag(event->pos());
305  return true;
306 }
307 
309 {
310  if (state != 0) {
311  endDrag();
312  return true;
313  } else {
314 #ifdef Q_WS_MAC
315  if (!macWindowDragging)
316  return false;
317  macWindowDragging = false;
319  return true;
320 #endif
321  return false;
322  }
323 }
324 
326 {
327  Q_Q(QToolBar);
328 
329  if (!state) {
330 #ifdef Q_WS_MAC
331  if (!macWindowDragging)
332  return false;
333  QWidget *w = q->window();
334  const QPoint delta = event->pos() - macWindowDragPressPosition;
335  w->move(w->pos() + delta);
336  return true;
337 #endif
338  return false;
339  }
340 
342  if (win == 0)
343  return true;
344 
346  Q_ASSERT(layout != 0);
347 
348  if (layout->pluggingWidget == 0
349  && (event->pos() - state->pressPos).manhattanLength() > QApplication::startDragDistance()) {
350  const bool wasDragging = state->dragging;
351  const bool moving = !q->isWindow() && (orientation == Qt::Vertical ?
352  event->x() >= 0 && event->x() < q->width() :
353  event->y() >= 0 && event->y() < q->height());
354 
355  startDrag(moving);
356  if (!moving && !wasDragging) {
357 #ifdef Q_OS_WIN
358  grabMouseWhileInWindow();
359 #else
360  q->grabMouse();
361 #endif
362  }
363  }
364 
365  if (state->dragging) {
366  QPoint pos = event->globalPos();
367  // if we are right-to-left, we move so as to keep the right edge the same distance
368  // from the mouse
369  if (q->isLeftToRight())
370  pos -= state->pressPos;
371  else
372  pos += QPoint(state->pressPos.x() - q->width(), -state->pressPos.y());
373 
374  q->move(pos);
375  layout->hover(state->widgetItem, event->globalPos());
376  } else if (state->moving) {
377 
378  const QPoint rtl(q->width() - state->pressPos.x(), state->pressPos.y()); //for RTL
379  const QPoint globalPressPos = q->mapToGlobal(q->isRightToLeft() ? rtl : state->pressPos);
380  int pos = 0;
381 
382  QPoint delta = event->globalPos() - globalPressPos;
383  if (orientation == Qt::Vertical) {
384  pos = q->y() + delta.y();
385  } else {
386  if (q->isRightToLeft()) {
387  pos = win->width() - q->width() - q->x() - delta.x();
388  } else {
389  pos = q->x() + delta.x();
390  }
391  }
392 
393  layout->moveToolBar(q, pos);
394  }
395  return true;
396 }
397 
399 {
400  Q_Q(QToolBar);
401  QRect r = _r;
402  r.moveTopLeft(q->mapToGlobal(QPoint(0, 0)));
403  setWindowState(true, true, r);
404  layout->setExpanded(false);
405 }
406 
408 {
409  setWindowState(false, false, r);
410 }
411 
412 /******************************************************************************
413 ** QToolBar
414 */
415 
576  : QWidget(*new QToolBarPrivate, parent, 0)
577 {
578  Q_D(QToolBar);
579  d->init();
580 }
581 
591  : QWidget(*new QToolBarPrivate, parent, 0)
592 {
593  Q_D(QToolBar);
594  d->init();
595  setWindowTitle(title);
596 }
597 
598 #ifdef QT3_SUPPORT
599 
605 QToolBar::QToolBar(QWidget *parent, const char *name)
606  : QWidget(*new QToolBarPrivate, parent, 0)
607 {
608  Q_D(QToolBar);
609  d->init();
611 }
612 #endif
613 
618 {
619  // Remove the toolbar button if there is nothing left.
620  QMainWindow *mainwindow = qobject_cast<QMainWindow *>(parentWidget());
621  if (mainwindow) {
622 #ifdef Q_WS_MAC
623  QMainWindowLayout *mainwin_layout = qt_mainwindow_layout(mainwindow);
624  if (mainwin_layout && mainwin_layout->layoutState.toolBarAreaLayout.isEmpty()
625  && mainwindow->testAttribute(Qt::WA_WState_Created))
626  macWindowToolbarShow(mainwindow, false);
627 #endif
628  }
629 }
630 
647 {
648  Q_D(QToolBar);
649  if (!movable == !d->movable)
650  return;
651  d->movable = movable;
652  d->layout->invalidate();
653  emit movableChanged(d->movable);
654 }
655 
657 {
658  Q_D(const QToolBar);
659  return d->movable;
660 }
661 
672 {
673  Q_D(const QToolBar);
674  return d->floatable;
675 }
676 
678 {
679  Q_D(QToolBar);
680  d->floatable = floatable;
681 }
682 
695 {
696  return isWindow();
697 }
698 
714 void QToolBar::setAllowedAreas(Qt::ToolBarAreas areas)
715 {
716  Q_D(QToolBar);
717  areas &= Qt::ToolBarArea_Mask;
718  if (areas == d->allowedAreas)
719  return;
720  d->allowedAreas = areas;
721  emit allowedAreasChanged(d->allowedAreas);
722 }
723 
724 Qt::ToolBarAreas QToolBar::allowedAreas() const
725 {
726  Q_D(const QToolBar);
727 #ifdef Q_WS_MAC
728  if (QMainWindow *window = qobject_cast<QMainWindow *>(parentWidget())) {
729  if (window->unifiedTitleAndToolBarOnMac()) // Don't allow drags to the top (for now).
730  return (d->allowedAreas & ~Qt::TopToolBarArea);
731  }
732 #endif
733  return d->allowedAreas;
734 }
735 
751 {
752  Q_D(QToolBar);
753  if (orientation == d->orientation)
754  return;
755 
756  d->orientation = orientation;
757 
758  if (orientation == Qt::Vertical)
760  else
762 
763  d->layout->invalidate();
764  d->layout->activate();
765 
766  emit orientationChanged(d->orientation);
767 }
768 
770 { Q_D(const QToolBar); return d->orientation; }
771 
786 { Q_D(const QToolBar); return d->iconSize; }
787 
789 {
790  Q_D(QToolBar);
791  QSize sz = iconSize;
792  if (!sz.isValid()) {
794  if (mw && mw->layout()) {
795  QLayout *layout = mw->layout();
796  int i = 0;
797  QLayoutItem *item = 0;
798  do {
799  item = layout->itemAt(i++);
800  if (item && (item->widget() == this))
801  sz = mw->iconSize();
802  } while (!sz.isValid() && item != 0);
803  }
804  }
805  if (!sz.isValid()) {
806  const int metric = style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, this);
807  sz = QSize(metric, metric);
808  }
809  if (d->iconSize != sz) {
810  d->iconSize = sz;
811  setMinimumSize(0, 0);
812  emit iconSizeChanged(d->iconSize);
813  }
814  d->explicitIconSize = iconSize.isValid();
815 
816  d->layout->invalidate();
817 }
818 
834 { Q_D(const QToolBar); return d->toolButtonStyle; }
835 
837 {
838  Q_D(QToolBar);
839  d->explicitToolButtonStyle = true;
840  if (d->toolButtonStyle == toolButtonStyle)
841  return;
842  d->toolButtonStyle = toolButtonStyle;
843  setMinimumSize(0, 0);
844  emit toolButtonStyleChanged(d->toolButtonStyle);
845 }
846 
853 {
854  QList<QAction *> actions = this->actions();
855  for(int i = 0; i < actions.size(); i++)
856  removeAction(actions.at(i));
857 }
858 
869 {
870  QAction *action = new QAction(text, this);
871  addAction(action);
872  return action;
873 }
874 
885 {
886  QAction *action = new QAction(icon, text, this);
887  addAction(action);
888  return action;
889 }
890 
903  const QObject *receiver, const char* member)
904 {
905  QAction *action = new QAction(text, this);
906  QObject::connect(action, SIGNAL(triggered(bool)), receiver, member);
907  addAction(action);
908  return action;
909 }
910 
923  const QObject *receiver, const char* member)
924 {
925  QAction *action = new QAction(icon, text, this);
926  QObject::connect(action, SIGNAL(triggered(bool)), receiver, member);
927  addAction(action);
928  return action;
929 }
930 
937 {
938  QAction *action = new QAction(this);
939  action->setSeparator(true);
940  addAction(action);
941  return action;
942 }
943 
951 {
952  QAction *action = new QAction(this);
953  action->setSeparator(true);
954  insertAction(before, action);
955  return action;
956 }
957 
974 {
975  QWidgetAction *action = new QWidgetAction(this);
976  action->setDefaultWidget(widget);
977  action->d_func()->autoCreated = true;
978  addAction(action);
979  return action;
980 }
981 
993 {
994  QWidgetAction *action = new QWidgetAction(this);
995  action->setDefaultWidget(widget);
996  action->d_func()->autoCreated = true;
997  insertAction(before, action);
998  return action;
999 }
1000 
1011 {
1012  Q_D(const QToolBar);
1013 
1014  int index = d->layout->indexOf(action);
1015  if (index == -1)
1016  return QRect();
1017  return d->layout->itemAt(index)->widget()->geometry();
1018 }
1019 
1027 {
1028  Q_D(const QToolBar);
1029  QWidget *widget = childAt(p);
1030  int index = d->layout->indexOf(widget);
1031  if (index == -1)
1032  return 0;
1033  QLayoutItem *item = d->layout->itemAt(index);
1034  return static_cast<QToolBarItem*>(item)->action;
1035 }
1036 
1046 {
1047  Q_D(QToolBar);
1048  QAction *action = event->action();
1049  QWidgetAction *widgetAction = qobject_cast<QWidgetAction *>(action);
1050 
1051  switch (event->type()) {
1052  case QEvent::ActionAdded: {
1053  Q_ASSERT_X(widgetAction == 0 || d->layout->indexOf(widgetAction) == -1,
1054  "QToolBar", "widgets cannot be inserted multiple times");
1055 
1056  // reparent the action to this toolbar if it has been created
1057  // using the addAction(text) etc. convenience functions, to
1058  // preserve Qt 4.1.x behavior. The widget is already
1059  // reparented to us due to the createWidget call inside
1060  // createItem()
1061  if (widgetAction != 0 && widgetAction->d_func()->autoCreated)
1062  widgetAction->setParent(this);
1063 
1064  int index = d->layout->count();
1065  if (event->before()) {
1066  index = d->layout->indexOf(event->before());
1067  Q_ASSERT_X(index != -1, "QToolBar::insertAction", "internal error");
1068  }
1069  d->layout->insertAction(index, action);
1070  break;
1071  }
1072 
1073  case QEvent::ActionChanged:
1074  d->layout->invalidate();
1075  break;
1076 
1077  case QEvent::ActionRemoved: {
1078  int index = d->layout->indexOf(action);
1079  if (index != -1) {
1080  delete d->layout->takeAt(index);
1081  }
1082  break;
1083  }
1084 
1085  default:
1086  Q_ASSERT_X(false, "QToolBar::actionEvent", "internal error");
1087  }
1088 }
1089 
1092 {
1093  Q_D(QToolBar);
1094  switch (event->type()) {
1096  d->toggleViewAction->setText(windowTitle());
1097  break;
1098  case QEvent::StyleChange:
1099  d->layout->invalidate();
1100  if (!d->explicitIconSize)
1101  setIconSize(QSize());
1102  d->layout->updateMarginAndSpacing();
1103  break;
1105  d->layout->invalidate();
1106  break;
1107  default:
1108  break;
1109  }
1110  QWidget::changeEvent(event);
1111 }
1112 
1115 {
1116  Q_D(QToolBar);
1117 
1118  QPainter p(this);
1119  QStyle *style = this->style();
1120  QStyleOptionToolBar opt;
1121  initStyleOption(&opt);
1122 
1123  if (d->layout->expanded || d->layout->animating || isWindow()) {
1124  //if the toolbar is expended, we need to fill the background with the window color
1125  //because some styles may expects that.
1126  p.fillRect(opt.rect, palette().background());
1127  style->drawControl(QStyle::CE_ToolBar, &opt, &p, this);
1128  style->drawPrimitive(QStyle::PE_FrameMenu, &opt, &p, this);
1129  } else {
1130  style->drawControl(QStyle::CE_ToolBar, &opt, &p, this);
1131  }
1132 
1133  opt.rect = style->subElementRect(QStyle::SE_ToolBarHandle, &opt, this);
1134  if (opt.rect.isValid())
1135  style->drawPrimitive(QStyle::PE_IndicatorToolBarHandle, &opt, &p, this);
1136 }
1137 
1138 /*
1139  Checks if an expanded toolbar has to wait for this popup to close before
1140  the toolbar collapses. This is true if
1141  1) the popup has the toolbar in its parent chain,
1142  2) the popup is a menu whose menuAction is somewhere in the toolbar.
1143 */
1144 static bool waitForPopup(QToolBar *tb, QWidget *popup)
1145 {
1146  if (popup == 0 || popup->isHidden())
1147  return false;
1148 
1149  QWidget *w = popup;
1150  while (w != 0) {
1151  if (w == tb)
1152  return true;
1153  w = w->parentWidget();
1154  }
1155 
1156  QMenu *menu = qobject_cast<QMenu*>(popup);
1157  if (menu == 0)
1158  return false;
1159 
1160  QAction *action = menu->menuAction();
1161  QList<QWidget*> widgets = action->associatedWidgets();
1162  for (int i = 0; i < widgets.count(); ++i) {
1163  if (waitForPopup(tb, widgets.at(i)))
1164  return true;
1165  }
1166 
1167  return false;
1168 }
1169 
1170 #if defined(Q_WS_MAC)
1172 {
1173  const QMainWindow *mainWindow = qobject_cast<const QMainWindow *>(toolbar->parentWidget());
1174  return mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()
1175  && mainWindow->toolBarArea(toolbar) == Qt::TopToolBarArea;
1176 }
1177 #endif
1178 
1181 {
1182  Q_D(QToolBar);
1183 
1184  switch (event->type()) {
1185  case QEvent::Timer:
1186  if (d->waitForPopupTimer.timerId() == static_cast<QTimerEvent*>(event)->timerId()) {
1188  if (!waitForPopup(this, w)) {
1189  d->waitForPopupTimer.stop();
1190  if (!this->underMouse())
1191  d->layout->setExpanded(false);
1192  }
1193  }
1194  break;
1195  case QEvent::Hide:
1196  if (!isHidden())
1197  break;
1198  // fallthrough intended
1199  case QEvent::Show:
1200  d->toggleViewAction->setChecked(event->type() == QEvent::Show);
1201  emit visibilityChanged(event->type() == QEvent::Show);
1202 #if defined(Q_WS_MAC)
1203  if (toolbarInUnifiedToolBar(this)) {
1204  // I can static_cast because I did the qobject_cast in the if above, therefore
1205  // we must have a QMainWindowLayout here.
1206  QMainWindowLayout *mwLayout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(parentWidget()));
1207  mwLayout->fixSizeInUnifiedToolbar(this);
1208  mwLayout->syncUnifiedToolbarVisibility();
1209  }
1210 # if !defined(QT_MAC_USE_COCOA)
1211  // Fall through
1212  case QEvent::LayoutRequest: {
1213  // There's currently no way to invalidate the size and let
1214  // HIToolbar know about it. This forces a re-check.
1215  int earlyResult = -1;
1216  if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parentWidget())) {
1217  bool needUpdate = true;
1218  if (event->type() == QEvent::LayoutRequest) {
1219  QSize oldSizeHint = sizeHint();
1220  earlyResult = QWidget::event(event) ? 1 : 0;
1221  needUpdate = oldSizeHint != sizeHint();
1222  }
1223 
1224  if (needUpdate) {
1225  OSWindowRef windowRef = qt_mac_window_for(mainWindow);
1226  if (toolbarInUnifiedToolBar(this)
1227  && macWindowToolbarIsVisible(windowRef)) {
1228  DisableScreenUpdates();
1229  macWindowToolbarShow(this, false);
1230  macWindowToolbarShow(this, true);
1231  EnableScreenUpdates();
1232  }
1233  }
1234 
1235  if (earlyResult != -1)
1236  return earlyResult;
1237  }
1238  }
1239 # endif // !QT_MAC_USE_COCOA
1240 #endif // Q_WS_MAC
1241  break;
1242  case QEvent::ParentChange:
1243  d->layout->checkUsePopupMenu();
1244 #if defined(Q_WS_MAC)
1245  if (parentWidget() && parentWidget()->isWindow())
1247 #endif
1248  break;
1249 
1250  case QEvent::MouseButtonPress: {
1251  if (d->mousePressEvent(static_cast<QMouseEvent*>(event)))
1252  return true;
1253  break;
1254  }
1256  if (d->mouseReleaseEvent(static_cast<QMouseEvent*>(event)))
1257  return true;
1258  break;
1259  case QEvent::HoverEnter:
1260  case QEvent::HoverLeave:
1261  // there's nothing special to do here and we don't want to update the whole widget
1262  return true;
1263  case QEvent::HoverMove: {
1264 #ifndef QT_NO_CURSOR
1265  QHoverEvent *e = static_cast<QHoverEvent*>(event);
1266  QStyleOptionToolBar opt;
1267  initStyleOption(&opt);
1268  if (style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, this).contains(e->pos()))
1270  else
1271  unsetCursor();
1272 #endif
1273  break;
1274  }
1275  case QEvent::MouseMove:
1276  if (d->mouseMoveEvent(static_cast<QMouseEvent*>(event)))
1277  return true;
1278  break;
1279 #ifdef Q_WS_WINCE
1280  case QEvent::ContextMenu:
1281  {
1283  QWidget* child = childAt(contextMenuEvent->pos());
1284  QAbstractButton* button = qobject_cast<QAbstractButton*>(child);
1285  if (button)
1286  button->setDown(false);
1287  }
1288  break;
1289 #endif
1290  case QEvent::Leave:
1291  if (d->state != 0 && d->state->dragging) {
1292 #ifdef Q_OS_WIN
1293  // This is a workaround for loosing the mouse on Vista.
1294  QPoint pos = QCursor::pos();
1297  d->mouseMoveEvent(&fake);
1298 #endif
1299  } else {
1300  if (!d->layout->expanded)
1301  break;
1302 
1304  if (waitForPopup(this, w)) {
1305  d->waitForPopupTimer.start(POPUP_TIMER_INTERVAL, this);
1306  break;
1307  }
1308 
1309  d->waitForPopupTimer.stop();
1310  d->layout->setExpanded(false);
1311  break;
1312  }
1313  default:
1314  break;
1315  }
1316  return QWidget::event(event);
1317 }
1318 
1328 { Q_D(const QToolBar); return d->toggleViewAction; }
1329 
1359 {
1360  Q_D(const QToolBar);
1361 
1362  int index = d->layout->indexOf(action);
1363  if (index == -1)
1364  return 0;
1365 
1366  return d->layout->itemAt(index)->widget();
1367 }
1368 
1369 extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window);
1370 
1375 {
1376  Q_D(const QToolBar);
1377 
1378  if (!option)
1379  return;
1380 
1381  option->initFrom(this);
1382  if (orientation() == Qt::Horizontal)
1383  option->state |= QStyle::State_Horizontal;
1385  option->features = d->layout->movable()
1388  // if the tool bar is not in a QMainWindow, this will make the painting right
1389  option->toolBarArea = Qt::NoToolBarArea;
1390 
1391  // Add more styleoptions if the toolbar has been added to a mainwindow.
1392  QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parentWidget());
1393 
1394  if (!mainWindow)
1395  return;
1396 
1398  Q_ASSERT_X(layout != 0, "QToolBar::initStyleOption()",
1399  "QMainWindow->layout() != QMainWindowLayout");
1400 
1401  layout->getStyleOptionInfo(option, const_cast<QToolBar *>(this));
1402 }
1403 
1407 void QToolBar::childEvent(QChildEvent *event) // ### remove me in 5.0
1408 {
1409  QWidget::childEvent(event);
1410 }
1411 
1415 void QToolBar::resizeEvent(QResizeEvent *event) // ### remove me in 5.0
1416 {
1417  QWidget::resizeEvent(event);
1418 }
1419 
1421 
1422 #include "moc_qtoolbar.cpp"
1423 
1424 #endif // QT_NO_TOOLBAR
Qt::ToolBarAreas allowedAreas() const
areas where the toolbar may be placed
Definition: qtoolbar.cpp:724
The QAbstractButton class is the abstract base class of button widgets, providing functionality commo...
QPoint pos() const
T qobject_cast(QObject *object)
Definition: qobject.h:375
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
bool macWindowDragging
Definition: qtoolbar_p.h:111
QAction * before() const
If type() is ActionAdded , returns the action that should appear before action(). ...
Definition: qevent.h:640
double d
Definition: qnumeric_p.h:62
void orientationChanged(Qt::Orientation orientation)
This signal is emitted when the orientation of the toolbar changes.
bool isMovable() const
Definition: qtoolbar.cpp:656
QLayoutItem * widgetItem
Definition: qtoolbar_p.h:106
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
QMainWindowLayout * qt_mainwindow_layout(const QMainWindow *window)
static void qt_mac_updateToolBarButtonHint(QWidget *parentWidget)
Definition: qtoolbar.cpp:78
virtual QLayoutItem * itemAt(int index) const =0
Must be implemented in subclasses to return the layout item at index.
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition: qrect.h:231
bool explicitToolButtonStyle
Definition: qtoolbar_p.h:90
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QAction * insertWidget(QAction *before, QWidget *widget)
Inserts the given widget in front of the toolbar item associated with the before action.
Definition: qtoolbar.cpp:992
int metric(PaintDeviceMetric) const
Internal implementation of the virtual QPaintDevice::metric() function.
EventRef event
QPointer< QWidget > widget
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
Definition: qstring.cpp:4276
void revert(QLayoutItem *widgetItem)
void unsetCursor()
Definition: qwidget.cpp:5311
void setSeparator(bool b)
If b is true then this action will be considered a separator.
Definition: qaction.cpp:823
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QContextMenuEvent class contains parameters that describe a context menu event.
Definition: qevent.h:396
const QPoint & pos() const
Returns the position of the mouse pointer relative to the widget that received the event...
Definition: qevent.h:412
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
int lineWidth
This variable holds the line width for drawing the toolbar.
Definition: qstyleoption.h:381
ToolBarFeatures features
This variable holds whether the toolbar is movable or not.
Definition: qstyleoption.h:380
The QHoverEvent class contains parameters that describe a mouse event.
Definition: qevent.h:125
#define SLOT(a)
Definition: qobjectdefs.h:226
bool movable() const
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
~QToolBar()
Destroys the toolbar.
Definition: qtoolbar.cpp:617
void changeEvent(QEvent *event)
Reimplemented Function
Definition: qtoolbar.cpp:1091
The QStyleOptionToolBar class is used to describe the parameters for drawing a toolbar.
Definition: qstyleoption.h:369
virtual void resizeEvent(QResizeEvent *)
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
Definition: qwidget.cpp:9587
QMainWindowLayoutState layoutState
bool isFloatable() const
Definition: qtoolbar.cpp:671
void setOrientation(Qt::Orientation orientation)
Definition: qtoolbar.cpp:750
void updateWindowFlags(bool floating, bool unplug=false)
Definition: qtoolbar.cpp:154
void setMinimumSize(const QSize &)
Definition: qwidget.h:969
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
The QActionEvent class provides an event that is generated when a QAction is added, removed, or changed.
Definition: qevent.h:632
bool movable
whether the user can move the toolbar within the toolbar area, or between toolbar areas ...
Definition: qtoolbar.h:66
bool underMouse() const
Returns true if the widget is under the mouse cursor; otherwise returns false.
Definition: qwidget.h:996
QList< int > hover(QLayoutItem *widgetItem, const QPoint &mousePos)
friend OSWindowRef qt_mac_window_for(const QWidget *w)
Definition: qwidget_mac.mm:484
The QString class provides a Unicode character string.
Definition: qstring.h:83
T * qobject_cast(QObject *object)
Definition: qobject.h:375
void _q_updateIconSize(const QSize &sz)
Definition: qtoolbar.cpp:135
void _q_toggleView(bool b)
Definition: qtoolbar.cpp:124
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QWidget * widgetForAction(QAction *action) const
Returns the widget associated with the specified action.
Definition: qtoolbar.cpp:1358
#define Q_D(Class)
Definition: qglobal.h:2482
void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle)
This signal is emitted when the tool button style is changed.
bool macWindowToolbarIsVisible(void *window)
NSToolbar * toolbar
virtual QSize sizeHint() const
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
Definition: qevent.h:95
void setParent(QObject *)
Makes the object a child of parent.
Definition: qobject.cpp:1950
QStyle * style() const
Definition: qwidget.cpp:2742
OSWindowRef qt_mac_window_for(const QWidget *)
Definition: qwidget_mac.mm:484
void setObjectName(const QString &name)
Definition: qobject.cpp:1112
#define Q_Q(Class)
Definition: qglobal.h:2483
void getStyleOptionInfo(QStyleOptionToolBar *option, QToolBar *toolBar) const
QList< QWidget * > associatedWidgets() const
Returns a list of widgets this action has been added to.
Definition: qaction.cpp:416
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008
QToolBarLayout * layout
Definition: qtoolbar_p.h:100
#define SIGNAL(a)
Definition: qobjectdefs.h:227
void setWindowTitle(const QString &)
Definition: qwidget.cpp:6312
NSWindow * window
void initDrag(const QPoint &pos)
Definition: qtoolbar.cpp:194
void setExpanded(bool b)
void plug(const QRect &r)
Definition: qtoolbar.cpp:407
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Definition: qlayoutitem.h:64
QPoint macWindowDragPressPosition
Definition: qtoolbar_p.h:112
QSize iconSize
size of toolbar icons in this mainwindow.
Definition: qmainwindow.h:69
void visibilityChanged(bool visible)
This signal is emitted when the toolbar becomes visible (or invisible).
WindowRef OSWindowRef
void setIconSize(const QSize &iconSize)
Definition: qtoolbar.cpp:788
Qt::ToolBarArea toolBarArea(QToolBar *toolbar) const
Returns the Qt::ToolBarArea for toolbar.
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
virtual void childEvent(QChildEvent *)
This event handler can be reimplemented in a subclass to receive child events.
Definition: qobject.cpp:1332
QWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a widget which is a child of parent, with widget flags set to f.
Definition: qwidget.cpp:1189
bool mouseReleaseEvent(QMouseEvent *e)
Definition: qtoolbar.cpp:308
int width() const
The QToolBar class provides a movable panel that contains a set of controls.
Definition: qtoolbar.h:62
void initFrom(const QWidget *w)
Definition: qstyleoption.h:99
The QLayout class is the base class of geometry managers.
Definition: qlayout.h:90
const char * name
QWidget * childAt(int x, int y) const
Returns the visible child widget at the position ({x}, {y}) in the widget&#39;s coordinate system...
Definition: qwidget.h:934
QAction * insertSeparator(QAction *before)
Inserts a separator into the toolbar in front of the toolbar item associated with the before action...
Definition: qtoolbar.cpp:950
QAction * toggleViewAction() const
Returns a checkable action that can be used to show or hide this toolbar.
Definition: qtoolbar.cpp:1327
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
virtual void changeEvent(QEvent *)
This event handler can be reimplemented to handle state changes.
Definition: qwidget.cpp:9170
#define POPUP_TIMER_INTERVAL
Definition: qtoolbar.cpp:73
void setWindowFlags(Qt::WindowFlags type)
Definition: qwidget.cpp:10399
const QPalette & palette() const
void iconSizeChanged(const QSize &iconSize)
This signal is emitted when the icon size is changed.
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
void setDefaultWidget(QWidget *w)
Sets widget to be the default widget.
void actionEvent(QActionEvent *event)
Reimplemented Function
Definition: qtoolbar.cpp:1045
QString windowTitle() const
void setCursor(const QCursor &)
Definition: qwidget.cpp:5290
void allowedAreasChanged(Qt::ToolBarAreas allowedAreas)
This signal is emitted when the collection of allowed areas for the toolbar is changed.
void restore(bool keepSavedState=false)
static int startDragDistance()
QToolBar(const QString &title, QWidget *parent=0)
Constructs a QToolBar with the given parent.
Definition: qtoolbar.cpp:590
void setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle)
Definition: qtoolbar.cpp:836
QAction * actionAt(const QPoint &p) const
Returns the action at point p.
Definition: qtoolbar.cpp:1026
static bool toolbarInUnifiedToolBar(QToolBar *toolbar)
Definition: qtoolbar.cpp:1171
Qt::MouseButton button() const
Returns the button that caused the event.
Definition: qevent.h:101
void moveTopLeft(const QPoint &p)
Moves the rectangle, leaving the top-left corner at the given position.
Definition: qrect.h:368
static QWidget * parentWidget(const QWidget *w)
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
void moveToolBar(QToolBar *toolbar, int pos)
The QChildEvent class contains event parameters for child object events.
Definition: qcoreevent.h:353
virtual void contextMenuEvent(QContextMenuEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive widget context men...
Definition: qwidget.cpp:9645
Qt::Orientation orientation
Definition: qtoolbar_p.h:94
void unplug(const QRect &r)
Definition: qtoolbar.cpp:398
QAction * addSeparator()
Adds a separator to the end of the toolbar.
Definition: qtoolbar.cpp:936
The QWidgetAction class extends QAction by an interface for inserting custom widgets into action base...
Definition: qwidgetaction.h:57
bool unifiedTitleAndToolBarOnMac
whether the window uses the unified title and toolbar look on Mac OS X
Definition: qmainwindow.h:83
bool mouseMoveEvent(QMouseEvent *e)
Definition: qtoolbar.cpp:325
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
void setWindowState(bool floating, bool unplug=false, const QRect &rect=QRect())
Definition: qtoolbar.cpp:171
DragState * state
Definition: qtoolbar_p.h:108
void paintEvent(QPaintEvent *event)
Reimplemented Function
Definition: qtoolbar.cpp:1114
virtual QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget=0) const =0
Returns the sub-area for the given element as described in the provided style option.
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
Definition: qevent.h:131
static Qt::KeyboardModifiers keyboardModifiers()
Returns the current state of the modifier keys on the keyboard.
static QWidget * activePopupWidget()
Returns the active popup widget.
void setFloatable(bool floatable)
Definition: qtoolbar.cpp:677
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus...
Definition: qmenu.h:72
bool isFloating() const
Definition: qtoolbar.cpp:694
The QTimerEvent class contains parameters that describe a timer event.
Definition: qcoreevent.h:341
QPoint pos
the position of the widget within its parent widget
Definition: qwidget.h:163
Qt::Orientation orientation() const
orientation of the toolbar
Definition: qtoolbar.cpp:769
void childEvent(QChildEvent *event)
Reimplemented Function
Definition: qtoolbar.cpp:1407
bool plug(QLayoutItem *widgetItem)
void setAllowedAreas(Qt::ToolBarAreas areas)
Definition: qtoolbar.cpp:714
QSize iconSize() const
size of icons in the toolbar.
Definition: qtoolbar.cpp:785
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
QAction * addWidget(QWidget *widget)
Adds the given widget to the toolbar as the toolbar&#39;s last item.
Definition: qtoolbar.cpp:973
void removeAction(QAction *action)
Removes the action action from this widget&#39;s list of actions.
Definition: qwidget.cpp:3386
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given element with the provided painter with the style options specified by option...
The QMainWindow class provides a main application window.
Definition: qmainwindow.h:63
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
Definition: qstyle.h:68
QList< QAction * > actions() const
Returns the (possibly empty) list of this widget&#39;s actions.
Definition: qwidget.cpp:3407
void insertAction(QAction *before, QAction *action)
Inserts the action action to this widget&#39;s list of actions, before the action before.
Definition: qwidget.cpp:3342
bool event(QEvent *event)
Reimplemented Function
Definition: qtoolbar.cpp:1180
void startDrag(bool moving=false)
Definition: qtoolbar.cpp:218
void macWindowToolbarShow(const QWidget *widget, bool show)
void initStyleOption(QStyleOptionToolBar *option) const
Definition: qtoolbar.cpp:1374
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
Definition: qsize.h:123
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
quint16 index
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
QObject * parent
Definition: qobject.h:92
void clear()
Removes all actions from the toolbar.
Definition: qtoolbar.cpp:852
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
void createWinId()
Definition: qwidget.cpp:2626
QAction * toggleViewAction
Definition: qtoolbar_p.h:98
bool mousePressEvent(QMouseEvent *e)
Definition: qtoolbar.cpp:274
void movableChanged(bool movable)
This signal is emitted when the toolbar becomes movable or fixed.
QLayout * layout() const
Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed...
Definition: qwidget.cpp:10073
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
ToolButtonStyle
Definition: qnamespace.h:1572
static Qt::MouseButtons mouseButtons()
Returns the current state of the buttons on the mouse.
static bool waitForPopup(QToolBar *tb, QWidget *popup)
Definition: qtoolbar.cpp:1144
QAction * menuAction() const
Returns the action associated with this menu.
Definition: qmenu.cpp:711
Qt::ToolBarArea toolBarArea
This variable holds the location for drawing the toolbar.
Definition: qstyleoption.h:379
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
bool event(QEvent *)
This is the main event handler; it handles event event.
Definition: qwidget.cpp:8636
bool explicitIconSize
Definition: qtoolbar_p.h:89
Qt::ToolButtonStyle toolButtonStyle() const
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
Definition: qrect.h:237
The QPaintEvent class contains event parameters for paint events.
Definition: qevent.h:298
void setSizePolicy(QSizePolicy)
Definition: qwidget.cpp:10198
QAction * addAction(const QString &text)
Creates a new action with the given text.
Definition: qtoolbar.cpp:868
void fixSizeInUnifiedToolbar(QToolBar *tb) const
bool floatable
whether the toolbar can be dragged and dropped as an independent window.
Definition: qtoolbar.h:75
Orientation
Definition: qnamespace.h:174
QToolBarAreaLayout toolBarAreaLayout
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
void setMovable(bool movable)
Definition: qtoolbar.cpp:646
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
const QPoint & globalPos() const
Returns the global position of the mouse cursor at the time of the event.
Definition: qevent.h:96
void _q_updateToolButtonStyle(Qt::ToolButtonStyle style)
Definition: qtoolbar.cpp:145
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90
void resizeEvent(QResizeEvent *event)
Reimplemented Function
Definition: qtoolbar.cpp:1415
QRect actionGeometry(QAction *action) const
Returns the geometry of the toolbar item associated with the given action, or an invalid QRect if no ...
Definition: qtoolbar.cpp:1010
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
Definition: qpainter.cpp:7420
void move(int x, int y)
This corresponds to move(QPoint(x, y)).
Definition: qwidget.h:1011
void updateMarginAndSpacing()
#define text
Definition: qobjectdefs.h:80
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.
Definition: qcursor_mac.mm:310
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
QLayoutItem * unplug(QWidget *widget)
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60