Convert features.menu to QT_[REQUIRE_]CONFIG
Change-Id: I031356411294b259ebd2b22c53159c93fd92af6e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
parent
9833e68217
commit
6d699d0820
@ -39,7 +39,9 @@
|
||||
|
||||
#include "qaccessiblemenu_p.h"
|
||||
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <qmenubar.h>
|
||||
#endif
|
||||
@ -50,7 +52,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
|
||||
QString qt_accStripAmp(const QString &text);
|
||||
QString qt_accHotKey(const QString &text);
|
||||
@ -389,7 +391,7 @@ QWidget *QAccessibleMenuItem::owner() const
|
||||
return m_owner;
|
||||
}
|
||||
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
class QMenu;
|
||||
class QMenuBar;
|
||||
class QAction;
|
||||
@ -136,7 +136,7 @@ private:
|
||||
QPointer<QWidget> m_owner; // can hold either QMenu or the QMenuBar that contains the action
|
||||
};
|
||||
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#endif // QT_NO_ACCESSIBILITY
|
||||
|
@ -60,7 +60,9 @@
|
||||
#include <QRubberBand>
|
||||
#endif
|
||||
#include <QFocusFrame>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <QMenu>
|
||||
#endif
|
||||
#include <QtWidgets/private/qwidget_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -72,7 +74,7 @@ static QList<QWidget*> childWidgets(const QWidget *widget)
|
||||
QWidget *w = qobject_cast<QWidget *>(o);
|
||||
if (w && !w->isWindow()
|
||||
&& !qobject_cast<QFocusFrame*>(w)
|
||||
#if !defined(QT_NO_MENU)
|
||||
#if QT_CONFIG(menu)
|
||||
&& !qobject_cast<QMenu*>(w)
|
||||
#endif
|
||||
&& w->objectName() != QLatin1String("qt_rubberband")
|
||||
|
@ -142,7 +142,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
|
||||
} else if (classname == QLatin1String("QMenuBar")) {
|
||||
iface = new QAccessibleMenuBar(widget);
|
||||
#endif
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
} else if (classname == QLatin1String("QMenu")) {
|
||||
iface = new QAccessibleMenu(widget);
|
||||
#endif
|
||||
|
@ -88,7 +88,9 @@
|
||||
#include <QMainWindow>
|
||||
#endif
|
||||
#include <QFocusFrame>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <QMenu>
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
|
||||
|
@ -60,7 +60,9 @@
|
||||
#if QT_CONFIG(toolbutton)
|
||||
#include <qtoolbutton.h>
|
||||
#endif
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#if QT_CONFIG(label)
|
||||
#include <qlabel.h>
|
||||
#endif
|
||||
@ -178,7 +180,7 @@ QAccessible::State QAccessibleButton::state() const
|
||||
if (pb) {
|
||||
if (pb->isDefault())
|
||||
state.defaultButton = true;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (pb->menu())
|
||||
state.hasPopup = true;
|
||||
#endif
|
||||
@ -217,7 +219,7 @@ QAccessible::Role QAccessibleButton::role() const
|
||||
{
|
||||
QAbstractButton *ab = button();
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (QPushButton *pb = qobject_cast<QPushButton*>(ab)) {
|
||||
if (pb->menu())
|
||||
return QAccessible::ButtonMenu;
|
||||
@ -260,7 +262,7 @@ void QAccessibleButton::doAction(const QString &actionName)
|
||||
return;
|
||||
if (actionName == pressAction() ||
|
||||
actionName == showMenuAction()) {
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
QPushButton *pb = qobject_cast<QPushButton*>(object());
|
||||
if (pb && pb->menu())
|
||||
pb->showMenu();
|
||||
@ -314,7 +316,7 @@ QToolButton *QAccessibleToolButton::toolButton() const
|
||||
*/
|
||||
bool QAccessibleToolButton::isSplitButton() const
|
||||
{
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
return toolButton()->menu() && toolButton()->popupMode() == QToolButton::MenuButtonPopup;
|
||||
#else
|
||||
return false;
|
||||
@ -326,7 +328,7 @@ QAccessible::State QAccessibleToolButton::state() const
|
||||
QAccessible::State st = QAccessibleButton::state();
|
||||
if (toolButton()->autoRaise())
|
||||
st.hotTracked = true;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (toolButton()->menu())
|
||||
st.hasPopup = true;
|
||||
#endif
|
||||
@ -340,7 +342,7 @@ int QAccessibleToolButton::childCount() const
|
||||
|
||||
QAccessible::Role QAccessibleToolButton::role() const
|
||||
{
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
QAbstractButton *ab = button();
|
||||
QToolButton *tb = qobject_cast<QToolButton*>(ab);
|
||||
if (!tb->menu())
|
||||
@ -354,7 +356,7 @@ QAccessible::Role QAccessibleToolButton::role() const
|
||||
|
||||
QAccessibleInterface *QAccessibleToolButton::child(int index) const
|
||||
{
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (index == 0 && toolButton()->menu())
|
||||
{
|
||||
return QAccessible::queryAccessibleInterface(toolButton()->menu());
|
||||
|
@ -48,7 +48,9 @@
|
||||
#include "qlabel.h"
|
||||
#include "qlayout.h"
|
||||
#include "qlineedit.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#endif
|
||||
#include "qpainter.h"
|
||||
#include "qpixmap.h"
|
||||
#include "qpushbutton.h"
|
||||
@ -427,7 +429,7 @@ void QWellArray::setSelected(int row, int col)
|
||||
if (row >= 0)
|
||||
emit selected(row, col);
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (isVisible() && qobject_cast<QMenu*>(parentWidget()))
|
||||
parentWidget()->close();
|
||||
#endif
|
||||
|
@ -58,7 +58,9 @@
|
||||
#if QT_CONFIG(whatsthis)
|
||||
#include "qwhatsthis.h"
|
||||
#endif
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#endif
|
||||
#include "qcursor.h"
|
||||
#if QT_CONFIG(messagebox)
|
||||
#include "qmessagebox.h"
|
||||
@ -622,7 +624,7 @@ bool QDialog::eventFilter(QObject *o, QEvent *e)
|
||||
/*! \reimp */
|
||||
void QDialog::contextMenuEvent(QContextMenuEvent *e)
|
||||
{
|
||||
#if !QT_CONFIG(whatsthis) || defined(QT_NO_MENU)
|
||||
#if !QT_CONFIG(whatsthis) || !QT_CONFIG(menu)
|
||||
Q_UNUSED(e);
|
||||
#else
|
||||
QWidget *w = childAt(e->pos());
|
||||
|
@ -50,7 +50,9 @@
|
||||
#include <qheaderview.h>
|
||||
#include <qshortcut.h>
|
||||
#include <qgridlayout.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#if QT_CONFIG(messagebox)
|
||||
#include <qmessagebox.h>
|
||||
#endif
|
||||
@ -3353,7 +3355,7 @@ void QFileDialogPrivate::_q_showDetailsView()
|
||||
*/
|
||||
void QFileDialogPrivate::_q_showContextMenu(const QPoint &position)
|
||||
{
|
||||
#ifdef QT_NO_MENU
|
||||
#if !QT_CONFIG(menu)
|
||||
Q_UNUSED(position);
|
||||
#else
|
||||
Q_Q(QFileDialog);
|
||||
@ -3382,7 +3384,7 @@ void QFileDialogPrivate::_q_showContextMenu(const QPoint &position)
|
||||
menu.addAction(newFolderAction);
|
||||
}
|
||||
menu.exec(view->viewport()->mapToGlobal(position));
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -57,7 +57,9 @@
|
||||
#if QT_CONFIG(textedit)
|
||||
#include <QtWidgets/qtextedit.h>
|
||||
#endif
|
||||
#if QT_CONFIG(menu)
|
||||
#include <QtWidgets/qmenu.h>
|
||||
#endif
|
||||
#include "qdialog_p.h"
|
||||
#include <QtGui/qfont.h>
|
||||
#include <QtGui/qfontmetrics.h>
|
||||
|
@ -42,7 +42,9 @@
|
||||
|
||||
#include <qaction.h>
|
||||
#include <qurl.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#include <qmimedata.h>
|
||||
#include <qevent.h>
|
||||
#include <qdebug.h>
|
||||
@ -435,7 +437,7 @@ void QSidebar::selectUrl(const QUrl &url)
|
||||
this, SLOT(clicked(QModelIndex)));
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
/*!
|
||||
\internal
|
||||
|
||||
@ -454,7 +456,7 @@ void QSidebar::showContextMenu(const QPoint &position)
|
||||
if (actions.count() > 0)
|
||||
QMenu::exec(actions, mapToGlobal(position));
|
||||
}
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
@ -148,7 +148,7 @@ protected:
|
||||
|
||||
private Q_SLOTS:
|
||||
void clicked(const QModelIndex &index);
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
void showContextMenu(const QPoint &position);
|
||||
#endif
|
||||
void removeEntry();
|
||||
|
@ -47,7 +47,9 @@
|
||||
#include "qlist.h"
|
||||
#include <private/qshortcutmap_p.h>
|
||||
#include <private/qapplication_p.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <private/qmenu_p.h>
|
||||
#endif
|
||||
#include <private/qdebug_p.h>
|
||||
|
||||
#define QAPP_CHECK(functionName) \
|
||||
@ -643,7 +645,7 @@ QIcon QAction::icon() const
|
||||
return d->icon;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
/*!
|
||||
Returns the menu contained by this action. Actions that contain
|
||||
menus can be used to create menu items with submenus, or inserted
|
||||
@ -670,7 +672,7 @@ void QAction::setMenu(QMenu *menu)
|
||||
menu->d_func()->setOverrideMenuAction(this);
|
||||
d->sendDataChanged();
|
||||
}
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
|
||||
/*!
|
||||
If \a b is true then this action will be considered a separator.
|
||||
|
@ -120,7 +120,7 @@ public:
|
||||
void setPriority(Priority priority);
|
||||
Priority priority() const;
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
QMenu *menu() const;
|
||||
void setMenu(QMenu *menu);
|
||||
#endif
|
||||
|
@ -53,7 +53,9 @@
|
||||
|
||||
#include <QtWidgets/private/qtwidgetsglobal_p.h>
|
||||
#include "QtWidgets/qaction.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "QtWidgets/qmenu.h"
|
||||
#endif
|
||||
#if QT_CONFIG(graphicsview)
|
||||
#include "private/qgraphicswidget_p.h"
|
||||
#endif
|
||||
|
@ -45,7 +45,9 @@
|
||||
#if QT_CONFIG(whatsthis)
|
||||
#include <qwhatsthis.h>
|
||||
#endif
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <qmenubar.h>
|
||||
#endif
|
||||
@ -276,7 +278,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
|
||||
#endif
|
||||
for (int i = 0; i < widgets.size(); ++i) {
|
||||
QWidget *w = widgets.at(i);
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (QMenu *menu = qobject_cast<QMenu *>(w)) {
|
||||
#ifdef Q_OS_DARWIN
|
||||
// On Mac, menu item shortcuts are processed before reaching any window.
|
||||
|
@ -45,7 +45,9 @@
|
||||
#include "qdesktopwidget_p.h"
|
||||
#include "qevent.h"
|
||||
#include "qlayout.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#endif
|
||||
#include "qmetaobject.h"
|
||||
#include "qpixmap.h"
|
||||
#include "qpointer.h"
|
||||
@ -8996,7 +8998,7 @@ bool QWidget::event(QEvent *event)
|
||||
case Qt::CustomContextMenu:
|
||||
emit customContextMenuRequested(static_cast<QContextMenuEvent *>(event)->pos());
|
||||
break;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
case Qt::ActionsContextMenu:
|
||||
if (d->actions.count()) {
|
||||
QMenu::exec(d->actions, static_cast<QContextMenuEvent *>(event)->globalPos(),
|
||||
|
@ -65,7 +65,9 @@
|
||||
#include <qgroupbox.h>
|
||||
#endif
|
||||
#include <qmath.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#include <qpainter.h>
|
||||
#include <qpaintengine.h>
|
||||
#include <qpainterpath.h>
|
||||
@ -1373,7 +1375,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
case CE_MenuScroller: {
|
||||
QStyleOption arrowOpt = *opt;
|
||||
arrowOpt.state |= State_Enabled;
|
||||
@ -1393,7 +1395,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
|
||||
p->drawLine(opt->rect.x() + 2, opt->rect.y() + opt->rect.height() / 2,
|
||||
opt->rect.x() + opt->rect.width() - 4, opt->rect.y() + opt->rect.height() / 2);
|
||||
break;
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
#if QT_CONFIG(menubar)
|
||||
case CE_MenuBarItem:
|
||||
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
|
||||
@ -4814,7 +4816,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
|
||||
sz.setHeight(qMax(sz.height(), h));
|
||||
}
|
||||
break;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
case CT_MenuItem:
|
||||
if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
|
||||
bool checkable = mi->menuHasCheckableItems;
|
||||
@ -4842,7 +4844,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
|
||||
sz = QSize(w, h);
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
#if QT_CONFIG(toolbutton)
|
||||
case CT_ToolButton:
|
||||
sz = QSize(sz.width() + 6, sz.height() + 5);
|
||||
|
@ -2291,7 +2291,7 @@ void QMacStyle::polish(QWidget* w)
|
||||
w->setAttribute(Qt::WA_SetPalette, false);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (qobject_cast<QMenu*>(w)
|
||||
#if QT_CONFIG(combobox)
|
||||
|| qobject_cast<QComboBoxPrivateContainer *>(w)
|
||||
@ -2350,7 +2350,7 @@ void QMacStyle::polish(QWidget* w)
|
||||
void QMacStyle::unpolish(QWidget* w)
|
||||
{
|
||||
if ((
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
qobject_cast<QMenu*>(w) ||
|
||||
#endif
|
||||
qt_mac_is_metal(w)
|
||||
@ -3089,7 +3089,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
|
||||
opt->rect.width(), opt->rect.height() - 8);
|
||||
HIThemeMenuDrawInfo mdi;
|
||||
mdi.version = 0;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (w && qobject_cast<QMenu *>(w->parentWidget()))
|
||||
mdi.menuType = kThemeMenuTypeHierarchical;
|
||||
else
|
||||
|
@ -45,7 +45,9 @@
|
||||
#include "private/qcssutil_p.h"
|
||||
#include <qdebug.h>
|
||||
#include <qapplication.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <qmenubar.h>
|
||||
#endif
|
||||
@ -1665,7 +1667,7 @@ int QStyleSheetStyle::nativeFrameWidth(const QWidget *w)
|
||||
return base->pixelMetric(QStyle::PM_ComboBoxFrameWidth, 0, w);
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (qobject_cast<const QMenu *>(w))
|
||||
return base->pixelMetric(QStyle::PM_MenuPanelWidth, 0, w);
|
||||
#endif
|
||||
|
@ -46,7 +46,9 @@
|
||||
#include "qbitmap.h"
|
||||
#include "qdrawutil.h" // for now
|
||||
#include "qevent.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#endif
|
||||
#if QT_CONFIG(menubar)
|
||||
#include "qmenubar.h"
|
||||
#include <private/qmenubar_p.h>
|
||||
@ -352,7 +354,7 @@ int QWindowsStylePrivate::fixedPixelMetric(QStyle::PixelMetric pm)
|
||||
return 11;
|
||||
#endif // QT_CONFIG(slider)
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
case QStyle::PM_MenuBarHMargin:
|
||||
case QStyle::PM_MenuBarVMargin:
|
||||
case QStyle::PM_MenuBarPanelWidth:
|
||||
@ -367,7 +369,7 @@ int QWindowsStylePrivate::fixedPixelMetric(QStyle::PixelMetric pm)
|
||||
case QStyle::PM_DockWidgetFrameWidth:
|
||||
return 4;
|
||||
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
case QStyle::PM_ToolBarHandleExtent:
|
||||
return 10;
|
||||
default:
|
||||
@ -1115,7 +1117,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
|
||||
break;
|
||||
#endif // QT_CONFIG(rubberband)
|
||||
|
||||
#if !defined(QT_NO_MENU) && QT_CONFIG(mainwindow)
|
||||
#if QT_CONFIG(menu) && QT_CONFIG(mainwindow)
|
||||
case CE_MenuBarEmptyArea:
|
||||
if (widget && qobject_cast<const QMainWindow *>(widget->parentWidget())) {
|
||||
p->fillRect(opt->rect, opt->palette.button());
|
||||
@ -1126,7 +1128,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
case CE_MenuItem:
|
||||
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
|
||||
int x, y, w, h;
|
||||
@ -1263,7 +1265,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
|
||||
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
#if QT_CONFIG(menubar)
|
||||
case CE_MenuBarItem:
|
||||
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
|
||||
@ -2353,7 +2355,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
|
||||
sz = QSize(w, h);
|
||||
}
|
||||
break;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
case CT_MenuItem:
|
||||
if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
|
||||
int w = sz.width();
|
||||
@ -2395,7 +2397,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
|
||||
sz.setWidth(w);
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
#if QT_CONFIG(menubar)
|
||||
case CT_MenuBarItem:
|
||||
if (!sz.isEmpty())
|
||||
|
@ -1175,7 +1175,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
case CE_MenuItem:
|
||||
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
|
||||
// windows always has a check column, regardless whether we have an icon or not
|
||||
@ -1333,7 +1333,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
case CE_HeaderSection:
|
||||
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
|
||||
partId = HP_HEADERITEM;
|
||||
|
@ -42,7 +42,9 @@
|
||||
|
||||
#ifndef QT_NO_SYSTEMTRAYICON
|
||||
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#endif
|
||||
#include "qlist.h"
|
||||
#include "qevent.h"
|
||||
#include "qpoint.h"
|
||||
@ -178,7 +180,7 @@ QSystemTrayIcon::~QSystemTrayIcon()
|
||||
d->remove_sys();
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
|
||||
/*!
|
||||
Sets the specified \a menu to be the context menu for the system tray icon.
|
||||
@ -209,7 +211,7 @@ QMenu* QSystemTrayIcon::contextMenu() const
|
||||
return d->menu;
|
||||
}
|
||||
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
|
||||
/*!
|
||||
\property QSystemTrayIcon::icon
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
MiddleClick
|
||||
};
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
void setContextMenu(QMenu *menu);
|
||||
QMenu *contextMenu() const;
|
||||
#endif
|
||||
|
@ -57,7 +57,10 @@
|
||||
|
||||
#ifndef QT_NO_SYSTEMTRAYICON
|
||||
|
||||
#if QT_CONFIG(menu)
|
||||
#include "QtWidgets/qmenu.h"
|
||||
#endif
|
||||
#include "QtWidgets/qwidget.h"
|
||||
#include "QtGui/qpixmap.h"
|
||||
#include <qpa/qplatformsystemtrayicon.h>
|
||||
#include "QtCore/qstring.h"
|
||||
|
@ -47,7 +47,9 @@
|
||||
#include "qevent.h"
|
||||
#include "qapplication.h"
|
||||
#include "qlist.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#endif
|
||||
#include "qtimer.h"
|
||||
#include "qsystemtrayicon_p.h"
|
||||
#include "qpaintengine.h"
|
||||
|
@ -51,7 +51,9 @@
|
||||
#include <qdatetimeedit.h>
|
||||
#endif
|
||||
#include <qevent.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#include <qpainter.h>
|
||||
#include <qpalette.h>
|
||||
#include <qstylepainter.h>
|
||||
|
@ -51,7 +51,9 @@
|
||||
#endif
|
||||
#include <qitemdelegate.h>
|
||||
#include <qmap.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#include <qevent.h>
|
||||
#include <qlayout.h>
|
||||
#include <qscrollbar.h>
|
||||
@ -1110,7 +1112,7 @@ void QComboBoxPrivate::updateViewContainerPaletteAndOpacity()
|
||||
Q_Q(QComboBox);
|
||||
QStyleOptionComboBox opt;
|
||||
q->initStyleOption(&opt);
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (q->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, q)) {
|
||||
QMenu menu;
|
||||
menu.ensurePolished();
|
||||
|
@ -65,7 +65,9 @@
|
||||
#include "qimage.h"
|
||||
#include "qbitmap.h"
|
||||
#include "qpicture.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -48,7 +48,9 @@
|
||||
#include "qevent.h"
|
||||
#include "qfontmetrics.h"
|
||||
#include "qstylehints.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#endif
|
||||
#include "qpainter.h"
|
||||
#include "qpixmap.h"
|
||||
#include "qpointer.h"
|
||||
|
@ -1695,7 +1695,7 @@ void QMainWindow::contextMenuEvent(QContextMenuEvent *event)
|
||||
if (child == this)
|
||||
return;
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
QMenu *popup = createPopupMenu();
|
||||
if (popup) {
|
||||
if (!popup->isEmpty()) {
|
||||
@ -1710,7 +1710,7 @@ void QMainWindow::contextMenuEvent(QContextMenuEvent *event)
|
||||
}
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
/*!
|
||||
Returns a popup menu containing checkable entries for the toolbars and
|
||||
dock widgets present in the main window. If there are no toolbars and
|
||||
@ -1771,7 +1771,7 @@ QMenu *QMainWindow::createPopupMenu()
|
||||
Q_UNUSED(d);
|
||||
return menu;
|
||||
}
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -181,7 +181,7 @@ public:
|
||||
QByteArray saveState(int version = 0) const;
|
||||
bool restoreState(const QByteArray &state, int version = 0);
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
virtual QMenu *createPopupMenu();
|
||||
#endif
|
||||
|
||||
|
@ -171,7 +171,9 @@
|
||||
#include <QDesktopWidget>
|
||||
#include <QDebug>
|
||||
#include <qmath.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#include <private/qlayoutengine_p.h>
|
||||
|
||||
#include <algorithm>
|
||||
@ -610,7 +612,7 @@ void QMdiAreaTabBar::contextMenuEvent(QContextMenuEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
QMdiSubWindowPrivate *subWindowPrivate = subWindow->d_func();
|
||||
if (!subWindowPrivate->systemMenu) {
|
||||
event->ignore();
|
||||
@ -638,7 +640,7 @@ void QMdiAreaTabBar::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
// Restore action visibility.
|
||||
subWindowPrivate->updateActions();
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
}
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
|
||||
|
@ -165,7 +165,10 @@
|
||||
#endif
|
||||
#include <QMdiArea>
|
||||
#include <QScopedValueRollback>
|
||||
#include <QAction>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <QMenu>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -718,7 +721,7 @@ ControlContainer::ControlContainer(QMdiSubWindow *mdiChild)
|
||||
|
||||
m_menuLabel = new ControlElement<ControlLabel>(mdiChild);
|
||||
m_menuLabel->setWindowIcon(mdiChild->windowIcon());
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
connect(m_menuLabel, SIGNAL(_q_clicked()), mdiChild, SLOT(showSystemMenu()));
|
||||
#endif
|
||||
connect(m_menuLabel, SIGNAL(_q_doubleClicked()), mdiChild, SLOT(close()));
|
||||
@ -1038,7 +1041,7 @@ void QMdiSubWindowPrivate::initOperationMap()
|
||||
operationMap.insert(BottomRightResize, OperationInfo(HResize | VResize, Qt::SizeFDiagCursor));
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
|
||||
/*!
|
||||
\internal
|
||||
@ -2157,7 +2160,7 @@ void QMdiSubWindowPrivate::setEnabled(WindowStateAction action, bool enable)
|
||||
actions[action]->setEnabled(enable);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
void QMdiSubWindowPrivate::addToSystemMenu(WindowStateAction action, const QString &text,
|
||||
const char *slot)
|
||||
{
|
||||
@ -2262,7 +2265,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags)
|
||||
: QWidget(*new QMdiSubWindowPrivate, parent, 0)
|
||||
{
|
||||
Q_D(QMdiSubWindow);
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
d->createSystemMenu();
|
||||
addActions(d->systemMenu->actions());
|
||||
#endif
|
||||
@ -2495,7 +2498,7 @@ void QMdiSubWindow::setKeyboardPageStep(int step)
|
||||
d_func()->keyboardPageStep = step;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
/*!
|
||||
Sets \a systemMenu as the current system menu for this subwindow.
|
||||
|
||||
@ -2575,7 +2578,7 @@ void QMdiSubWindow::showSystemMenu()
|
||||
globalPopupPos -= QPoint(d->systemMenu->sizeHint().width(), 0);
|
||||
d->systemMenu->popup(globalPopupPos);
|
||||
}
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
|
||||
/*!
|
||||
\since 4.4
|
||||
@ -2696,7 +2699,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event)
|
||||
if (!object)
|
||||
return QWidget::eventFilter(object, event);
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
// System menu events.
|
||||
if (d->systemMenu && d->systemMenu == object) {
|
||||
if (event->type() == QEvent::MouseButtonDblClick) {
|
||||
@ -3222,7 +3225,7 @@ void QMdiSubWindow::mousePressEvent(QMouseEvent *mouseEvent)
|
||||
}
|
||||
|
||||
d->activeSubControl = d->hoveredSubControl;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (d->activeSubControl == QStyle::SC_TitleBarSysMenu)
|
||||
showSystemMenu();
|
||||
else
|
||||
@ -3247,7 +3250,7 @@ void QMdiSubWindow::mouseDoubleClickEvent(QMouseEvent *mouseEvent)
|
||||
|
||||
Q_D(QMdiSubWindow);
|
||||
if (!d->isMoveOperation()) {
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (d->hoveredSubControl == QStyle::SC_TitleBarSysMenu)
|
||||
close();
|
||||
#endif
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
void setKeyboardPageStep(int step);
|
||||
int keyboardPageStep() const;
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
void setSystemMenu(QMenu *systemMenu);
|
||||
QMenu *systemMenu() const;
|
||||
#endif
|
||||
@ -101,7 +101,7 @@ Q_SIGNALS:
|
||||
void aboutToActivate();
|
||||
|
||||
public Q_SLOTS:
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
void showSystemMenu();
|
||||
#endif
|
||||
void showShaded();
|
||||
|
@ -236,7 +236,7 @@ public:
|
||||
void leaveInteractiveMode();
|
||||
void removeBaseWidget();
|
||||
void initOperationMap();
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
void createSystemMenu();
|
||||
#endif
|
||||
void updateCursor();
|
||||
@ -275,7 +275,7 @@ public:
|
||||
void setVisible(WindowStateAction, bool visible = true);
|
||||
#ifndef QT_NO_ACTION
|
||||
void setEnabled(WindowStateAction, bool enable = true);
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
void addToSystemMenu(WindowStateAction, const QString &text, const char *slot);
|
||||
#endif
|
||||
#endif // QT_NO_ACTION
|
||||
|
@ -39,8 +39,6 @@
|
||||
|
||||
#include "qmenu.h"
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
|
||||
#include <QtWidgets/private/qtwidgetsglobal_p.h>
|
||||
|
||||
#include "qdebug.h"
|
||||
@ -3778,5 +3776,3 @@ QT_END_NAMESPACE
|
||||
// for private slots
|
||||
#include "moc_qmenu.cpp"
|
||||
#include "qmenu.moc"
|
||||
|
||||
#endif // QT_NO_MENU
|
||||
|
@ -50,11 +50,10 @@
|
||||
Q_FORWARD_DECLARE_OBJC_CLASS(NSMenu);
|
||||
#endif
|
||||
|
||||
QT_REQUIRE_CONFIG(menu);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
|
||||
class QMenuPrivate;
|
||||
class QStyleOptionMenuItem;
|
||||
class QPlatformMenu;
|
||||
@ -280,8 +279,6 @@ private:
|
||||
inline QT_DEPRECATED void qt_mac_set_dock_menu(QMenu *menu) { menu->setAsDockMenu(); }
|
||||
#endif
|
||||
|
||||
#endif // QT_NO_MENU
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QMENU_H
|
||||
|
@ -54,7 +54,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
|
||||
namespace {
|
||||
// TODO use QtMacExtras copy of this function when available.
|
||||
@ -139,7 +139,7 @@ void QMenuPrivate::moveWidgetToPlatformItem(QWidget *widget, QPlatformMenuItem*
|
||||
container->show();
|
||||
}
|
||||
|
||||
#endif //QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
|
||||
#if QT_CONFIG(menubar)
|
||||
|
||||
|
@ -64,9 +64,9 @@
|
||||
|
||||
#include <qpa/qplatformmenu.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
QT_REQUIRE_CONFIG(menu);
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QTornOffMenu;
|
||||
class QEventLoop;
|
||||
@ -479,8 +479,6 @@ public:
|
||||
QRect rect() const;
|
||||
};
|
||||
|
||||
#endif // QT_NO_MENU
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QMENU_P_H
|
||||
|
@ -83,7 +83,7 @@ QMenuBarExtension::QMenuBarExtension(QWidget *parent)
|
||||
{
|
||||
setObjectName(QLatin1String("qt_menubar_ext_button"));
|
||||
setAutoRaise(true);
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
setPopupMode(QToolButton::InstantPopup);
|
||||
#endif
|
||||
setIcon(style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton, 0, parentWidget()));
|
||||
|
@ -46,7 +46,9 @@
|
||||
#include <qdebug.h>
|
||||
#include <qdrag.h>
|
||||
#include <qclipboard.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#include <qstyle.h>
|
||||
#include <qtimer.h>
|
||||
#include "private/qtextdocumentlayout_p.h"
|
||||
|
@ -59,7 +59,9 @@
|
||||
#endif
|
||||
#include "QtGui/qtextcursor.h"
|
||||
#include "QtGui/qtextformat.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "QtWidgets/qmenu.h"
|
||||
#endif
|
||||
#include "QtGui/qabstracttextdocumentlayout.h"
|
||||
#include "QtCore/qbasictimer.h"
|
||||
#include "qplaintextedit.h"
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include "qdrawutil.h"
|
||||
#include "qevent.h"
|
||||
#include "qfontmetrics.h"
|
||||
#include "qmenu.h"
|
||||
#include "qstylepainter.h"
|
||||
#include "qpixmap.h"
|
||||
#include "qpointer.h"
|
||||
@ -68,7 +67,10 @@
|
||||
#include "qaccessible.h"
|
||||
#endif
|
||||
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#include "private/qmenu_p.h"
|
||||
#endif
|
||||
#include "private/qpushbutton_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -317,7 +319,7 @@ void QPushButton::initStyleOption(QStyleOptionButton *option) const
|
||||
option->features = QStyleOptionButton::None;
|
||||
if (d->flat)
|
||||
option->features |= QStyleOptionButton::Flat;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (d->menu)
|
||||
option->features |= QStyleOptionButton::HasMenu;
|
||||
#endif
|
||||
@ -422,7 +424,7 @@ QSize QPushButton::sizeHint() const
|
||||
if(!empty || !h)
|
||||
h = qMax(h, sz.height());
|
||||
opt.rect.setSize(QSize(w, h)); // PM_MenuButtonIndicator depends on the height
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (menu())
|
||||
w += style()->pixelMetric(QStyle::PM_MenuButtonIndicator, &opt, this);
|
||||
#endif
|
||||
@ -502,13 +504,13 @@ void QPushButton::focusOutEvent(QFocusEvent *e)
|
||||
}
|
||||
|
||||
QAbstractButton::focusOutEvent(e);
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (d->menu && d->menu->isVisible()) // restore pressed status
|
||||
setDown(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
/*!
|
||||
Associates the popup menu \a menu with this push button. This
|
||||
turns the button into a menu button, which in some styles will
|
||||
@ -631,7 +633,7 @@ QPoint QPushButtonPrivate::adjustedMenuPosition()
|
||||
return QPoint(x,y);
|
||||
}
|
||||
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
|
||||
void QPushButtonPrivate::resetLayoutItemMargins()
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
bool isDefault() const;
|
||||
void setDefault(bool);
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
void setMenu(QMenu* menu);
|
||||
QMenu* menu() const;
|
||||
#endif
|
||||
@ -83,7 +83,7 @@ public:
|
||||
bool isFlat() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
void showMenu();
|
||||
#endif
|
||||
|
||||
@ -101,7 +101,7 @@ public:
|
||||
private:
|
||||
Q_DISABLE_COPY(QPushButton)
|
||||
Q_DECLARE_PRIVATE(QPushButton)
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_popupPressed())
|
||||
#endif
|
||||
};
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
#if 0 // Used to be included in Qt4 for Q_WS_MAC
|
||||
bool hitButton(const QPoint &pos);
|
||||
#endif
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
QPoint adjustedMenuPosition();
|
||||
#endif
|
||||
void resetLayoutItemMargins();
|
||||
|
@ -44,7 +44,9 @@
|
||||
#include "qscrollbar.h"
|
||||
#include "qstyle.h"
|
||||
#include "qstyleoption.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#endif
|
||||
#include <QtCore/qelapsedtimer.h>
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
@ -395,7 +397,7 @@ void QScrollBar::contextMenuEvent(QContextMenuEvent *event)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
bool horiz = HORIZONTAL;
|
||||
QPointer<QMenu> menu = new QMenu(this);
|
||||
QAction *actScrollHere = menu->addAction(tr("Scroll here"));
|
||||
@ -426,7 +428,7 @@ void QScrollBar::contextMenuEvent(QContextMenuEvent *event)
|
||||
triggerAction(QAbstractSlider::SliderSingleStepSub);
|
||||
else if (actionSelected == actScrollDn)
|
||||
triggerAction(QAbstractSlider::SliderSingleStepAdd);
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
}
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
|
||||
|
@ -51,7 +51,9 @@
|
||||
#include <qdebug.h>
|
||||
#include <qdrag.h>
|
||||
#include <qclipboard.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#include <qstyle.h>
|
||||
#include <qtimer.h>
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
|
@ -59,7 +59,9 @@
|
||||
#endif
|
||||
#include "QtGui/qtextcursor.h"
|
||||
#include "QtGui/qtextformat.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "QtWidgets/qmenu.h"
|
||||
#endif
|
||||
#include "QtGui/qabstracttextdocumentlayout.h"
|
||||
#include "QtCore/qbasictimer.h"
|
||||
#include "QtCore/qurl.h"
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include <qdrawutil.h>
|
||||
#include <qevent.h>
|
||||
#include <qicon.h>
|
||||
#include <qmenu.h>
|
||||
#include <qpainter.h>
|
||||
#include <qpointer.h>
|
||||
#include <qstyle.h>
|
||||
@ -58,7 +57,10 @@
|
||||
#include <qstylepainter.h>
|
||||
#include <private/qabstractbutton_p.h>
|
||||
#include <private/qaction_p.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#include <private/qmenu_p.h>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -67,7 +69,7 @@ class QToolButtonPrivate : public QAbstractButtonPrivate
|
||||
Q_DECLARE_PUBLIC(QToolButton)
|
||||
public:
|
||||
void init();
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
void _q_buttonPressed();
|
||||
void _q_buttonReleased();
|
||||
void popupTimerDone();
|
||||
@ -91,14 +93,14 @@ public:
|
||||
uint autoRaise : 1;
|
||||
uint repeat : 1;
|
||||
QAction *defaultAction;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
bool hasMenu() const;
|
||||
//workaround for task 177850
|
||||
QList<QAction *> actionsCopy;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
bool QToolButtonPrivate::hasMenu() const
|
||||
{
|
||||
return ((defaultAction && defaultAction->menu())
|
||||
@ -216,7 +218,7 @@ void QToolButtonPrivate::init()
|
||||
q->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed,
|
||||
QSizePolicy::ToolButton));
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
QObject::connect(q, SIGNAL(pressed()), q, SLOT(_q_buttonPressed()));
|
||||
QObject::connect(q, SIGNAL(released()), q, SLOT(_q_buttonReleased()));
|
||||
#endif
|
||||
@ -288,7 +290,7 @@ void QToolButton::initStyleOption(QStyleOptionToolButton *option) const
|
||||
option->features |= QStyleOptionToolButton::Arrow;
|
||||
if (d->popupMode == QToolButton::DelayedPopup)
|
||||
option->features |= QStyleOptionToolButton::PopupDelay;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (d->hasMenu())
|
||||
option->features |= QStyleOptionToolButton::HasMenu;
|
||||
#endif
|
||||
@ -473,7 +475,7 @@ void QToolButton::actionEvent(QActionEvent *event)
|
||||
case QEvent::ActionRemoved:
|
||||
if (d->defaultAction == action)
|
||||
d->defaultAction = 0;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (action == d->menuAction)
|
||||
d->menuAction = 0;
|
||||
#endif
|
||||
@ -552,7 +554,7 @@ void QToolButton::leaveEvent(QEvent * e)
|
||||
*/
|
||||
void QToolButton::timerEvent(QTimerEvent *e)
|
||||
{
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
Q_D(QToolButton);
|
||||
if (e->timerId() == d->popupTimer.timerId()) {
|
||||
d->popupTimerDone();
|
||||
@ -591,7 +593,7 @@ void QToolButton::changeEvent(QEvent *e)
|
||||
void QToolButton::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
Q_D(QToolButton);
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
QStyleOptionToolButton opt;
|
||||
initStyleOption(&opt);
|
||||
if (e->button() == Qt::LeftButton && (d->popupMode == MenuButtonPopup)) {
|
||||
@ -630,7 +632,7 @@ bool QToolButton::hitButton(const QPoint &pos) const
|
||||
}
|
||||
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
/*!
|
||||
Associates the given \a menu with this tool button.
|
||||
|
||||
@ -823,10 +825,7 @@ void QToolButtonPrivate::_q_menuTriggered(QAction *action)
|
||||
if (action && !actionsCopy.contains(action))
|
||||
emit q->triggered(action);
|
||||
}
|
||||
#endif // QT_NO_MENU
|
||||
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
/*! \enum QToolButton::ToolButtonPopupMode
|
||||
|
||||
Describes how a menu should be popped up for tool buttons that has
|
||||
@ -901,7 +900,7 @@ bool QToolButton::autoRaise() const
|
||||
void QToolButton::setDefaultAction(QAction *action)
|
||||
{
|
||||
Q_D(QToolButton);
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
bool hadMenu = false;
|
||||
hadMenu = d->hasMenu();
|
||||
#endif
|
||||
@ -926,7 +925,7 @@ void QToolButton::setDefaultAction(QAction *action)
|
||||
#if QT_CONFIG(whatsthis)
|
||||
setWhatsThis(action->whatsThis());
|
||||
#endif
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (action->menu() && !hadMenu) {
|
||||
// new 'default' popup mode defined introduced by tool bar. We
|
||||
// should have changed QToolButton's default instead. Do that
|
||||
|
@ -56,7 +56,7 @@ class Q_WIDGETS_EXPORT QToolButton : public QAbstractButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_ENUMS(Qt::ToolButtonStyle Qt::ArrowType)
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
Q_PROPERTY(ToolButtonPopupMode popupMode READ popupMode WRITE setPopupMode)
|
||||
#endif
|
||||
Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle)
|
||||
@ -82,7 +82,7 @@ public:
|
||||
Qt::ArrowType arrowType() const;
|
||||
void setArrowType(Qt::ArrowType type);
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
void setMenu(QMenu* menu);
|
||||
QMenu* menu() const;
|
||||
|
||||
@ -96,7 +96,7 @@ public:
|
||||
bool autoRaise() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
void showMenu();
|
||||
#endif
|
||||
void setToolButtonStyle(Qt::ToolButtonStyle style);
|
||||
@ -124,7 +124,7 @@ protected:
|
||||
private:
|
||||
Q_DISABLE_COPY(QToolButton)
|
||||
Q_DECLARE_PRIVATE(QToolButton)
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_buttonPressed())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_buttonReleased())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_updateButtonDown())
|
||||
|
@ -48,7 +48,9 @@
|
||||
#include <qdebug.h>
|
||||
#include <qdrag.h>
|
||||
#include <qclipboard.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#include <qstyle.h>
|
||||
#include <qtimer.h>
|
||||
#include "private/qtextdocumentlayout_p.h"
|
||||
|
@ -59,7 +59,9 @@
|
||||
#if QT_CONFIG(textedit)
|
||||
#include <QtWidgets/qtextedit.h>
|
||||
#endif
|
||||
#if QT_CONFIG(menu)
|
||||
#include <QtWidgets/qmenu.h>
|
||||
#endif
|
||||
#include <QtCore/qrect.h>
|
||||
#include <QtGui/qabstracttextdocumentlayout.h>
|
||||
#include <QtGui/qtextdocumentfragment.h>
|
||||
|
@ -55,7 +55,9 @@
|
||||
#include "QtGui/qtextdocumentfragment.h"
|
||||
#include "QtGui/qtextcursor.h"
|
||||
#include "QtGui/qtextformat.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "QtWidgets/qmenu.h"
|
||||
#endif
|
||||
#include "QtGui/qabstracttextdocumentlayout.h"
|
||||
#include "QtCore/qbasictimer.h"
|
||||
#include "QtCore/qpointer.h"
|
||||
|
@ -3,8 +3,6 @@
|
||||
HEADERS += \
|
||||
widgets/qframe.h \
|
||||
widgets/qframe_p.h \
|
||||
widgets/qmenu.h \
|
||||
widgets/qmenu_p.h \
|
||||
widgets/qtoolbar.h \
|
||||
widgets/qtoolbar_p.h \
|
||||
widgets/qtoolbarlayout_p.h \
|
||||
@ -17,7 +15,6 @@ HEADERS += \
|
||||
|
||||
SOURCES += \
|
||||
widgets/qframe.cpp \
|
||||
widgets/qmenu.cpp \
|
||||
widgets/qtoolbar.cpp \
|
||||
widgets/qtoolbarlayout.cpp \
|
||||
widgets/qtoolbarseparator.cpp \
|
||||
@ -180,6 +177,14 @@ qtConfig(mdiarea) {
|
||||
widgets/qmdisubwindow.cpp
|
||||
}
|
||||
|
||||
qtConfig(menu) {
|
||||
HEADERS += \
|
||||
widgets/qmenu.h \
|
||||
widgets/qmenu_p.h
|
||||
|
||||
SOURCES += widgets/qmenu.cpp
|
||||
}
|
||||
|
||||
qtConfig(menubar) {
|
||||
HEADERS += \
|
||||
widgets/qmenubar.h \
|
||||
@ -351,7 +356,10 @@ macx {
|
||||
widgets/qmaccocoaviewcontainer_mac.h
|
||||
|
||||
OBJECTIVE_SOURCES += \
|
||||
widgets/qmenu_mac.mm \
|
||||
widgets/qmacnativewidget_mac.mm \
|
||||
widgets/qmaccocoaviewcontainer_mac.mm
|
||||
|
||||
qtConfig(menu)|qtConfig(menubar) {
|
||||
SOURCES += widgets/qmenu_mac.mm
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user