Convert features.menubar to QT_[REQUIRE_]CONFIG
Change-Id: Idbd4978852fa280dd18a5684469d499da3892126 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>bb10
parent
b649717784
commit
314a591461
|
|
@ -40,7 +40,9 @@
|
|||
#include "qaccessiblemenu_p.h"
|
||||
|
||||
#include <qmenu.h>
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <qmenubar.h>
|
||||
#endif
|
||||
#include <QtWidgets/QAction>
|
||||
#include <qstyle.h>
|
||||
|
||||
|
|
@ -139,7 +141,7 @@ int QAccessibleMenu::indexOfChild( const QAccessibleInterface *child) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
QAccessibleMenuBar::QAccessibleMenuBar(QWidget *w)
|
||||
: QAccessibleWidget(w, QAccessible::MenuBar)
|
||||
{
|
||||
|
|
@ -173,7 +175,7 @@ int QAccessibleMenuBar::indexOfChild(const QAccessibleInterface *child) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
#endif // QT_NO_MENUBAR
|
||||
#endif // QT_CONFIG(menubar)
|
||||
|
||||
QAccessibleMenuItem::QAccessibleMenuItem(QWidget *owner, QAction *action)
|
||||
: m_action(action), m_owner(owner)
|
||||
|
|
@ -253,13 +255,13 @@ QRect QAccessibleMenuItem::rect() const
|
|||
{
|
||||
QRect rect;
|
||||
QWidget *own = owner();
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(own)) {
|
||||
rect = menuBar->actionGeometry(m_action);
|
||||
QPoint globalPos = menuBar->mapToGlobal(QPoint(0,0));
|
||||
rect = rect.translated(globalPos);
|
||||
} else
|
||||
#endif // QT_NO_MENUBAR
|
||||
#endif // QT_CONFIG(menubar)
|
||||
if (QMenu *menu = qobject_cast<QMenu*>(own)) {
|
||||
rect = menu->actionGeometry(m_action);
|
||||
QPoint globalPos = menu->mapToGlobal(QPoint(0,0));
|
||||
|
|
@ -289,7 +291,7 @@ QAccessible::State QAccessibleMenuItem::state() const
|
|||
if (QMenu *menu = qobject_cast<QMenu*>(own)) {
|
||||
if (menu->activeAction() == m_action)
|
||||
s.focused = true;
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
} else if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(own)) {
|
||||
if (menuBar->activeAction() == m_action)
|
||||
s.focused = true;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ protected:
|
|||
QMenu *menu() const;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
class QAccessibleMenuBar : public QAccessibleWidget
|
||||
{
|
||||
public:
|
||||
|
|
@ -96,7 +96,7 @@ public:
|
|||
protected:
|
||||
QMenuBar *menuBar() const;
|
||||
};
|
||||
#endif // QT_NO_MENUBAR
|
||||
#endif // QT_CONFIG(menubar)
|
||||
|
||||
|
||||
class QAccessibleMenuItem : public QAccessibleInterface, public QAccessibleActionInterface
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
|
|||
#endif
|
||||
} else if (classname == QLatin1String("QToolBar")) {
|
||||
iface = new QAccessibleWidget(widget, QAccessible::ToolBar, widget->windowTitle());
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
} else if (classname == QLatin1String("QMenuBar")) {
|
||||
iface = new QAccessibleMenuBar(widget);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -41,7 +41,9 @@
|
|||
|
||||
#include "qapplication.h"
|
||||
#include "qlayoutengine_p.h"
|
||||
#if QT_CONFIG(menubar)
|
||||
#include "qmenubar.h"
|
||||
#endif
|
||||
#include "qtoolbar.h"
|
||||
#include "qsizegrip.h"
|
||||
#include "qevent.h"
|
||||
|
|
@ -583,7 +585,7 @@ void QLayoutPrivate::doResize(const QSize &r)
|
|||
const int mbTop = rect.top();
|
||||
rect.setTop(mbTop + mbh);
|
||||
q->setGeometry(rect);
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (menubar)
|
||||
menubar->setGeometry(rect.left(), mbTop, r.width(), mbh);
|
||||
#endif
|
||||
|
|
@ -615,7 +617,7 @@ void QLayout::widgetEvent(QEvent *e)
|
|||
{
|
||||
QChildEvent *c = (QChildEvent *)e;
|
||||
if (c->child()->isWidgetType()) {
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (c->child() == d->menubar)
|
||||
d->menubar = 0;
|
||||
#endif
|
||||
|
|
@ -664,7 +666,7 @@ int QLayout::totalHeightForWidth(int w) const
|
|||
top += wd->topmargin + wd->bottommargin;
|
||||
}
|
||||
int h = heightForWidth(w - side) + top;
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
h += menuBarHeightForWidth(d->menubar, w);
|
||||
#endif
|
||||
return h;
|
||||
|
|
@ -687,7 +689,7 @@ QSize QLayout::totalMinimumSize() const
|
|||
}
|
||||
|
||||
QSize s = minimumSize();
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
top += menuBarHeightForWidth(d->menubar, s.width() + side);
|
||||
#endif
|
||||
return s + QSize(side, top);
|
||||
|
|
@ -712,7 +714,7 @@ QSize QLayout::totalSizeHint() const
|
|||
QSize s = sizeHint();
|
||||
if (hasHeightForWidth())
|
||||
s.setHeight(heightForWidth(s.width() + side));
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
top += menuBarHeightForWidth(d->menubar, s.width());
|
||||
#endif
|
||||
return s + QSize(side, top);
|
||||
|
|
@ -735,7 +737,7 @@ QSize QLayout::totalMaximumSize() const
|
|||
}
|
||||
|
||||
QSize s = maximumSize();
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
top += menuBarHeightForWidth(d->menubar, s.width());
|
||||
#endif
|
||||
|
||||
|
|
@ -813,7 +815,7 @@ void QLayoutPrivate::reparentChildWidgets(QWidget *mw)
|
|||
Q_Q(QLayout);
|
||||
int n = q->count();
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (menubar && menubar->parentWidget() != mw) {
|
||||
menubar->setParent(mw);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,9 @@
|
|||
|
||||
#include "qapplication.h"
|
||||
#include "qlayoutengine_p.h"
|
||||
#if QT_CONFIG(menubar)
|
||||
#include "qmenubar.h"
|
||||
#endif
|
||||
#include "qtoolbar.h"
|
||||
#include "qevent.h"
|
||||
#include "qstyle.h"
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@
|
|||
#include <qwhatsthis.h>
|
||||
#endif
|
||||
#include <qmenu.h>
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <qmenubar.h>
|
||||
#endif
|
||||
#include <qapplication.h>
|
||||
#include <private/qapplication_p.h>
|
||||
#include <private/qshortcutmap_p.h>
|
||||
|
|
@ -143,7 +145,7 @@ bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context)
|
|||
static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidget *active_window)
|
||||
{
|
||||
bool visible = w->isVisible();
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (QMenuBar *menuBar = qobject_cast<QMenuBar *>(w)) {
|
||||
if (menuBar->isNativeMenuBar())
|
||||
visible = true;
|
||||
|
|
@ -208,7 +210,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge
|
|||
static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window)
|
||||
{
|
||||
bool visible = w->isVisible();
|
||||
#if defined(Q_OS_DARWIN) && !defined(QT_NO_MENUBAR)
|
||||
#if defined(Q_OS_DARWIN) && QT_CONFIG(menubar)
|
||||
if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w))
|
||||
visible = true;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1392,7 +1392,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
|
|||
opt->rect.x() + opt->rect.width() - 4, opt->rect.y() + opt->rect.height() / 2);
|
||||
break;
|
||||
#endif // QT_NO_MENU
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
case CE_MenuBarItem:
|
||||
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
|
||||
uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip
|
||||
|
|
@ -1412,7 +1412,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
|
|||
if (widget && !widget->testAttribute(Qt::WA_NoSystemBackground))
|
||||
p->eraseRect(opt->rect);
|
||||
break;
|
||||
#endif // QT_NO_MENUBAR
|
||||
#endif // QT_CONFIG(menubar)
|
||||
#if QT_CONFIG(progressbar)
|
||||
case CE_ProgressBar:
|
||||
if (const QStyleOptionProgressBar *pb
|
||||
|
|
|
|||
|
|
@ -76,7 +76,9 @@
|
|||
#include <qlineedit.h>
|
||||
#include <qmainwindow.h>
|
||||
#include <qmdisubwindow.h>
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <qmenubar.h>
|
||||
#endif
|
||||
#include <qpaintdevice.h>
|
||||
#include <qpainter.h>
|
||||
#include <qpixmapcache.h>
|
||||
|
|
@ -677,7 +679,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
|
|||
#endif
|
||||
else if (qobject_cast<const QHeaderView *>(widg))
|
||||
ct = QStyle::CT_HeaderSection;
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
else if (qobject_cast<const QMenuBar *>(widg))
|
||||
ct = QStyle::CT_MenuBar;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -80,7 +80,9 @@
|
|||
#endif
|
||||
#include <qmainwindow.h>
|
||||
#include <qmap.h>
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <qmenubar.h>
|
||||
#endif
|
||||
#include <qpaintdevice.h>
|
||||
#include <qpainter.h>
|
||||
#include <qpixmapcache.h>
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@
|
|||
#include <qdebug.h>
|
||||
#include <qapplication.h>
|
||||
#include <qmenu.h>
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <qmenubar.h>
|
||||
#endif
|
||||
#include <qpainter.h>
|
||||
#include <qstyleoption.h>
|
||||
#include <qlineedit.h>
|
||||
|
|
@ -1660,7 +1662,7 @@ int QStyleSheetStyle::nativeFrameWidth(const QWidget *w)
|
|||
return base->pixelMetric(QStyle::PM_MenuPanelWidth, 0, w);
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (qobject_cast<const QMenuBar *>(w))
|
||||
return base->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, w);
|
||||
#endif
|
||||
|
|
@ -2829,7 +2831,7 @@ void QStyleSheetStyle::polish(QWidget *w)
|
|||
#ifndef QT_NO_MDIAREA
|
||||
|| qobject_cast<QMdiSubWindow *>(w)
|
||||
#endif
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
|| qobject_cast<QMenuBar *>(w)
|
||||
#endif
|
||||
#if QT_CONFIG(dialog)
|
||||
|
|
|
|||
|
|
@ -47,8 +47,10 @@
|
|||
#include "qdrawutil.h" // for now
|
||||
#include "qevent.h"
|
||||
#include "qmenu.h"
|
||||
#if QT_CONFIG(menubar)
|
||||
#include "qmenubar.h"
|
||||
#include <private/qmenubar_p.h>
|
||||
#endif
|
||||
#include "qpaintengine.h"
|
||||
#include "qpainter.h"
|
||||
#if QT_CONFIG(rubberband)
|
||||
|
|
@ -166,7 +168,7 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e)
|
|||
|
||||
// Update state and repaint the menu bars.
|
||||
d->alt_down = false;
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
QList<QMenuBar *> l = widget->findChildren<QMenuBar *>();
|
||||
for (int i = 0; i < l.size(); ++i)
|
||||
l.at(i)->update();
|
||||
|
|
@ -574,7 +576,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
|
|||
// Do nothing if we always paint underlines
|
||||
Q_D(const QWindowsStyle);
|
||||
if (!ret && widget && d) {
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
const QMenuBar *menuBar = qobject_cast<const QMenuBar *>(widget);
|
||||
if (!menuBar && qobject_cast<const QMenu *>(widget)) {
|
||||
QWidget *w = QApplication::activeWindow();
|
||||
|
|
@ -587,7 +589,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
|
|||
ret = 1;
|
||||
// Otherwise draw underlines if the toplevel widget has seen an alt-press
|
||||
} else
|
||||
#endif // QT_NO_MENUBAR
|
||||
#endif // QT_CONFIG(menubar)
|
||||
if (d->hasSeenAlt(widget)) {
|
||||
ret = 1;
|
||||
}
|
||||
|
|
@ -1260,7 +1262,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
|
|||
}
|
||||
break;
|
||||
#endif // QT_NO_MENU
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
case CE_MenuBarItem:
|
||||
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
|
||||
bool active = mbi->state & State_Selected;
|
||||
|
|
@ -1284,7 +1286,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
|
|||
QCommonStyle::drawControl(ce, &newMbi, p, widget);
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_MENUBAR
|
||||
#endif // QT_CONFIG(menubar)
|
||||
#if QT_CONFIG(tabbar)
|
||||
case CE_TabBarTabShape:
|
||||
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
|
||||
|
|
@ -2392,7 +2394,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
|
|||
}
|
||||
break;
|
||||
#endif // QT_NO_MENU
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
case CT_MenuBarItem:
|
||||
if (!sz.isEmpty())
|
||||
sz += QSize(QWindowsStylePrivate::windowsItemHMargin * 4, QWindowsStylePrivate::windowsItemVMargin * 2);
|
||||
|
|
|
|||
|
|
@ -1871,7 +1871,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption
|
|||
sz.setHeight(minimumHeight);
|
||||
}
|
||||
return sz;
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
case CT_MenuBarItem:
|
||||
if (!sz.isEmpty())
|
||||
sz += QSize(windowsItemHMargin * 5 + 1, 5);
|
||||
|
|
|
|||
|
|
@ -3661,7 +3661,7 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt
|
|||
case CT_Menu:
|
||||
sz += QSize(1, 0);
|
||||
break;
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
case CT_MenuBarItem:
|
||||
if (!sz.isEmpty())
|
||||
sz += QSize(windowsItemHMargin * 5 + 1, 6);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,10 @@
|
|||
#include "qtoolbar.h"
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qmenu.h>
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <qmenubar.h>
|
||||
#endif
|
||||
#if QT_CONFIG(statusbar)
|
||||
#include <qstatusbar.h>
|
||||
#endif
|
||||
|
|
@ -520,7 +523,7 @@ void QMainWindow::setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle)
|
|||
emit toolButtonStyleChanged(d->toolButtonStyle);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
/*!
|
||||
Returns the menu bar for the main window. This function creates
|
||||
and returns an empty menu bar if the menu bar does not exist.
|
||||
|
|
@ -607,7 +610,7 @@ void QMainWindow::setMenuWidget(QWidget *menuBar)
|
|||
}
|
||||
d->layout->setMenuBar(menuBar);
|
||||
}
|
||||
#endif // QT_NO_MENUBAR
|
||||
#endif // QT_CONFIG(menubar)
|
||||
|
||||
#if QT_CONFIG(statusbar)
|
||||
/*!
|
||||
|
|
@ -1663,7 +1666,7 @@ void QMainWindow::contextMenuEvent(QContextMenuEvent *event)
|
|||
// children and for the menu bar as well
|
||||
QWidget *child = childAt(event->pos());
|
||||
while (child && child != this) {
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (QMenuBar *mb = qobject_cast<QMenuBar *>(child)) {
|
||||
if (mb->parentWidget() != this)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public:
|
|||
|
||||
bool isSeparator(const QPoint &pos) const;
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
QMenuBar *menuBar() const;
|
||||
void setMenuBar(QMenuBar *menubar);
|
||||
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@
|
|||
#include <QDesktopWidget>
|
||||
#include <QDebug>
|
||||
#include <qmath.h>
|
||||
#include <qmenu.h>
|
||||
#include <private/qlayoutengine_p.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@
|
|||
#endif
|
||||
#include <QMdiArea>
|
||||
#include <QScopedValueRollback>
|
||||
#include <QMenu>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -703,7 +704,7 @@ ControlContainer::ControlContainer(QMdiSubWindow *mdiChild)
|
|||
: QObject(mdiChild),
|
||||
previousLeft(0),
|
||||
previousRight(0),
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
m_menuBar(0),
|
||||
#endif
|
||||
mdiChild(mdiChild)
|
||||
|
|
@ -725,7 +726,7 @@ ControlContainer::ControlContainer(QMdiSubWindow *mdiChild)
|
|||
|
||||
ControlContainer::~ControlContainer()
|
||||
{
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
removeButtonsFromMenuBar();
|
||||
#endif
|
||||
delete m_menuLabel;
|
||||
|
|
@ -734,7 +735,7 @@ ControlContainer::~ControlContainer()
|
|||
m_controllerWidget = 0;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
/*
|
||||
\internal
|
||||
*/
|
||||
|
|
@ -846,7 +847,7 @@ void ControlContainer::removeButtonsFromMenuBar(QMenuBar *menuBar)
|
|||
mdiChild->window()->setWindowTitle(mdiChild->d_func()->originalWindowTitle());
|
||||
}
|
||||
|
||||
#endif // QT_NO_MENUBAR
|
||||
#endif // QT_CONFIG(menubar)
|
||||
|
||||
void ControlContainer::updateWindowIcon(const QIcon &windowIcon)
|
||||
{
|
||||
|
|
@ -1268,7 +1269,7 @@ void QMdiSubWindowPrivate::setNormalMode()
|
|||
isMaximizeMode = false;
|
||||
|
||||
ensureWindowState(Qt::WindowNoState);
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
removeButtonsFromMenuBar();
|
||||
#endif
|
||||
|
||||
|
|
@ -1375,7 +1376,7 @@ void QMdiSubWindowPrivate::setMaximizeMode()
|
|||
updateGeometryConstraints();
|
||||
|
||||
if (wasVisible) {
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (QMenuBar *mBar = menuBar())
|
||||
showButtonsInMenuBar(mBar);
|
||||
else
|
||||
|
|
@ -1438,7 +1439,7 @@ void QMdiSubWindowPrivate::setActive(bool activate, bool changeFocus)
|
|||
Qt::WindowStates oldWindowState = q->windowState();
|
||||
ensureWindowState(Qt::WindowActive);
|
||||
emit q->aboutToActivate();
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (QMenuBar *mBar = menuBar())
|
||||
showButtonsInMenuBar(mBar);
|
||||
#endif
|
||||
|
|
@ -1783,7 +1784,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
|
|||
#else
|
||||
if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q))
|
||||
return true;
|
||||
#if defined(QT_NO_MENUBAR) || defined(QT_NO_MAINWINDOW)
|
||||
#if !QT_CONFIG(menubar) || defined(QT_NO_MAINWINDOW)
|
||||
Q_UNUSED(isChildOfQMdiSubWindow);
|
||||
return true;
|
||||
#else
|
||||
|
|
@ -1797,7 +1798,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
|
@ -1868,7 +1869,7 @@ void QMdiSubWindowPrivate::removeButtonsFromMenuBar()
|
|||
originalTitle.clear();
|
||||
}
|
||||
|
||||
#endif // QT_NO_MENUBAR
|
||||
#endif // QT_CONFIG(menubar)
|
||||
|
||||
void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild)
|
||||
{
|
||||
|
|
@ -2295,7 +2296,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags)
|
|||
QMdiSubWindow::~QMdiSubWindow()
|
||||
{
|
||||
Q_D(QMdiSubWindow);
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
d->removeButtonsFromMenuBar();
|
||||
#endif
|
||||
d->setActive(false);
|
||||
|
|
@ -2628,7 +2629,7 @@ void QMdiSubWindow::showShaded()
|
|||
d->ensureWindowState(Qt::WindowMinimized);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
d->removeButtonsFromMenuBar();
|
||||
#endif
|
||||
|
||||
|
|
@ -2768,7 +2769,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event)
|
|||
if (object == d->baseWidget) {
|
||||
d->updateWindowTitle(true);
|
||||
d->lastChildWindowTitle = d->baseWidget->windowTitle();
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
} else if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar()
|
||||
->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) {
|
||||
d->originalTitle.clear();
|
||||
|
|
@ -2831,7 +2832,7 @@ bool QMdiSubWindow::event(QEvent *event)
|
|||
break;
|
||||
case QEvent::ParentChange: {
|
||||
bool wasResized = testAttribute(Qt::WA_Resized);
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
d->removeButtonsFromMenuBar();
|
||||
#endif
|
||||
d->currentOperation = QMdiSubWindowPrivate::None;
|
||||
|
|
@ -2888,12 +2889,12 @@ bool QMdiSubWindow::event(QEvent *event)
|
|||
case QEvent::ModifiedChange:
|
||||
if (!windowTitle().contains(QLatin1String("[*]")))
|
||||
break;
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar()
|
||||
->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) {
|
||||
window()->setWindowModified(isWindowModified());
|
||||
}
|
||||
#endif // QT_NO_MENUBAR
|
||||
#endif // QT_CONFIG(menubar)
|
||||
d->updateInternalWindowTitle();
|
||||
break;
|
||||
case QEvent::LayoutDirectionChange:
|
||||
|
|
@ -2956,7 +2957,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent)
|
|||
d->updateDirtyRegions();
|
||||
// Show buttons in the menu bar if they're already not there.
|
||||
// We want to do this when QMdiSubWindow becomes visible after being hidden.
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (d->controlContainer) {
|
||||
if (QMenuBar *menuBar = d->menuBar()) {
|
||||
if (menuBar->cornerWidget(Qt::TopRightCorner) != maximizedButtonsWidget())
|
||||
|
|
@ -2972,7 +2973,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent)
|
|||
*/
|
||||
void QMdiSubWindow::hideEvent(QHideEvent * /*hideEvent*/)
|
||||
{
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
d_func()->removeButtonsFromMenuBar();
|
||||
#endif
|
||||
}
|
||||
|
|
@ -3046,7 +3047,7 @@ void QMdiSubWindow::closeEvent(QCloseEvent *closeEvent)
|
|||
closeEvent->ignore();
|
||||
return;
|
||||
}
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
d->removeButtonsFromMenuBar();
|
||||
#endif
|
||||
d->setActive(false);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,9 @@
|
|||
|
||||
#include <QStyle>
|
||||
#include <QStyleOptionTitleBar>
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <QMenuBar>
|
||||
#endif
|
||||
#include <QSizeGrip>
|
||||
#include <QPointer>
|
||||
#include <QDebug>
|
||||
|
|
@ -96,7 +98,7 @@ public:
|
|||
ControlContainer(QMdiSubWindow *mdiChild);
|
||||
~ControlContainer();
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
void showButtonsInMenuBar(QMenuBar *menuBar);
|
||||
void removeButtonsFromMenuBar(QMenuBar *menuBar = 0);
|
||||
QMenuBar *menuBar() const { return m_menuBar; }
|
||||
|
|
@ -108,7 +110,7 @@ public:
|
|||
private:
|
||||
QPointer<QWidget> previousLeft;
|
||||
QPointer<QWidget> previousRight;
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
QPointer<QMenuBar> m_menuBar;
|
||||
#endif
|
||||
QPointer<QWidget> m_controllerWidget;
|
||||
|
|
@ -252,7 +254,7 @@ public:
|
|||
int titleBarHeight(const QStyleOptionTitleBar &options) const;
|
||||
void sizeParameters(int *margin, int *minWidth) const;
|
||||
bool drawTitleBarWhenMaximized() const;
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
QMenuBar *menuBar() const;
|
||||
void showButtonsInMenuBar(QMenuBar *menuBar);
|
||||
void removeButtonsFromMenuBar();
|
||||
|
|
|
|||
|
|
@ -64,7 +64,9 @@
|
|||
#endif
|
||||
|
||||
#include "qmenu_p.h"
|
||||
#if QT_CONFIG(menubar)
|
||||
#include "qmenubar_p.h"
|
||||
#endif
|
||||
#include "qwidgetaction.h"
|
||||
#if QT_CONFIG(toolbutton)
|
||||
#include "qtoolbutton.h"
|
||||
|
|
@ -491,7 +493,7 @@ void QMenuPrivate::hideUpToMenuBar()
|
|||
QWidget *caused = causedPopup.widget;
|
||||
hideMenu(q); //hide after getting causedPopup
|
||||
while(caused) {
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
|
||||
mb->d_func()->setCurrentAction(0);
|
||||
mb->d_func()->setKeyboardMode(false);
|
||||
|
|
@ -1273,7 +1275,7 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
|
|||
bool passOnEvent = false;
|
||||
QWidget *next_widget = 0;
|
||||
QPoint cpos = caused->mapFromGlobal(e->globalPos());
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
|
||||
passOnEvent = mb->rect().contains(cpos);
|
||||
} else
|
||||
|
|
@ -1315,7 +1317,7 @@ void QMenuPrivate::activateCausedStack(const QVector<QPointer<QWidget> > &caused
|
|||
} else if (action_e == QAction::Hover) {
|
||||
emit qmenu->hovered(action);
|
||||
}
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
} else if (QMenuBar *qmenubar = qobject_cast<QMenuBar*>(widget)) {
|
||||
if (action_e == QAction::Trigger) {
|
||||
emit qmenubar->triggered(action);
|
||||
|
|
@ -1410,7 +1412,7 @@ void QMenuPrivate::_q_actionTriggered()
|
|||
QVector< QPointer<QWidget> > list;
|
||||
for(QWidget *widget = q->parentWidget(); widget; ) {
|
||||
if (qobject_cast<QMenu*>(widget)
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
|| qobject_cast<QMenuBar*>(widget)
|
||||
#endif
|
||||
) {
|
||||
|
|
@ -2310,7 +2312,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
|
|||
d->doChildEffects = true;
|
||||
d->updateLayoutDirection();
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
// if this menu is part of a chain attached to a QMenuBar, set the
|
||||
// _NET_WM_WINDOW_TYPE_DROPDOWN_MENU X11 window type
|
||||
setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast<QMenuBar *>(d->topCausedWidget()) != 0);
|
||||
|
|
@ -2406,11 +2408,11 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
|
|||
if (snapToMouse) // position flowing left from the mouse
|
||||
pos.setX(mouse.x() - size.width());
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
// if the menu is in a menubar or is a submenu, it should be right-aligned
|
||||
if (qobject_cast<QMenuBar*>(d->causedPopup.widget) || qobject_cast<QMenu*>(d->causedPopup.widget))
|
||||
pos.rx() -= size.width();
|
||||
#endif //QT_NO_MENUBAR
|
||||
#endif // QT_CONFIG(menubar)
|
||||
|
||||
if (pos.x() < screen.left() + desktopFrame)
|
||||
pos.setX(qMax(p.x(), screen.left() + desktopFrame));
|
||||
|
|
@ -2486,7 +2488,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
|
|||
hGuess = QEffects::LeftScroll;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if ((snapToMouse && (pos.y() + size.height() / 2 < mouse.y())) ||
|
||||
(qobject_cast<QMenuBar*>(d->causedPopup.widget) &&
|
||||
pos.y() + size.width() / 2 < d->causedPopup.widget->mapToGlobal(d->causedPopup.widget->pos()).y()))
|
||||
|
|
@ -2494,7 +2496,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
|
|||
#endif
|
||||
if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu)) {
|
||||
bool doChildEffects = true;
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget)) {
|
||||
doChildEffects = mb->d_func()->doChildEffects;
|
||||
mb->d_func()->doChildEffects = false;
|
||||
|
|
@ -2656,7 +2658,7 @@ void QMenu::hideEvent(QHideEvent *)
|
|||
QAccessibleEvent event(this, QAccessible::PopupMenuEnd);
|
||||
QAccessible::updateAccessibility(&event);
|
||||
#endif
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget))
|
||||
mb->d_func()->setCurrentAction(0);
|
||||
#endif
|
||||
|
|
@ -3204,7 +3206,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
|
|||
if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this))
|
||||
{
|
||||
d->hideMenu(this);
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (QMenuBar *mb = qobject_cast<QMenuBar*>(QApplication::focusWidget())) {
|
||||
mb->d_func()->setKeyboardMode(false);
|
||||
}
|
||||
|
|
@ -3266,7 +3268,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
|
|||
{
|
||||
QPointer<QWidget> caused = d->causedPopup.widget;
|
||||
d->hideMenu(this); // hide after getting causedPopup
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
|
||||
mb->d_func()->setCurrentAction(d->menuAction);
|
||||
mb->d_func()->setKeyboardMode(true);
|
||||
|
|
@ -3343,7 +3345,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
|
|||
}
|
||||
}
|
||||
if (!key_consumed) {
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->topCausedWidget())) {
|
||||
QAction *oldAct = mb->d_func()->currentAction;
|
||||
QApplication::sendEvent(mb, e);
|
||||
|
|
|
|||
|
|
@ -41,8 +41,10 @@
|
|||
#import <AppKit/AppKit.h>
|
||||
|
||||
#include "qmenu.h"
|
||||
#if QT_CONFIG(menubar)
|
||||
#include "qmenubar.h"
|
||||
#include "qmenubar_p.h"
|
||||
#endif
|
||||
#include "qmacnativewidget_mac.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
|
@ -139,7 +141,7 @@ void QMenuPrivate::moveWidgetToPlatformItem(QWidget *widget, QPlatformMenuItem*
|
|||
|
||||
#endif //QT_NO_MENU
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
#if QT_CONFIG(menubar)
|
||||
|
||||
/*!
|
||||
\since 5.2
|
||||
|
|
@ -159,7 +161,7 @@ NSMenu *QMenuBar::toNSMenu()
|
|||
}
|
||||
return nil;
|
||||
}
|
||||
#endif //QT_NO_MENUBAR
|
||||
#endif // QT_CONFIG(menubar)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,9 @@
|
|||
//
|
||||
|
||||
#include <QtWidgets/private/qtwidgetsglobal_p.h>
|
||||
#if QT_CONFIG(menubar)
|
||||
#include "QtWidgets/qmenubar.h"
|
||||
#endif
|
||||
#include "QtWidgets/qstyleoption.h"
|
||||
#include "QtCore/qdatetime.h"
|
||||
#include "QtCore/qmap.h"
|
||||
|
|
|
|||
|
|
@ -61,9 +61,6 @@
|
|||
#include "private/qguiapplication_p.h"
|
||||
#include "qpa/qplatformintegration.h"
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
|
||||
|
||||
#include "qmenu_p.h"
|
||||
#include "qmenubar_p.h"
|
||||
#include "qdebug.h"
|
||||
|
|
@ -1874,9 +1871,6 @@ QPlatformMenuBar *QMenuBar::platformMenuBar()
|
|||
|
||||
// for private slots
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include <moc_qmenubar.cpp>
|
||||
|
||||
#endif // QT_NO_MENUBAR
|
||||
|
|
|
|||
|
|
@ -43,11 +43,10 @@
|
|||
#include <QtWidgets/qtwidgetsglobal.h>
|
||||
#include <QtWidgets/qmenu.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(menubar);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
|
||||
class QMenuBarPrivate;
|
||||
class QStyleOptionMenuItem;
|
||||
class QWindowsStyle;
|
||||
|
|
@ -140,8 +139,6 @@ private:
|
|||
friend class QWindowsStyle;
|
||||
};
|
||||
|
||||
#endif // QT_NO_MENUBAR
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QMENUBAR_H
|
||||
|
|
|
|||
|
|
@ -56,9 +56,10 @@
|
|||
#include <private/qmenu_p.h> // Mac needs what in this file!
|
||||
#include <qpa/qplatformmenu.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(menubar);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_MENUBAR
|
||||
class QMenuBarExtension;
|
||||
class QMenuBarPrivate : public QWidgetPrivate
|
||||
{
|
||||
|
|
@ -136,8 +137,6 @@ public:
|
|||
inline int indexOf(QAction *act) const { return q_func()->actions().indexOf(act); }
|
||||
};
|
||||
|
||||
#endif // QT_NO_MENUBAR
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QMENUBAR_P_H
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@
|
|||
#include <qlayout.h>
|
||||
#include <qmainwindow.h>
|
||||
#include <qmenu.h>
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <qmenubar.h>
|
||||
#endif
|
||||
#if QT_CONFIG(rubberband)
|
||||
#include <qrubberband.h>
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ HEADERS += \
|
|||
widgets/qmdisubwindow_p.h \
|
||||
widgets/qmenu.h \
|
||||
widgets/qmenu_p.h \
|
||||
widgets/qmenubar.h \
|
||||
widgets/qmenubar_p.h \
|
||||
widgets/qscrollarea_p.h \
|
||||
widgets/qsizegrip.h \
|
||||
widgets/qslider.h \
|
||||
|
|
@ -55,7 +53,6 @@ SOURCES += \
|
|||
widgets/qmdiarea.cpp \
|
||||
widgets/qmdisubwindow.cpp \
|
||||
widgets/qmenu.cpp \
|
||||
widgets/qmenubar.cpp \
|
||||
widgets/qsizegrip.cpp \
|
||||
widgets/qslider.cpp \
|
||||
widgets/qspinbox.cpp \
|
||||
|
|
@ -171,6 +168,14 @@ qtConfig(lcdnumber) {
|
|||
widgets/qlcdnumber.cpp
|
||||
}
|
||||
|
||||
qtConfig(menubar) {
|
||||
HEADERS += \
|
||||
widgets/qmenubar.h \
|
||||
widgets/qmenubar_p.h
|
||||
|
||||
SOURCES += widgets/qmenubar.cpp
|
||||
}
|
||||
|
||||
qtConfig(progressbar) {
|
||||
HEADERS += widgets/qprogressbar.h
|
||||
SOURCES += widgets/qprogressbar.cpp
|
||||
|
|
|
|||
Loading…
Reference in New Issue