Qt 4.8
Macros | Functions
qtoolbar.cpp File Reference
#include "qtoolbar.h"
#include <qapplication.h>
#include <qcombobox.h>
#include <qevent.h>
#include <qlayout.h>
#include <qmainwindow.h>
#include <qmenu.h>
#include <qmenubar.h>
#include <qrubberband.h>
#include <qsignalmapper.h>
#include <qstylepainter.h>
#include <qtoolbutton.h>
#include <qwidgetaction.h>
#include <qtimer.h>
#include <private/qwidgetaction_p.h>
#include <private/qt_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
#include <private/qmainwindowlayout_p.h>
#include "qtoolbar_p.h"
#include "qtoolbarseparator_p.h"
#include "qtoolbarlayout_p.h"
#include "qdebug.h"
#include "moc_qtoolbar.cpp"

Go to the source code of this file.

Macros

#define POPUP_TIMER_INTERVAL   500
 

Functions

static void qt_mac_updateToolBarButtonHint (QWidget *parentWidget)
 
QMainWindowLayoutqt_mainwindow_layout (const QMainWindow *window)
 
static bool toolbarInUnifiedToolBar (QToolBar *toolbar)
 
static bool waitForPopup (QToolBar *tb, QWidget *popup)
 

Macro Definition Documentation

◆ POPUP_TIMER_INTERVAL

#define POPUP_TIMER_INTERVAL   500

Definition at line 73 of file qtoolbar.cpp.

Referenced by QToolBar::event().

Function Documentation

◆ qt_mac_updateToolBarButtonHint()

static void qt_mac_updateToolBarButtonHint ( QWidget parentWidget)
static

Definition at line 78 of file qtoolbar.cpp.

Referenced by QToolBar::event(), and QToolBarPrivate::init().

79 {
80  if (!(parentWidget->windowFlags() & Qt::CustomizeWindowHint))
81  parentWidget->setWindowFlags(parentWidget->windowFlags() | Qt::MacWindowToolBarButtonHint);
82 }
void setWindowFlags(Qt::WindowFlags type)
Definition: qwidget.cpp:10399
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939

◆ qt_mainwindow_layout()

QMainWindowLayout* qt_mainwindow_layout ( const QMainWindow window)

◆ toolbarInUnifiedToolBar()

static bool toolbarInUnifiedToolBar ( QToolBar toolbar)
static

Definition at line 1171 of file qtoolbar.cpp.

Referenced by QToolBar::event().

1172 {
1173  const QMainWindow *mainWindow = qobject_cast<const QMainWindow *>(toolbar->parentWidget());
1174  return mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()
1175  && mainWindow->toolBarArea(toolbar) == Qt::TopToolBarArea;
1176 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
T * qobject_cast(QObject *object)
Definition: qobject.h:375
Qt::ToolBarArea toolBarArea(QToolBar *toolbar) const
Returns the Qt::ToolBarArea for toolbar.
bool unifiedTitleAndToolBarOnMac
whether the window uses the unified title and toolbar look on Mac OS X
Definition: qmainwindow.h:83
The QMainWindow class provides a main application window.
Definition: qmainwindow.h:63

◆ waitForPopup()

static bool waitForPopup ( QToolBar tb,
QWidget popup 
)
static

Definition at line 1144 of file qtoolbar.cpp.

Referenced by QToolBar::event().

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 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
T * qobject_cast(QObject *object)
Definition: qobject.h:375
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
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus...
Definition: qmenu.h:72
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
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64