48 #ifndef QT_NO_ACCESSIBILITY 65 #include <private/qaction_p.h> 80 #ifdef QT_SOFTKEYS_ENABLED 81 #include <private/qsoftkeymanager_p.h> 120 return QSize(ext, ext);
130 if(actionRect(
actions.
at(i)).contains(p))
141 QRect result = q->rect();
142 result.
adjust(hmargin, 0, -hmargin, 0);
145 if (q->isRightToLeft())
146 result.
setLeft(result.
left() + extension->sizeHint().width());
148 result.
setWidth(result.
width() - extension->sizeHint().width());
151 if (leftWidget && leftWidget->isVisible()) {
152 QSize sz = leftWidget->sizeHint();
153 if (q->isRightToLeft())
159 if (rightWidget && rightWidget->isVisible()) {
160 QSize sz = rightWidget->sizeHint();
161 if (q->isRightToLeft())
172 return !hiddenActions.contains(action);
184 platformMenuBar->allowCornerWidgets() &&
186 (leftWidget || rightWidget)) {
191 if (leftWidget && leftWidget->isVisible()) {
192 QSize sz = leftWidget->sizeHint();
193 q_width -= sz.
width();
194 q_start = sz.
width();
195 QPoint pos(hmargin, (q->height() - leftWidget->height()) / 2);
197 leftWidget->setGeometry(vRect);
199 if (rightWidget && rightWidget->isVisible()) {
200 QSize sz = rightWidget->sizeHint();
201 q_width -= sz.
width();
204 rightWidget->setGeometry(vRect);
209 if(q->isNativeMenuBar()) {
214 calcActionRects(q_width, q_start);
216 #ifndef QT_NO_SHORTCUT 219 !platformMenuBar->shortcutsHandledByNativeMenuBar() &&
222 for(
int j = 0; j < shortcutIndexMap.size(); ++j)
223 q->releaseShortcut(shortcutIndexMap.value(j));
224 shortcutIndexMap.resize(0);
230 if(q->isNativeMenuBar()) {
237 hiddenActions.clear();
239 QRect menuRect = this->menuRect(
false);
242 bool hasHiddenActions =
false;
246 hasHiddenActions =
true;
252 if (hasHiddenActions) {
253 menuRect = this->menuRect(
true);
262 if (hiddenActions.count() > 0) {
263 QMenu *pop = extension->menu();
266 extension->setMenu(pop);
272 int x = q->isRightToLeft()
273 ? menuRect.
left() - extension->sizeHint().width() + 1
275 extension->setGeometry(x, vmargin, extension->sizeHint().width(), menuRect.
height() - vmargin*2);
283 QMenubarUpdatedEvent menubarUpdated(q);
296 if (index < 0 || index >= actionRects.count())
299 return actionRects.at(index);
307 while (index <
actions.
count() && actionRects.at(index).isNull()) ++index;
324 keyboardFocusWidget = fw;
330 if(keyboardFocusWidget) {
333 keyboardFocusWidget = 0;
342 if(!action || !action->
menu() || closePopupMode)
347 activeMenu = action->
menu();
348 activeMenu->d_func()->causedPopup.widget = q;
349 activeMenu->d_func()->causedPopup.action = action;
351 QRect adjustedActionRect = actionRect(action);
353 QSize popup_size = activeMenu->sizeHint();
359 const bool fitUp = (q->mapToGlobal(adjustedActionRect.
topLeft()).
y() >= popup_size.height());
360 const bool fitDown = (
pos.
y() + popup_size.height() <= screenRect.
bottom());
361 const bool rtl = q->isRightToLeft();
362 const int actionWidth = adjustedActionRect.
width();
364 if (!fitUp && !fitDown) {
365 bool shouldShiftToRight = !rtl;
366 if (rtl && popup_size.width() >
pos.
x())
367 shouldShiftToRight =
true;
368 else if (actionWidth + popup_size.width() +
pos.
x() > screenRect.
right())
369 shouldShiftToRight =
false;
371 if (shouldShiftToRight) {
372 pos.
rx() += actionWidth + (rtl ? popup_size.width() : 0);
376 pos.
rx() -= popup_size.width();
379 pos.
rx() += actionWidth;
382 if(!defaultPopDown || (fitUp && !fitDown))
383 pos.
setY(
qMax(screenRect.
y(), q->mapToGlobal(
QPoint(0, adjustedActionRect.
top()-popup_size.height())).y()));
384 activeMenu->popup(
pos);
386 activeMenu->d_func()->setFirstActionActive();
388 q->update(actionRect(action));
393 if(currentAction == action && popup == popupState)
396 autoReleaseTimer.stop();
398 doChildEffects = (popup && !activeMenu);
411 q->update(actionRect(currentAction));
414 #ifndef QT_NO_STATUSTIP 415 QAction *previousAction = currentAction;
417 currentAction = action;
421 popupAction(action, activateFirst);
422 q->update(actionRect(action));
423 #ifndef QT_NO_STATUSTIP 424 }
else if (previousAction) {
443 actionRects.fill(
QRect());
448 int max_item_height = 0, separator = -1, separator_start = 0, separator_len = 0;
479 q->initStyleOption(&opt, action);
484 int iWidth = sz.
width() + itemSpacing;
486 separator_start += iWidth;
488 separator_len += iWidth;
491 max_item_height =
qMax(max_item_height, sz.
height());
499 int x = fw + ((start == -1) ? hmargin : start) + itemSpacing;
500 int y = fw + vmargin;
510 if(separator != -1 && i >= separator) {
511 int left = (max_width - separator_len - hmargin - itemSpacing) + (x - separator_start - hmargin);
512 if(left < separator_start) {
513 separator_start = x = hmargin;
514 y += max_item_height;
523 x += rect.
width() + itemSpacing;
549 if (
QAction *action = qobject_cast<QAction *>(q->sender())) {
550 emit q->triggered(action);
552 emit q->activated(q->findIdForAction(action));
560 if (
QAction *action = qobject_cast<QAction *>(q->sender())) {
561 emit q->hovered(action);
562 #ifndef QT_NO_ACCESSIBILITY 569 #endif //QT_NO_ACCESSIBILITY 571 emit q->highlighted(q->findIdForAction(action));
585 if (!option || !action)
595 if (
d->currentAction &&
d->currentAction == action) {
597 if (
d->popupState && !
d->closePopupMode)
755 macCreateMenuBar(q->parentWidget());
761 wceCreateMenuBar(q->parentWidget());
771 platformMenuBar->
init(q);
775 oldWindow = oldParent = 0;
777 doAutoResize =
false;
779 #ifdef QT_SOFTKEYS_ENABLED 783 cornerWidgetToolBar = 0;
784 cornerWidgetContainer = 0;
800 const int start = (_start == -1 && increment == -1) ?
actions.
count() : _start;
803 for (
int i = start; i !=
end;) {
806 if (!actionRects.at(i).isNull() && (allowActiveAndDisabled || current->
isEnabled()))
811 return getNextAction(-1, increment);
845 d->macDestroyMenuBar();
850 d->wceDestroyMenuBar();
854 d->symbianDestroyMenuBar();
858 delete d->cornerWidgetToolBar;
991 return d->currentAction;
1005 d->setCurrentAction(act,
true,
false);
1024 for(
int i = 0; i < acts.
size(); i++)
1046 d->defaultPopDown = !b;
1052 return !
d->defaultPopDown;
1061 d->itemsDirty =
true;
1062 d->updateGeometries();
1075 for (
int i = 0; i <
d->actions.count(); ++i) {
1076 QAction *action =
d->actions.at(i);
1077 QRect adjustedActionRect =
d->actionRect(action);
1078 if (adjustedActionRect.
isEmpty() || !
d->isVisible(action))
1083 emptyArea -= adjustedActionRect;
1086 opt.
rect = adjustedActionRect;
1098 emptyArea -= borderReg;
1125 d->platformMenuBar->setVisible(visible);
1127 #if defined(Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60) 1149 d->mouseDown =
true;
1152 if (!action || !
d->isVisible(action)) {
1153 d->setCurrentAction(0);
1154 #ifndef QT_NO_WHATSTHIS 1161 if(
d->currentAction == action &&
d->popupState) {
1162 if(
QMenu *menu =
d->activeMenu) {
1168 update(
d->actionRect(action));
1171 d->setCurrentAction(action,
true);
1184 d->mouseDown =
false;
1186 if((
d->closePopupMode && action ==
d->currentAction) || !action || !action->
menu()) {
1189 d->setCurrentAction(action,
false);
1193 d->closePopupMode = 0;
1202 d->updateGeometries();
1215 bool key_consumed =
false;
1224 if(
d->currentAction->menu()) {
1225 d->popupAction(
d->currentAction,
true);
1228 d->setCurrentAction(
d->currentAction,
false);
1229 d->setKeyboardMode(
false);
1231 key_consumed =
true;
1236 if(
d->currentAction) {
1237 int index =
d->actions.indexOf(
d->currentAction);
1239 d->setCurrentAction(nextAction,
d->popupState,
true);
1240 key_consumed =
true;
1246 d->setCurrentAction(0);
1247 d->setKeyboardMode(
false);
1248 key_consumed =
true;
1252 key_consumed =
false;
1259 QAction *first = 0, *currentSelected = 0, *firstAfterCurrent = 0;
1262 for(
int i = 0; i <
d->actions.size(); ++i) {
1263 if (
d->actionRects.at(i).isNull())
1269 if(ampersand >= 0) {
1270 if(s[ampersand+1].toUpper() == c) {
1274 if(act ==
d->currentAction)
1275 currentSelected = act;
1276 else if (!firstAfterCurrent && currentSelected)
1277 firstAfterCurrent = act;
1284 if(clashCount >= 1) {
1285 if(clashCount == 1 || !
d->currentAction || (currentSelected && !firstAfterCurrent))
1286 next_action = first;
1288 next_action = firstAfterCurrent;
1291 key_consumed =
true;
1292 d->setCurrentAction(next_action,
true,
true);
1308 d->mouseDown =
false;
1309 bool popupState =
d->popupState ||
d->mouseDown;
1311 if ((action &&
d->isVisible(action)) || !popupState)
1312 d->setCurrentAction(action, popupState);
1322 (
d->currentAction &&
d->currentAction->menu() == 0))
1323 d->setCurrentAction(0);
1332 d->itemsDirty =
true;
1334 d->platformMenuBar->actionEvent(e);
1336 #if defined (Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60) 1340 #elif defined(Q_WS_S60) 1341 QMenuBarPrivate::QSymbianMenuBarPrivate *nativeMenuBar =
d->symbian_menubar;
1363 d->updateGeometries();
1374 if(
d->keyboardState)
1375 d->focusFirstAction();
1384 if(!
d->popupState) {
1385 d->setCurrentAction(0);
1386 d->setKeyboardMode(
false);
1396 if (e->
timerId() ==
d->autoReleaseTimer.timerId()) {
1397 d->autoReleaseTimer.stop();
1398 d->setCurrentAction(0);
1412 if (oldParent != newParent) {
1422 if (oldWindow != newWindow) {
1423 if (oldParent && oldParent != oldWindow)
1426 if (newParent && newParent != newWindow)
1431 platformMenuBar->handleReparent(oldParent, newParent, oldWindow, newWindow);
1434 oldParent = newParent;
1435 oldWindow = newWindow;
1438 if (q->isNativeMenuBar() && !macWidgetHasNativeMenubar(newParent)) {
1442 macDestroyMenuBar();
1443 macCreateMenuBar(newParent);
1449 wce_menubar->rebuild();
1455 if (!symbian_menubar)
1456 symbianCreateMenuBar(newParent);
1459 if (symbian_menubar) {
1460 if (oldParent != newParent)
1461 reparentMenuBar(oldParent, newParent);
1463 symbian_menubar->rebuild();
1466 #ifdef QT_SOFTKEYS_ENABLED 1468 if (!menuBarAction) {
1477 oldParent->removeAction(menuBarAction);
1481 #endif // QT_SOFTKEYS_ENABLED 1495 void QMenuBar::setAutoGeometry(
bool b)
1498 d->doAutoResize = b;
1510 bool QMenuBar::autoGeometry()
const 1513 return d->doAutoResize;
1524 d->itemsDirty =
true;
1528 d->updateGeometries();
1530 d->handleReparent();
1533 d->itemsDirty =
true;
1534 d->updateGeometries();
1535 #ifdef QT_SOFTKEYS_ENABLED 1537 if (
d->menuBarAction)
1551 switch (e->
type()) {
1555 if(!
d->keyboardState) {
1556 d->setCurrentAction(0);
1566 #ifndef QT_NO_SHORTCUT 1570 for(
int j = 0; j <
d->shortcutIndexMap.size(); ++j) {
1571 if (shortcutId ==
d->shortcutIndexMap.value(j))
1572 d->_q_internalShortcutActivated(j);
1580 if (!
d->itemsDirty) {
1581 QMenubarUpdatedEvent menubarUpdated(
this);
1586 d->_q_updateLayout();
1601 QMenubarUpdatedEvent menubarUpdated(
this);
1607 #ifndef QT_NO_WHATSTHIS 1610 if (
QAction *action =
d->actionAt(static_cast<QHelpEvent*>(e)->pos())) {
1611 if (action->whatsThis().size() || action->menu())
1617 d->_q_updateLayout();
1632 if (
d->platformMenuBar->menuBarEventFilter(
object, event)) {
1636 if (
object ==
parent() && object) {
1646 d->handleReparent();
1648 if (
object ==
d->leftWidget ||
object ==
d->rightWidget) {
1649 switch (event->
type()) {
1652 d->_q_updateLayout();
1660 if (
d->altPressed) {
1661 switch (event->
type()) {
1669 d->setKeyboardMode(!
d->keyboardState);
1679 d->altPressed =
false;
1680 qApp->removeEventFilter(
this);
1690 d->altPressed =
true;
1691 qApp->installEventFilter(
this);
1709 return d->actionAt(pt);
1720 return d->actionRect(act);
1729 #if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11) 1732 const bool as_gui_menubar =
true;
1742 if(as_gui_menubar) {
1744 d->calcActionRects(w - (2 * fw), 0);
1745 for (
int i = 0; ret.
isNull() && i <
d->actions.count(); ++i)
1746 ret =
d->actionRects.at(i).size();
1747 if (!
d->extension->isHidden())
1748 ret +=
QSize(
d->extension->sizeHint().width(), 0);
1749 ret +=
QSize(2*fw + hmargin, 2*fw + vmargin);
1751 int margin = 2*vmargin + 2*fw + spaceBelowMenuBar;
1753 if (
d->platformMenuBar->allowCornerWidgets()) {
1756 QSize sz =
d->leftWidget->minimumSizeHint();
1761 if(
d->rightWidget) {
1762 QSize sz =
d->rightWidget->minimumSizeHint();
1770 if(as_gui_menubar) {
1791 #if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11) 1794 const bool as_gui_menubar =
true;
1805 if(as_gui_menubar) {
1807 d->calcActionRects(w - (2 * fw), 0);
1808 for (
int i = 0; i <
d->actionRects.count(); ++i) {
1809 const QRect &actionRect =
d->actionRects.at(i);
1814 ret +=
QSize(fw + hmargin, fw + vmargin);
1816 int margin = 2*vmargin + 2*fw + spaceBelowMenuBar;
1818 if(
d->platformMenuBar->allowCornerWidgets()) {
1821 QSize sz =
d->leftWidget->sizeHint();
1826 if(
d->rightWidget) {
1827 QSize sz =
d->rightWidget->sizeHint();
1835 if(as_gui_menubar) {
1856 #if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11) 1859 const bool as_gui_menubar =
true;
1867 if(as_gui_menubar) {
1868 for (
int i = 0; i <
d->actionRects.count(); ++i)
1869 height =
qMax(height,
d->actionRects.at(i).height());
1871 height += spaceBelowMenuBar;
1873 height += 2*vmargin;
1875 int margin = 2*vmargin + 2*fw + spaceBelowMenuBar;
1877 if(
d->platformMenuBar->allowCornerWidgets()) {
1880 height =
qMax(
d->leftWidget->sizeHint().height() + margin,
height);
1882 height =
qMax(
d->rightWidget->sizeHint().height() + margin,
height);
1886 if(as_gui_menubar) {
1906 if (q->isNativeMenuBar()) {
1907 platformMenuBar->popupAction(act);
1910 setCurrentAction(act,
true,
true);
1914 if (act && !act->
menu()) {
1917 autoReleaseTimer.start(100, q);
1920 setKeyboardMode(
true);
1928 if (q->isVisible()) {
1938 if (!cornerWidgetToolBar) {
1941 qWarning() <<
"Menubar parent is not a QMainWindow, not showing corner widgets";
1945 cornerWidgetToolBar->setObjectName(
QLatin1String(
"CornerToolBar"));
1946 cornerWidgetContainer =
new QWidget;
1947 cornerWidgetToolBar->addWidget(cornerWidgetContainer);
1951 while (layout->
count() > 0) {
1956 leftWidget->setParent(cornerWidgetContainer);
1960 rightWidget->setParent(cornerWidgetContainer);
1961 cornerWidgetContainer->layout()->addWidget(rightWidget);
1986 d->leftWidget->removeEventFilter(
this);
1991 d->rightWidget->removeEventFilter(
this);
1995 qWarning(
"QMenuBar::setCornerWidget: Only TopLeftCorner and TopRightCorner are supported");
2000 if(!
d->platformMenuBar->allowCornerWidgets()) {
2001 d->updateCornerWidgetToolBar();
2012 d->_q_updateLayout();
2034 qWarning(
"QMenuBar::cornerWidget: Only TopLeftCorner and TopRightCorner are supported");
2066 d->platformMenuBar->setNativeMenuBar(nativeMenuBar);
2068 if (
d->nativeMenuBar == -1 || (nativeMenuBar !=
bool(
d->nativeMenuBar))) {
2071 if (!
d->nativeMenuBar) {
2074 d->macDestroyMenuBar();
2076 for (
int i = 0; i < menubarActions.
size(); ++i) {
2077 const QAction *action = menubarActions.
at(i);
2079 delete menu->d_func()->mac_menu;
2080 menu->d_func()->mac_menu = 0;
2099 return d->platformMenuBar->isNativeMenuBar();
2101 if (
d->nativeMenuBar == -1) {
2104 return d->nativeMenuBar;
2129 if (
d->defaultAction == act)
2133 if (
d->defaultAction) {
2138 d->defaultAction = act;
2141 if (
d->defaultAction) {
2145 if (
d->wce_menubar) {
2146 d->wce_menubar->rebuild();
2163 return d_func()->defaultAction;
2201 int QMenuBar::frameWidth()
const 2211 static_cast<QMenuItem*
>(act)->setId(
id);
2218 if(receiver && member)
2220 if(index == -1 || index >=
actions().count())
2224 return findIdForAction(act);
2245 if(index == -1 || index >=
actions().count())
2249 return findIdForAction(act);
2255 bool QMenuBar::setItemParameter(
int id,
int param)
2257 if(
QAction *act = findActionForId(
id)) {
2258 act->d_func()->param = param;
2267 int QMenuBar::itemParameter(
int id)
const 2269 if(
QAction *act = findActionForId(
id))
2270 return act->d_func()->param;
2274 QAction *QMenuBar::findActionForId(
int id)
const 2277 for (
int i = 0; i < list.
size(); ++i) {
2279 if (findIdForAction(act) ==
id)
2285 int QMenuBar::findIdForAction(
QAction *act)
const 2288 return act->d_func()->id;
2766 #include <moc_qmenubar.cpp> 2768 #endif // QT_NO_MENUBAR bool isSeparator() const
Returns true if this action is a separator action; otherwise it returns false.
The QPainter class performs low-level painting on widgets and other paint devices.
QAction * before() const
If type() is ActionAdded , returns the action that should appear before action(). ...
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object's accessibility information.
The QKeyEvent class describes a key event.
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
void setShortcut(const QKeySequence &shortcut)
void setHeight(int h)
Sets the height of the rectangle to the given height.
static QString standardSoftKeyText(StandardSoftKey standardKey)
The QFontMetrics class provides font metrics information.
#define QT_END_NAMESPACE
This macro expands to.
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
void moveLeft(int pos)
Moves the rectangle horizontally, leaving the rectangle's left edge at the given x coordinate...
bool showStatusText(QWidget *widget=0)
Updates the relevant status bar for the widget specified by sending a QStatusTipEvent to its parent w...
void activate(ActionEvent event)
Sends the relevant signals for ActionEvent event.
void setSeparator(bool b)
If b is true then this action will be considered a separator.
QStyle::State state
the style flags that are used when drawing the control
ActionEvent
This enum type is used when calling QAction::activate()
static QSize globalStrut()
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
static QKeySequence mnemonic(const QString &text)
Returns the shortcut key sequence for the mnemonic in text, or an empty key sequence if no mnemonics ...
void setClipRect(const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip region to the given rectangle using the given clip operation...
int length() const
Returns the number of characters in this string.
void setAccepted(bool accepted)
static void setAttribute(Qt::ApplicationAttribute attribute, bool on=true)
Sets the attribute attribute if on is true; otherwise clears the attribute.
QString toUpper() const Q_REQUIRED_RESULT
Returns an uppercase copy of the string.
QString text
the action's descriptive text
void removeEventFilter(QObject *)
Removes an event filter object obj from this object.
virtual void timerEvent(QTimerEvent *)
This event handler can be reimplemented in a subclass to receive timer events for the object...
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
The QShortcutEvent class provides an event which is generated when the user presses a key combination...
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
int left() const
Returns the x-coordinate of the rectangle's left edge.
int width() const
Returns the width of the rectangle.
void init(const QWidget *w)
Use initFrom(widget) instead.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int count(const T &t) const
Returns the number of occurrences of value in the list.
The QActionEvent class provides an event that is generated when a QAction is added, removed, or changed.
int height() const
Returns the height of the rectangle.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
QFontMetrics fontMetrics
the font metrics that should be used when drawing text in the control
void setHeight(int h)
Sets the height to the given height.
T * qobject_cast(QObject *object)
The QObject class is the base class of all Qt objects.
The QChar class provides a 16-bit Unicode character.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
static QString translate(const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr)
void setObjectName(const QString &name)
void setWidth(int w)
Sets the width to the given width.
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
void setCurrentColorGroup(ColorGroup cg)
Set the palette's current color group to cg.
int key() const
Returns the code of the key that was pressed or released.
int lineWidth
the line width for drawing the frame
int width() const
Returns the width.
virtual QLayoutItem * takeAt(int index)=0
Must be implemented in subclasses to remove the layout item at index from the layout, and return the item.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void destroyed(QObject *=0)
This signal is emitted immediately before the object obj is destroyed, and can not be blocked...
QSize size(int flags, const QString &str, int tabstops=0, int *tabarray=0) const
Returns the size in pixels of text.
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...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
The QLayout class is the base class of geometry managers.
const T & at(int i) const
Returns the item at index position i in the list.
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
void setRight(int pos)
Sets the right edge of the rectangle to the given x coordinate.
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.
const char * styleHint(const QFontDef &request)
Q_CORE_EXPORT void qWarning(const char *,...)
QIcon icon
the action's icon
int & rx()
Returns a reference to the x coordinate of this point.
void setText(const QString &text)
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
The QStyleOptionFrame class is used to describe the parameters for drawing a frame.
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QAction * action() const
Returns the action that is changed, added, or removed.
static bool inWhatsThisMode()
Returns true if the user interface is in "What's This?" mode; otherwise returns false.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QRegion class specifies a clip region for a painter.
Qt::MouseButton button() const
Returns the button that caused the event.
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
static bool isActive()
Returns true if an accessibility implementation has been requested during the runtime of the applicat...
The QMouseEvent class contains parameters that describe a mouse event.
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w=0) const =0
Returns the size of the element described by the specified option and type, based on the provided con...
static QAction * createAction(StandardSoftKey standardKey, QWidget *actionWidget)
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
QPalette palette
the palette that should be used when painting the control
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
int shortcutId()
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setY(int y)
Sets the y coordinate of this point to the given y coordinate.
QMenu * menu() const
Returns the menu contained by this action.
int top() const
Returns the y-coordinate of the rectangle's top edge.
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction...
The QKeySequence class encapsulates a key sequence as used by shortcuts.
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
int right() const
Returns the x-coordinate of the rectangle's right edge.
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
void addToolBar(Qt::ToolBarArea area, QToolBar *toolbar)
Adds the toolbar into the specified area in this main window.
The QTimerEvent class contains parameters that describe a timer event.
void setLeft(int pos)
Sets the left edge of the rectangle to the given x coordinate.
virtual int count() const =0
Must be implemented in subclasses to return the number of items in the layout.
static QCoreApplication * instance()
Returns a pointer to the application's QCoreApplication (or QApplication) instance.
int y() const
Returns the y-coordinate of the rectangle's top edge.
void addWidget(QWidget *w)
Adds widget w to this layout in a manner specific to the layout.
QString text() const
Returns the Unicode text that this key generated.
The QStatusTipEvent class provides an event that is used to show messages in a status bar...
const QSize & size() const
Returns the new size of the widget.
virtual QLayout * layout()
If this item is a QLayout, it is returned as a QLayout; otherwise 0 is returned.
int midLineWidth
the mid-line width for drawing the frame
int x() const
Returns the x-coordinate of the rectangle's left edge.
QObject * parent() const
Returns a pointer to the parent object.
The QPoint class defines a point in the plane using integer precision.
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
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.
int size() const
Returns the number of items in the list.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
void setWidth(int w)
Sets the width of the rectangle to the given width.
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
void setIcon(const QIcon &icon)
The QHBoxLayout class lines up widgets horizontally.
int y() const
Returns the y coordinate of this point.
return(isPopup||isToolTip)
bool isNull() const
Returns true if both the width and height is 0; otherwise returns false.
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget...
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
The QSize class defines the size of a two-dimensional object using integer point precision.
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
int x() const
Returns the x coordinate of this point.
static bool testAttribute(Qt::ApplicationAttribute attribute)
Returns true if attribute attribute is set; otherwise returns false.
void moveTop(int pos)
Moves the rectangle vertically, leaving the rectangle's top edge at the given y coordinate.
bool isEmpty() const
Returns true if either of the width and height is less than or equal to 0; otherwise returns false...
void drawComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex &opt)
Use the widget's style to draw a complex control cc specified by the QStyleOptionComplex option...
QLayout * layout()
Reimplemented Function
const QRect & rect() const
Returns the rectangle that needs to be updated.
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
static void showText(const QPoint &pos, const QString &text, QWidget *w=0)
Shows text as a "What's This?" window, at global position pos.
The QPaintEvent class contains event parameters for paint events.
static const KeyPair *const end
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
const QPoint & globalPos() const
Returns the global position of the mouse cursor at the time of the event.
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or 0 if no widget in this applicati...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QRect rect
the area that should be used for various calculations and painting
The QFocusEvent class contains event parameters for widget focus events.
The QAction class provides an abstract user interface action that can be inserted into widgets...
The QList class is a template class that provides lists.
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
The QIcon class provides scalable icons in different modes and states.