fix build with various QT_NO_* defines

Done-with: Andriy Gerasika <andriy.gerasika@gmail.com>
Change-Id: I90883a491dbddb005c3d756c339e42285d50e437
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Nick Shaforostoff 2016-04-13 00:47:50 +03:00 committed by Ulf Hermann
parent 15c39dfe3d
commit 8adad2fe09
67 changed files with 411 additions and 56 deletions

View File

@ -107,7 +107,7 @@ Name: QSharedMemory
Feature: SYSTEMSEMAPHORE Feature: SYSTEMSEMAPHORE
Description: Provides a general counting system semaphore. Description: Provides a general counting system semaphore.
Section: Kernel Section: Kernel
Requires: Requires: SHAREDMEMORY
Name: QSystemSemaphore Name: QSystemSemaphore
Feature: XMLSTREAM Feature: XMLSTREAM
@ -500,7 +500,7 @@ Name: QColorDialog
Feature: FILEDIALOG Feature: FILEDIALOG
Description: Supports a dialog widget for selecting files or directories. Description: Supports a dialog widget for selecting files or directories.
Section: Dialogs Section: Dialogs
Requires: DIRMODEL TREEVIEW COMBOBOX TOOLBUTTON BUTTONGROUP TOOLTIP SPLITTER STACKEDWIDGET PROXYMODEL Requires: FILESYSTEMMODEL TREEVIEW COMBOBOX TOOLBUTTON BUTTONGROUP TOOLTIP SPLITTER STACKEDWIDGET PROXYMODEL
Name: QFileDialog Name: QFileDialog
Feature: FONTDIALOG Feature: FONTDIALOG
@ -512,7 +512,7 @@ Name: QFontDialog
Feature: PRINTDIALOG Feature: PRINTDIALOG
Description: Supports a dialog widget for specifying printer configuration. Description: Supports a dialog widget for specifying printer configuration.
Section: Dialogs Section: Dialogs
Requires: PRINTER COMBOBOX BUTTONGROUP SPINBOX TREEVIEW TABWIDGET Requires: PRINTER COMBOBOX BUTTONGROUP SPINBOX TABWIDGET
Name: QPrintDialog Name: QPrintDialog
Feature: PRINTPREVIEWDIALOG Feature: PRINTPREVIEWDIALOG

View File

@ -40,6 +40,10 @@
#ifndef QITEMSELECTIONMODEL_H #ifndef QITEMSELECTIONMODEL_H
#define QITEMSELECTIONMODEL_H #define QITEMSELECTIONMODEL_H
#include <QtCore/qglobal.h>
#ifndef QT_NO_ITEMVIEWS
#include <QtCore/qset.h> #include <QtCore/qset.h>
#include <QtCore/qvector.h> #include <QtCore/qvector.h>
#include <QtCore/qlist.h> #include <QtCore/qlist.h>
@ -47,9 +51,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_ITEMVIEWS
class Q_CORE_EXPORT QItemSelectionRange class Q_CORE_EXPORT QItemSelectionRange
{ {
@ -272,11 +273,11 @@ Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QItemSelection)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QItemSelectionRange &); Q_CORE_EXPORT QDebug operator<<(QDebug, const QItemSelectionRange &);
#endif #endif
#endif // QT_NO_ITEMVIEWS
QT_END_NAMESPACE QT_END_NAMESPACE
Q_DECLARE_METATYPE(QItemSelectionRange) Q_DECLARE_METATYPE(QItemSelectionRange)
Q_DECLARE_METATYPE(QItemSelection) Q_DECLARE_METATYPE(QItemSelection)
#endif // QT_NO_ITEMVIEWS
#endif // QITEMSELECTIONMODEL_H #endif // QITEMSELECTIONMODEL_H

View File

@ -51,6 +51,10 @@
// We mean it. // We mean it.
// //
#include <QtCore/qglobal.h>
#ifndef QT_NO_STATEMACHINE
#include <private/qobject_p.h> #include <private/qobject_p.h>
#include <QtCore/qabstractstate.h> #include <QtCore/qabstractstate.h>
@ -94,4 +98,6 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif #endif // QT_NO_STATEMACHINE
#endif // QABSTRACTSTATE_P_H

View File

@ -53,6 +53,8 @@
#include "private/qabstractstate_p.h" #include "private/qabstractstate_p.h"
#ifndef QT_NO_STATEMACHINE
#include <QtCore/qabstracttransition.h> #include <QtCore/qabstracttransition.h>
#include <QtCore/qhistorystate.h> #include <QtCore/qhistorystate.h>
#include <QtCore/qlist.h> #include <QtCore/qlist.h>
@ -93,4 +95,6 @@ protected:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif #endif // QT_NO_STATEMACHINE
#endif // QHISTORYSTATE_P_H

View File

@ -3975,6 +3975,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
dbg << ')'; dbg << ')';
} }
break; break;
#ifndef QT_NO_SHORTCUT
case QEvent::Shortcut: { case QEvent::Shortcut: {
const QShortcutEvent *se = static_cast<const QShortcutEvent *>(e); const QShortcutEvent *se = static_cast<const QShortcutEvent *>(e);
dbg << "QShortcutEvent(" << se->key().toString() << ", id=" << se->shortcutId(); dbg << "QShortcutEvent(" << se->key().toString() << ", id=" << se->shortcutId();
@ -3983,6 +3984,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
dbg << ')'; dbg << ')';
} }
break; break;
#endif
case QEvent::FocusAboutToChange: case QEvent::FocusAboutToChange:
case QEvent::FocusIn: case QEvent::FocusIn:
case QEvent::FocusOut: case QEvent::FocusOut:

View File

@ -83,7 +83,9 @@ public:
virtual void setRole(MenuRole role) = 0; virtual void setRole(MenuRole role) = 0;
virtual void setCheckable(bool checkable) = 0; virtual void setCheckable(bool checkable) = 0;
virtual void setChecked(bool isChecked) = 0; virtual void setChecked(bool isChecked) = 0;
#ifndef QT_NO_SHORTCUT
virtual void setShortcut(const QKeySequence& shortcut) = 0; virtual void setShortcut(const QKeySequence& shortcut) = 0;
#endif
virtual void setEnabled(bool enabled) = 0; virtual void setEnabled(bool enabled) = 0;
virtual void setIconSize(int size) = 0; virtual void setIconSize(int size) = 0;
virtual void setNativeContents(WId item) { Q_UNUSED(item); } virtual void setNativeContents(WId item) { Q_UNUSED(item); }

View File

@ -153,6 +153,7 @@ QT_BEGIN_NAMESPACE
*/ */
#ifndef QT_NO_SHORTCUT
// Table of key bindings. It must be sorted on key sequence: // Table of key bindings. It must be sorted on key sequence:
// The integer value of VK_KEY | Modifier Keys (e.g., VK_META, and etc.) // The integer value of VK_KEY | Modifier Keys (e.g., VK_META, and etc.)
// A priority of 1 indicates that this is the primary key binding when multiple are defined. // A priority of 1 indicates that this is the primary key binding when multiple are defined.
@ -336,6 +337,7 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
}; };
const uint QPlatformThemePrivate::numberOfKeyBindings = sizeof(QPlatformThemePrivate::keyBindings)/(sizeof(QKeyBinding)); const uint QPlatformThemePrivate::numberOfKeyBindings = sizeof(QPlatformThemePrivate::keyBindings)/(sizeof(QKeyBinding));
#endif
QPlatformThemePrivate::QPlatformThemePrivate() QPlatformThemePrivate::QPlatformThemePrivate()
: systemPalette(0) : systemPalette(0)
@ -591,6 +593,7 @@ static inline int maybeSwapShortcut(int shortcut)
} }
#endif #endif
#ifndef QT_NO_SHORTCUT
// mixed-mode predicate: all of these overloads are actually needed (but not all for every compiler) // mixed-mode predicate: all of these overloads are actually needed (but not all for every compiler)
struct ByStandardKey { struct ByStandardKey {
typedef bool result_type; typedef bool result_type;
@ -641,6 +644,7 @@ QList<QKeySequence> QPlatformTheme::keyBindings(QKeySequence::StandardKey key) c
return list; return list;
} }
#endif
/*! /*!
Returns the text of a standard \a button. Returns the text of a standard \a button.
@ -738,10 +742,12 @@ unsigned QPlatformThemePrivate::currentKeyPlatforms()
{ {
const uint keyboardScheme = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::KeyboardScheme).toInt(); const uint keyboardScheme = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::KeyboardScheme).toInt();
unsigned result = 1u << keyboardScheme; unsigned result = 1u << keyboardScheme;
#ifndef QT_NO_SHORTCUT
if (keyboardScheme == QPlatformTheme::KdeKeyboardScheme if (keyboardScheme == QPlatformTheme::KdeKeyboardScheme
|| keyboardScheme == QPlatformTheme::GnomeKeyboardScheme || keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
|| keyboardScheme == QPlatformTheme::CdeKeyboardScheme) || keyboardScheme == QPlatformTheme::CdeKeyboardScheme)
result |= KB_X11; result |= KB_X11;
#endif
return result; return result;
} }

View File

@ -306,7 +306,9 @@ public:
QPlatformTheme::IconOptions iconOptions = 0) const; QPlatformTheme::IconOptions iconOptions = 0) const;
virtual QIconEngine *createIconEngine(const QString &iconName) const; virtual QIconEngine *createIconEngine(const QString &iconName) const;
#ifndef QT_NO_SHORTCUT
virtual QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const; virtual QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const;
#endif
virtual QString standardButtonText(int button) const; virtual QString standardButtonText(int button) const;

View File

@ -67,8 +67,10 @@ public:
void initializeSystemPalette(); void initializeSystemPalette();
#ifndef QT_NO_SHORTCUT
static const QKeyBinding keyBindings[]; static const QKeyBinding keyBindings[];
static const uint numberOfKeyBindings; static const uint numberOfKeyBindings;
#endif
static unsigned currentKeyPlatforms(); static unsigned currentKeyPlatforms();

View File

@ -236,7 +236,7 @@ bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestam
#else #else
Q_UNUSED(window) Q_UNUSED(window)
Q_UNUSED(timestamp) Q_UNUSED(timestamp)
Q_UNUSED(key) Q_UNUSED(keyCode)
Q_UNUSED(modifiers) Q_UNUSED(modifiers)
Q_UNUSED(nativeScanCode) Q_UNUSED(nativeScanCode)
Q_UNUSED(nativeVirtualKey) Q_UNUSED(nativeVirtualKey)

View File

@ -190,11 +190,13 @@ QDBusMenuItem::QDBusMenuItem(const QDBusPlatformMenuItem *item)
m_properties.insert(QLatin1String("toggle-type"), toggleType); m_properties.insert(QLatin1String("toggle-type"), toggleType);
m_properties.insert(QLatin1String("toggle-state"), item->isChecked() ? 1 : 0); m_properties.insert(QLatin1String("toggle-state"), item->isChecked() ? 1 : 0);
} }
#ifndef QT_NO_SHORTCUT
const QKeySequence &scut = item->shortcut(); const QKeySequence &scut = item->shortcut();
if (!scut.isEmpty()) { if (!scut.isEmpty()) {
QDBusMenuShortcut shortcut = convertKeySequence(scut); QDBusMenuShortcut shortcut = convertKeySequence(scut);
m_properties.insert(QLatin1String("shortcut"), QVariant::fromValue(shortcut)); m_properties.insert(QLatin1String("shortcut"), QVariant::fromValue(shortcut));
} }
#endif
const QIcon &icon = item->icon(); const QIcon &icon = item->icon();
if (!icon.name().isEmpty()) { if (!icon.name().isEmpty()) {
m_properties.insert(QLatin1String("icon-name"), icon.name()); m_properties.insert(QLatin1String("icon-name"), icon.name());
@ -230,6 +232,7 @@ QString QDBusMenuItem::convertMnemonic(const QString &label)
return ret; return ret;
} }
#ifndef QT_NO_SHORTCUT
QDBusMenuShortcut QDBusMenuItem::convertKeySequence(const QKeySequence &sequence) QDBusMenuShortcut QDBusMenuItem::convertKeySequence(const QKeySequence &sequence)
{ {
QDBusMenuShortcut shortcut; QDBusMenuShortcut shortcut;
@ -258,6 +261,7 @@ QDBusMenuShortcut QDBusMenuItem::convertKeySequence(const QKeySequence &sequence
} }
return shortcut; return shortcut;
} }
#endif
const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuEvent &ev) const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuEvent &ev)
{ {

View File

@ -74,7 +74,9 @@ public:
static QDBusMenuItemList items(const QList<int> &ids, const QStringList &propertyNames); static QDBusMenuItemList items(const QList<int> &ids, const QStringList &propertyNames);
static QString convertMnemonic(const QString &label); static QString convertMnemonic(const QString &label);
#ifndef QT_NO_SHORTCUT
static QDBusMenuShortcut convertKeySequence(const QKeySequence &sequence); static QDBusMenuShortcut convertKeySequence(const QKeySequence &sequence);
#endif
static void registerDBusTypes(); static void registerDBusTypes();
int m_id; int m_id;

View File

@ -132,10 +132,12 @@ void QDBusPlatformMenuItem::setHasExclusiveGroup(bool hasExclusiveGroup)
m_hasExclusiveGroup = hasExclusiveGroup; m_hasExclusiveGroup = hasExclusiveGroup;
} }
#ifndef QT_NO_SHORTCUT
void QDBusPlatformMenuItem::setShortcut(const QKeySequence &shortcut) void QDBusPlatformMenuItem::setShortcut(const QKeySequence &shortcut)
{ {
m_shortcut = shortcut; m_shortcut = shortcut;
} }
#endif
void QDBusPlatformMenuItem::trigger() void QDBusPlatformMenuItem::trigger()
{ {

View File

@ -99,8 +99,10 @@ public:
void setChecked(bool isChecked) Q_DECL_OVERRIDE; void setChecked(bool isChecked) Q_DECL_OVERRIDE;
bool hasExclusiveGroup() const { return m_hasExclusiveGroup; } bool hasExclusiveGroup() const { return m_hasExclusiveGroup; }
void setHasExclusiveGroup(bool hasExclusiveGroup) Q_DECL_OVERRIDE; void setHasExclusiveGroup(bool hasExclusiveGroup) Q_DECL_OVERRIDE;
#ifndef QT_NO_SHORTCUT
QKeySequence shortcut() const { return m_shortcut; } QKeySequence shortcut() const { return m_shortcut; }
void setShortcut(const QKeySequence& shortcut) Q_DECL_OVERRIDE; void setShortcut(const QKeySequence& shortcut) Q_DECL_OVERRIDE;
#endif
void setIconSize(int size) Q_DECL_OVERRIDE { Q_UNUSED(size); } void setIconSize(int size) Q_DECL_OVERRIDE { Q_UNUSED(size); }
void setNativeContents(WId item) Q_DECL_OVERRIDE { Q_UNUSED(item); } void setNativeContents(WId item) Q_DECL_OVERRIDE { Q_UNUSED(item); }

View File

@ -37,9 +37,10 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qdbustrayicon_p.h"
#ifndef QT_NO_SYSTEMTRAYICON #ifndef QT_NO_SYSTEMTRAYICON
#include "qdbustrayicon_p.h"
#include "qdbusmenuconnection_p.h" #include "qdbusmenuconnection_p.h"
#include "qstatusnotifieritemadaptor_p.h" #include "qstatusnotifieritemadaptor_p.h"
#include "qdbusmenuadaptor_p.h" #include "qdbusmenuadaptor_p.h"
@ -299,4 +300,3 @@ bool QDBusTrayIcon::isSystemTrayAvailable() const
QT_END_NAMESPACE QT_END_NAMESPACE
#endif //QT_NO_SYSTEMTRAYICON #endif //QT_NO_SYSTEMTRAYICON

View File

@ -52,6 +52,8 @@
// We mean it. // We mean it.
// //
#include <QtCore/qglobal.h>
#ifndef QT_NO_SYSTEMTRAYICON #ifndef QT_NO_SYSTEMTRAYICON
#include <QIcon> #include <QIcon>
@ -162,6 +164,6 @@ private:
}; };
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_SYSTEMTRAYICON
#endif // QT_NO_SYSTEMTRAYICON
#endif // QDBUSTRAYICON_H #endif // QDBUSTRAYICON_H

View File

@ -48,9 +48,10 @@
QMetaObject::invokeMethod(). QMetaObject::invokeMethod().
*/ */
#include "qstatusnotifieritemadaptor_p.h"
#ifndef QT_NO_SYSTEMTRAYICON #ifndef QT_NO_SYSTEMTRAYICON
#include "qstatusnotifieritemadaptor_p.h"
#include "qdbustrayicon_p.h" #include "qdbustrayicon_p.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -62,6 +62,8 @@
// We mean it. // We mean it.
// //
#include <QtCore/qglobal.h>
#ifndef QT_NO_SYSTEMTRAYICON #ifndef QT_NO_SYSTEMTRAYICON
#include <QtCore/QObject> #include <QtCore/QObject>

View File

@ -101,11 +101,13 @@ QIBusPlatformInputContext::QIBusPlatformInputContext ()
QString socketPath = QIBusPlatformInputContextPrivate::getSocketPath(); QString socketPath = QIBusPlatformInputContextPrivate::getSocketPath();
QFile file(socketPath); QFile file(socketPath);
if (file.open(QFile::ReadOnly)) { if (file.open(QFile::ReadOnly)) {
#ifndef QT_NO_FILESYSTEMWATCHER
// If KDE session save is used or restart ibus-daemon, // If KDE session save is used or restart ibus-daemon,
// the applications could run before ibus-daemon runs. // the applications could run before ibus-daemon runs.
// We watch the getSocketPath() to get the launching ibus-daemon. // We watch the getSocketPath() to get the launching ibus-daemon.
m_socketWatcher.addPath(socketPath); m_socketWatcher.addPath(socketPath);
connect(&m_socketWatcher, SIGNAL(fileChanged(QString)), this, SLOT(socketChanged(QString))); connect(&m_socketWatcher, SIGNAL(fileChanged(QString)), this, SLOT(socketChanged(QString)));
#endif
} }
m_timer.setSingleShot(true); m_timer.setSingleShot(true);
@ -408,8 +410,10 @@ void QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher *cal
&& window != NULL) { && window != NULL) {
const QPoint globalPos = window->screen()->handle()->cursor()->pos(); const QPoint globalPos = window->screen()->handle()->cursor()->pos();
const QPoint pos = window->mapFromGlobal(globalPos); const QPoint pos = window->mapFromGlobal(globalPos);
#ifndef QT_NO_CONTEXTMENU
QWindowSystemInterface::handleContextMenuEvent(window, false, pos, QWindowSystemInterface::handleContextMenuEvent(window, false, pos,
globalPos, modifiers); globalPos, modifiers);
#endif
} }
#endif // QT_NO_CONTEXTMENU #endif // QT_NO_CONTEXTMENU
QWindowSystemInterface::handleExtendedKeyEvent(window, time, type, qtcode, modifiers, QWindowSystemInterface::handleExtendedKeyEvent(window, time, type, qtcode, modifiers,
@ -449,8 +453,10 @@ void QIBusPlatformInputContext::connectToBus()
d->initBus(); d->initBus();
connectToContextSignals(); connectToContextSignals();
#ifndef QT_NO_FILESYSTEMWATCHER
if (m_socketWatcher.files().size() == 0) if (m_socketWatcher.files().size() == 0)
m_socketWatcher.addPath(QIBusPlatformInputContextPrivate::getSocketPath()); m_socketWatcher.addPath(QIBusPlatformInputContextPrivate::getSocketPath());
#endif
} }
void QIBusPlatformInputContext::globalEngineChanged(const QString &engine_name) void QIBusPlatformInputContext::globalEngineChanged(const QString &engine_name)

View File

@ -110,7 +110,9 @@ public Q_SLOTS:
private: private:
QIBusPlatformInputContextPrivate *d; QIBusPlatformInputContextPrivate *d;
bool m_eventFilterUseSynchronousMode; bool m_eventFilterUseSynchronousMode;
#ifndef QT_NO_FILESYSTEMWATCHER
QFileSystemWatcher m_socketWatcher; QFileSystemWatcher m_socketWatcher;
#endif
QTimer m_timer; QTimer m_timer;
void connectToContextSignals(); void connectToContextSignals();

View File

@ -41,6 +41,9 @@
#define QCOCOACLIPBOARD_H #define QCOCOACLIPBOARD_H
#include <qpa/qplatformclipboard.h> #include <qpa/qplatformclipboard.h>
#ifndef QT_NO_CLIPBOARD
#include "qmacclipboard.h" #include "qmacclipboard.h"
#include <QtCore/QScopedPointer> #include <QtCore/QScopedPointer>
@ -71,4 +74,6 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif #endif // QT_NO_CLIPBOARD
#endif // QCOCOACLIPBOARD_H

View File

@ -39,6 +39,8 @@
#include "qcocoaclipboard.h" #include "qcocoaclipboard.h"
#ifndef QT_NO_CLIPBOARD
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QCocoaClipboard::QCocoaClipboard() QCocoaClipboard::QCocoaClipboard()
@ -105,3 +107,5 @@ void QCocoaClipboard::handleApplicationStateChanged(Qt::ApplicationState state)
#include "moc_qcocoaclipboard.cpp" #include "moc_qcocoaclipboard.cpp"
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_CLIPBOARD

View File

@ -130,7 +130,9 @@ public:
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
QCocoaAccessibility *accessibility() const Q_DECL_OVERRIDE; QCocoaAccessibility *accessibility() const Q_DECL_OVERRIDE;
#endif #endif
#ifndef QT_NO_CLIPBOARD
QCocoaClipboard *clipboard() const Q_DECL_OVERRIDE; QCocoaClipboard *clipboard() const Q_DECL_OVERRIDE;
#endif
QCocoaDrag *drag() const Q_DECL_OVERRIDE; QCocoaDrag *drag() const Q_DECL_OVERRIDE;
QStringList themeNames() const Q_DECL_OVERRIDE; QStringList themeNames() const Q_DECL_OVERRIDE;
@ -169,7 +171,9 @@ private:
#endif #endif
QScopedPointer<QPlatformTheme> mPlatformTheme; QScopedPointer<QPlatformTheme> mPlatformTheme;
QList<QCocoaScreen *> mScreens; QList<QCocoaScreen *> mScreens;
#ifndef QT_NO_CLIPBOARD
QCocoaClipboard *mCocoaClipboard; QCocoaClipboard *mCocoaClipboard;
#endif
QScopedPointer<QCocoaDrag> mCocoaDrag; QScopedPointer<QCocoaDrag> mCocoaDrag;
QScopedPointer<QCocoaNativeInterface> mNativeInterface; QScopedPointer<QCocoaNativeInterface> mNativeInterface;
QScopedPointer<QCocoaServices> mServices; QScopedPointer<QCocoaServices> mServices;

View File

@ -283,7 +283,9 @@ QCocoaIntegration::QCocoaIntegration(const QStringList &paramList)
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
, mAccessibility(new QCocoaAccessibility) , mAccessibility(new QCocoaAccessibility)
#endif #endif
#ifndef QT_NO_CLIPBOARD
, mCocoaClipboard(new QCocoaClipboard) , mCocoaClipboard(new QCocoaClipboard)
#endif
, mCocoaDrag(new QCocoaDrag) , mCocoaDrag(new QCocoaDrag)
, mNativeInterface(new QCocoaNativeInterface) , mNativeInterface(new QCocoaNativeInterface)
, mServices(new QCocoaServices) , mServices(new QCocoaServices)
@ -366,11 +368,13 @@ QCocoaIntegration::~QCocoaIntegration()
[[NSApplication sharedApplication] setDelegate: 0]; [[NSApplication sharedApplication] setDelegate: 0];
} }
#ifndef QT_NO_CLIPBOARD
// Delete the clipboard integration and destroy mime type converters. // Delete the clipboard integration and destroy mime type converters.
// Deleting the clipboard integration flushes promised pastes using // Deleting the clipboard integration flushes promised pastes using
// the mime converters - the ordering here is important. // the mime converters - the ordering here is important.
delete mCocoaClipboard; delete mCocoaClipboard;
QMacInternalPasteboardMime::destroyMimeTypes(); QMacInternalPasteboardMime::destroyMimeTypes();
#endif
// Delete screens in reverse order to avoid crash in case of multiple screens // Delete screens in reverse order to avoid crash in case of multiple screens
while (!mScreens.isEmpty()) { while (!mScreens.isEmpty()) {
@ -531,10 +535,12 @@ QCocoaAccessibility *QCocoaIntegration::accessibility() const
} }
#endif #endif
#ifndef QT_NO_CLIPBOARD
QCocoaClipboard *QCocoaIntegration::clipboard() const QCocoaClipboard *QCocoaIntegration::clipboard() const
{ {
return mCocoaClipboard; return mCocoaClipboard;
} }
#endif
QCocoaDrag *QCocoaIntegration::drag() const QCocoaDrag *QCocoaIntegration::drag() const
{ {

View File

@ -90,7 +90,9 @@ public:
void setIsSeparator(bool isSeparator) Q_DECL_OVERRIDE; void setIsSeparator(bool isSeparator) Q_DECL_OVERRIDE;
void setFont(const QFont &font) Q_DECL_OVERRIDE; void setFont(const QFont &font) Q_DECL_OVERRIDE;
void setRole(MenuRole role) Q_DECL_OVERRIDE; void setRole(MenuRole role) Q_DECL_OVERRIDE;
#ifndef QT_NO_SHORTCUT
void setShortcut(const QKeySequence& shortcut) Q_DECL_OVERRIDE; void setShortcut(const QKeySequence& shortcut) Q_DECL_OVERRIDE;
#endif
void setCheckable(bool checkable) Q_DECL_OVERRIDE { Q_UNUSED(checkable) } void setCheckable(bool checkable) Q_DECL_OVERRIDE { Q_UNUSED(checkable) }
void setChecked(bool isChecked) Q_DECL_OVERRIDE; void setChecked(bool isChecked) Q_DECL_OVERRIDE;
void setEnabled(bool isEnabled) Q_DECL_OVERRIDE; void setEnabled(bool isEnabled) Q_DECL_OVERRIDE;
@ -128,7 +130,9 @@ private:
QFont m_font; QFont m_font;
MenuRole m_role; MenuRole m_role;
MenuRole m_detectedRole; MenuRole m_detectedRole;
#ifndef QT_NO_SHORTCUT
QKeySequence m_shortcut; QKeySequence m_shortcut;
#endif
bool m_checked; bool m_checked;
bool m_merged; bool m_merged;
quintptr m_tag; quintptr m_tag;

View File

@ -68,6 +68,7 @@ static quint32 constructModifierMask(quint32 accel_key)
return ret; return ret;
} }
#ifndef QT_NO_SHORTCUT
// return an autoreleased string given a QKeySequence (currently only looks at the first one). // return an autoreleased string given a QKeySequence (currently only looks at the first one).
NSString *keySequenceToKeyEqivalent(const QKeySequence &accel) NSString *keySequenceToKeyEqivalent(const QKeySequence &accel)
{ {
@ -86,6 +87,7 @@ NSUInteger keySequenceModifierMask(const QKeySequence &accel)
{ {
return constructModifierMask(accel[0]); return constructModifierMask(accel[0]);
} }
#endif
QCocoaMenuItem::QCocoaMenuItem() : QCocoaMenuItem::QCocoaMenuItem() :
m_native(NULL), m_native(NULL),
@ -174,10 +176,12 @@ void QCocoaMenuItem::setRole(MenuRole role)
m_role = role; m_role = role;
} }
#ifndef QT_NO_SHORTCUT
void QCocoaMenuItem::setShortcut(const QKeySequence& shortcut) void QCocoaMenuItem::setShortcut(const QKeySequence& shortcut)
{ {
m_shortcut = shortcut; m_shortcut = shortcut;
} }
#endif
void QCocoaMenuItem::setChecked(bool isChecked) void QCocoaMenuItem::setChecked(bool isChecked)
{ {
@ -301,11 +305,13 @@ NSMenuItem *QCocoaMenuItem::sync()
[m_native setView:m_itemView]; [m_native setView:m_itemView];
QString text = mergeText(); QString text = mergeText();
#ifndef QT_NO_SHORTCUT
QKeySequence accel = mergeAccel(); QKeySequence accel = mergeAccel();
// Show multiple key sequences as part of the menu text. // Show multiple key sequences as part of the menu text.
if (accel.count() > 1) if (accel.count() > 1)
text += QLatin1String(" (") + accel.toString(QKeySequence::NativeText) + QLatin1String(")"); text += QLatin1String(" (") + accel.toString(QKeySequence::NativeText) + QLatin1String(")");
#endif
QString finalString = QPlatformTheme::removeMnemonics(text); QString finalString = QPlatformTheme::removeMnemonics(text);
bool useAttributedTitle = false; bool useAttributedTitle = false;
@ -327,10 +333,13 @@ NSMenuItem *QCocoaMenuItem::sync()
[m_native setTitle: QCFString::toNSString(finalString)]; [m_native setTitle: QCFString::toNSString(finalString)];
} }
#ifndef QT_NO_SHORTCUT
if (accel.count() == 1) { if (accel.count() == 1) {
[m_native setKeyEquivalent:keySequenceToKeyEqivalent(accel)]; [m_native setKeyEquivalent:keySequenceToKeyEqivalent(accel)];
[m_native setKeyEquivalentModifierMask:keySequenceModifierMask(accel)]; [m_native setKeyEquivalentModifierMask:keySequenceModifierMask(accel)];
} else { } else
#endif
{
[m_native setKeyEquivalent:@""]; [m_native setKeyEquivalent:@""];
[m_native setKeyEquivalentModifierMask:NSCommandKeyMask]; [m_native setKeyEquivalentModifierMask:NSCommandKeyMask];
} }
@ -371,6 +380,7 @@ QString QCocoaMenuItem::mergeText()
return m_text; return m_text;
} }
#ifndef QT_NO_SHORTCUT
QKeySequence QCocoaMenuItem::mergeAccel() QKeySequence QCocoaMenuItem::mergeAccel()
{ {
QCocoaMenuLoader *loader = [QCocoaMenuLoader sharedMenuLoader]; QCocoaMenuLoader *loader = [QCocoaMenuLoader sharedMenuLoader];
@ -383,6 +393,7 @@ QKeySequence QCocoaMenuItem::mergeAccel()
return m_shortcut; return m_shortcut;
} }
#endif
void QCocoaMenuItem::syncMerged() void QCocoaMenuItem::syncMerged()
{ {

View File

@ -75,6 +75,9 @@
#define QT_MAC_SYSTEMTRAY_USE_GROWL #define QT_MAC_SYSTEMTRAY_USE_GROWL
#include "qcocoasystemtrayicon.h" #include "qcocoasystemtrayicon.h"
#ifndef QT_NO_SYSTEMTRAYICON
#include <qtemporaryfile.h> #include <qtemporaryfile.h>
#include <qimagewriter.h> #include <qimagewriter.h>
#include <qdebug.h> #include <qdebug.h>
@ -464,3 +467,5 @@ private:
return qmenu; return qmenu;
} }
@end @end
#endif // QT_NO_SYSTEMTRAYICON

View File

@ -137,8 +137,10 @@ bool QCocoaTheme::usePlatformNativeDialog(DialogType dialogType) const
QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(DialogType dialogType) const QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(DialogType dialogType) const
{ {
switch (dialogType) { switch (dialogType) {
#ifndef QT_NO_FILEDIALOG
case QPlatformTheme::FileDialog: case QPlatformTheme::FileDialog:
return new QCocoaFileDialogHelper(); return new QCocoaFileDialogHelper();
#endif
#ifndef QT_NO_COLORDIALOG #ifndef QT_NO_COLORDIALOG
case QPlatformTheme::ColorDialog: case QPlatformTheme::ColorDialog:
return new QCocoaColorDialogHelper(); return new QCocoaColorDialogHelper();

View File

@ -40,10 +40,13 @@
#ifndef QIOSCLIPBOARD_H #ifndef QIOSCLIPBOARD_H
#define QIOSCLIPBOARD_H #define QIOSCLIPBOARD_H
#include <qpa/qplatformclipboard.h>
#ifndef QT_NO_CLIPBOARD
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#include <QMimeData> #include <QMimeData>
#include <qpa/qplatformclipboard.h>
@class QUIClipboard; @class QUIClipboard;
@ -67,4 +70,6 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_CLIPBOARD
#endif // QIOSCLIPBOARD_H #endif // QIOSCLIPBOARD_H

View File

@ -39,6 +39,8 @@
#include "qiosclipboard.h" #include "qiosclipboard.h"
#ifndef QT_NO_CLIPBOARD
#include <QtPlatformSupport/private/qmacmime_p.h> #include <QtPlatformSupport/private/qmacmime_p.h>
#include <QtCore/QMimeData> #include <QtCore/QMimeData>
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
@ -247,3 +249,5 @@ bool QIOSClipboard::ownsMode(QClipboard::Mode mode) const
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_CLIPBOARD

View File

@ -72,7 +72,9 @@ public:
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE; QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE;
QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
#ifndef QT_NO_CLIPBOARD
QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE; QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE;
#endif
QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE; QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE;
QPlatformServices *services() const Q_DECL_OVERRIDE; QPlatformServices *services() const Q_DECL_OVERRIDE;
@ -85,7 +87,9 @@ public:
QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
QTouchDevice *touchDevice(); QTouchDevice *touchDevice();
#ifndef QT_NO_ACCESSIBILITY
QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE; QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE;
#endif
// Called from Objective-C class QIOSScreenTracker, which can't be friended // Called from Objective-C class QIOSScreenTracker, which can't be friended
void addScreen(QPlatformScreen *screen) { screenAdded(screen); } void addScreen(QPlatformScreen *screen) { screenAdded(screen); }

View File

@ -74,7 +74,7 @@ QIOSIntegration *QIOSIntegration::instance()
QIOSIntegration::QIOSIntegration() QIOSIntegration::QIOSIntegration()
: m_fontDatabase(new QCoreTextFontDatabase) : m_fontDatabase(new QCoreTextFontDatabase)
#ifndef Q_OS_TVOS #if !defined(Q_OS_TVOS) && !defined(QT_NO_CLIPBOARD)
, m_clipboard(new QIOSClipboard) , m_clipboard(new QIOSClipboard)
#endif #endif
, m_inputContext(0) , m_inputContext(0)
@ -131,7 +131,7 @@ QIOSIntegration::~QIOSIntegration()
delete m_fontDatabase; delete m_fontDatabase;
m_fontDatabase = 0; m_fontDatabase = 0;
#ifndef Q_OS_TVOS #if !defined(Q_OS_TVOS) && !defined(QT_NO_CLIPBOARD)
delete m_clipboard; delete m_clipboard;
m_clipboard = 0; m_clipboard = 0;
#endif #endif
@ -221,6 +221,7 @@ QPlatformFontDatabase * QIOSIntegration::fontDatabase() const
return m_fontDatabase; return m_fontDatabase;
} }
#ifndef QT_NO_CLIPBOARD
QPlatformClipboard *QIOSIntegration::clipboard() const QPlatformClipboard *QIOSIntegration::clipboard() const
{ {
#ifndef Q_OS_TVOS #ifndef Q_OS_TVOS
@ -229,6 +230,7 @@ QPlatformClipboard *QIOSIntegration::clipboard() const
return 0; return 0;
#endif #endif
} }
#endif
QPlatformInputContext *QIOSIntegration::inputContext() const QPlatformInputContext *QIOSIntegration::inputContext() const
{ {
@ -276,12 +278,14 @@ QTouchDevice *QIOSIntegration::touchDevice()
return m_touchDevice; return m_touchDevice;
} }
#ifndef QT_NO_ACCESSIBILITY
QPlatformAccessibility *QIOSIntegration::accessibility() const QPlatformAccessibility *QIOSIntegration::accessibility() const
{ {
if (!m_accessibility) if (!m_accessibility)
m_accessibility = new QIOSPlatformAccessibility; m_accessibility = new QIOSPlatformAccessibility;
return m_accessibility; return m_accessibility;
} }
#endif
QPlatformNativeInterface *QIOSIntegration::nativeInterface() const QPlatformNativeInterface *QIOSIntegration::nativeInterface() const
{ {

View File

@ -68,7 +68,9 @@ public:
void setRole(MenuRole role) Q_DECL_OVERRIDE; void setRole(MenuRole role) Q_DECL_OVERRIDE;
void setCheckable(bool) Q_DECL_OVERRIDE {} void setCheckable(bool) Q_DECL_OVERRIDE {}
void setChecked(bool) Q_DECL_OVERRIDE {} void setChecked(bool) Q_DECL_OVERRIDE {}
#ifndef QT_NO_SHORTCUT
void setShortcut(const QKeySequence&) Q_DECL_OVERRIDE; void setShortcut(const QKeySequence&) Q_DECL_OVERRIDE;
#endif
void setEnabled(bool enabled) Q_DECL_OVERRIDE; void setEnabled(bool enabled) Q_DECL_OVERRIDE;
void setIconSize(int) Q_DECL_OVERRIDE {} void setIconSize(int) Q_DECL_OVERRIDE {}

View File

@ -304,10 +304,12 @@ void QIOSMenuItem::setRole(QPlatformMenuItem::MenuRole role)
m_role = role; m_role = role;
} }
#ifndef QT_NO_SHORTCUT
void QIOSMenuItem::setShortcut(const QKeySequence &sequence) void QIOSMenuItem::setShortcut(const QKeySequence &sequence)
{ {
m_shortcut = sequence; m_shortcut = sequence;
} }
#endif
void QIOSMenuItem::setEnabled(bool enabled) void QIOSMenuItem::setEnabled(bool enabled)
{ {
@ -547,6 +549,7 @@ QIOSMenuItemList QIOSMenu::filterFirstResponderActions(const QIOSMenuItemList &m
for (int i = 0; i < menuItems.count(); ++i) { for (int i = 0; i < menuItems.count(); ++i) {
QIOSMenuItem *menuItem = menuItems.at(i); QIOSMenuItem *menuItem = menuItems.at(i);
#ifndef QT_NO_SHORTCUT
QKeySequence shortcut = menuItem->m_shortcut; QKeySequence shortcut = menuItem->m_shortcut;
if ((shortcut == QKeySequence::Cut && [responder canPerformAction:@selector(cut:) withSender:nil]) if ((shortcut == QKeySequence::Cut && [responder canPerformAction:@selector(cut:) withSender:nil])
|| (shortcut == QKeySequence::Copy && [responder canPerformAction:@selector(copy:) withSender:nil]) || (shortcut == QKeySequence::Copy && [responder canPerformAction:@selector(copy:) withSender:nil])
@ -560,6 +563,7 @@ QIOSMenuItemList QIOSMenu::filterFirstResponderActions(const QIOSMenuItemList &m
|| (shortcut == QKeySequence::Underline && [responder canPerformAction:@selector(toggleUnderline:) withSender:nil])) { || (shortcut == QKeySequence::Underline && [responder canPerformAction:@selector(toggleUnderline:) withSender:nil])) {
continue; continue;
} }
#endif
filteredMenuItems.append(menuItem); filteredMenuItems.append(menuItem);
} }
return filteredMenuItems; return filteredMenuItems;

View File

@ -42,6 +42,8 @@
#include <qpa/qplatformaccessibility.h> #include <qpa/qplatformaccessibility.h>
#ifndef QT_NO_ACCESSIBILITY
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QIOSPlatformAccessibility: public QPlatformAccessibility class QIOSPlatformAccessibility: public QPlatformAccessibility
@ -56,3 +58,5 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif #endif
#endif

View File

@ -39,6 +39,8 @@
#include "qiosplatformaccessibility.h" #include "qiosplatformaccessibility.h"
#ifndef QT_NO_ACCESSIBILITY
#include <QtGui/QtGui> #include <QtGui/QtGui>
#include "qioswindow.h" #include "qioswindow.h"
@ -85,3 +87,5 @@ void QIOSPlatformAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *even
break; break;
} }
} }
#endif

View File

@ -43,6 +43,8 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <QtGui/QtGui> #import <QtGui/QtGui>
#ifndef QT_NO_ACCESSIBILITY
@interface QMacAccessibilityElement : UIAccessibilityElement @interface QMacAccessibilityElement : UIAccessibilityElement
{} {}
@ -54,3 +56,4 @@
@end @end
#endif #endif
#endif

View File

@ -39,6 +39,8 @@
#include "quiaccessibilityelement.h" #include "quiaccessibilityelement.h"
#ifndef QT_NO_ACCESSIBILITY
#include "private/qaccessiblecache_p.h" #include "private/qaccessiblecache_p.h"
@implementation QMacAccessibilityElement @implementation QMacAccessibilityElement
@ -221,3 +223,5 @@
} }
@end @end
#endif

View File

@ -551,5 +551,7 @@
@end @end
#ifndef QT_NO_ACCESSIBILITY
// Include category as an alternative to using -ObjC (Apple QA1490) // Include category as an alternative to using -ObjC (Apple QA1490)
#include "quiview_accessibility.mm" #include "quiview_accessibility.mm"
#endif

View File

@ -122,7 +122,11 @@ static FontKeys &fontKeys()
QSettings::NativeFormat); QSettings::NativeFormat);
const QStringList allKeys = fontRegistry.allKeys(); const QStringList allKeys = fontRegistry.allKeys();
const QString trueType = QStringLiteral("(TrueType)"); const QString trueType = QStringLiteral("(TrueType)");
#ifndef QT_NO_REGULAREXPRESSION
const QRegularExpression sizeListMatch(QStringLiteral("\\s(\\d+,)+\\d+")); const QRegularExpression sizeListMatch(QStringLiteral("\\s(\\d+,)+\\d+"));
#else
const QRegExp sizeListMatch(QLatin1String("\\s(\\d+,)+\\d+"));
#endif
Q_ASSERT(sizeListMatch.isValid()); Q_ASSERT(sizeListMatch.isValid());
const int size = allKeys.size(); const int size = allKeys.size();
result.reserve(size); result.reserve(size);

View File

@ -1719,11 +1719,13 @@ void QXcbConnection::processXcbEvents()
compressEvent(event, i, eventqueue)) compressEvent(event, i, eventqueue))
continue; continue;
#ifndef QT_NO_CLIPBOARD
bool accepted = false; bool accepted = false;
if (clipboard()->processIncr()) if (clipboard()->processIncr())
clipboard()->incrTransactionPeeker(event, accepted); clipboard()->incrTransactionPeeker(event, accepted);
if (accepted) if (accepted)
continue; continue;
#endif
auto isWaitingFor = [=](PeekFunc peekFunc) { auto isWaitingFor = [=](PeekFunc peekFunc) {
// These callbacks return true if the event is what they were // These callbacks return true if the event is what they were

View File

@ -194,8 +194,10 @@ void QXcbDrag::startDrag()
init(); init();
#ifndef QT_NO_CLIPBOARD
xcb_set_selection_owner(xcb_connection(), connection()->clipboard()->owner(), xcb_set_selection_owner(xcb_connection(), connection()->clipboard()->owner(),
atom(QXcbAtom::XdndSelection), connection()->time()); atom(QXcbAtom::XdndSelection), connection()->time());
#endif
QStringList fmts = QXcbMime::formatsHelper(drag()->mimeData()); QStringList fmts = QXcbMime::formatsHelper(drag()->mimeData());
for (int i = 0; i < fmts.size(); ++i) { for (int i = 0; i < fmts.size(); ++i) {
@ -205,10 +207,12 @@ void QXcbDrag::startDrag()
drag_types.append(atoms.at(j)); drag_types.append(atoms.at(j));
} }
} }
#ifndef QT_NO_CLIPBOARD
if (drag_types.size() > 3) if (drag_types.size() > 3)
xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, connection()->clipboard()->owner(), xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, connection()->clipboard()->owner(),
atom(QXcbAtom::XdndTypelist), atom(QXcbAtom::XdndTypelist),
XCB_ATOM_ATOM, 32, drag_types.size(), (const void *)drag_types.constData()); XCB_ATOM_ATOM, 32, drag_types.size(), (const void *)drag_types.constData());
#endif
setUseCompositing(current_virtual_desktop->compositingActive()); setUseCompositing(current_virtual_desktop->compositingActive());
setScreen(current_virtual_desktop->screens().constFirst()->screen()); setScreen(current_virtual_desktop->screens().constFirst()->screen());
@ -447,7 +451,11 @@ void QXcbDrag::move(const QPoint &globalPos)
enter.window = target; enter.window = target;
enter.format = 32; enter.format = 32;
enter.type = atom(QXcbAtom::XdndEnter); enter.type = atom(QXcbAtom::XdndEnter);
#ifndef QT_NO_CLIPBOARD
enter.data.data32[0] = connection()->clipboard()->owner(); enter.data.data32[0] = connection()->clipboard()->owner();
#else
enter.data.data32[0] = 0;
#endif
enter.data.data32[1] = flags; enter.data.data32[1] = flags;
enter.data.data32[2] = drag_types.size()>0 ? drag_types.at(0) : 0; enter.data.data32[2] = drag_types.size()>0 ? drag_types.at(0) : 0;
enter.data.data32[3] = drag_types.size()>1 ? drag_types.at(1) : 0; enter.data.data32[3] = drag_types.size()>1 ? drag_types.at(1) : 0;
@ -476,7 +484,11 @@ void QXcbDrag::move(const QPoint &globalPos)
move.window = target; move.window = target;
move.format = 32; move.format = 32;
move.type = atom(QXcbAtom::XdndPosition); move.type = atom(QXcbAtom::XdndPosition);
#ifndef QT_NO_CLIPBOARD
move.data.data32[0] = connection()->clipboard()->owner(); move.data.data32[0] = connection()->clipboard()->owner();
#else
move.data.data32[0] = 0;
#endif
move.data.data32[1] = 0; // flags move.data.data32[1] = 0; // flags
move.data.data32[2] = (globalPos.x() << 16) + globalPos.y(); move.data.data32[2] = (globalPos.x() << 16) + globalPos.y();
move.data.data32[3] = connection()->time(); move.data.data32[3] = connection()->time();
@ -505,7 +517,11 @@ void QXcbDrag::drop(const QPoint &globalPos)
drop.window = current_target; drop.window = current_target;
drop.format = 32; drop.format = 32;
drop.type = atom(QXcbAtom::XdndDrop); drop.type = atom(QXcbAtom::XdndDrop);
#ifndef QT_NO_CLIPBOARD
drop.data.data32[0] = connection()->clipboard()->owner(); drop.data.data32[0] = connection()->clipboard()->owner();
#else
drop.data.data32[0] = 0;
#endif
drop.data.data32[1] = 0; // flags drop.data.data32[1] = 0; // flags
drop.data.data32[2] = connection()->time(); drop.data.data32[2] = connection()->time();
@ -791,9 +807,11 @@ void QXcbDrag::handle_xdnd_position(QPlatformWindow *w, const xcb_client_message
// reset // reset
target_time = XCB_CURRENT_TIME; target_time = XCB_CURRENT_TIME;
#ifndef QT_NO_CLIPBOARD
if (xdnd_dragsource == connection()->clipboard()->owner()) if (xdnd_dragsource == connection()->clipboard()->owner())
handle_xdnd_status(&response); handle_xdnd_status(&response);
else else
#endif
Q_XCB_CALL(xcb_send_event(xcb_connection(), false, current_proxy_target, Q_XCB_CALL(xcb_send_event(xcb_connection(), false, current_proxy_target,
XCB_EVENT_MASK_NO_EVENT, (const char *)&response)); XCB_EVENT_MASK_NO_EVENT, (const char *)&response));
} }
@ -859,7 +877,11 @@ void QXcbDrag::handle_xdnd_status(const xcb_client_message_event_t *event)
void QXcbDrag::handleStatus(const xcb_client_message_event_t *event) void QXcbDrag::handleStatus(const xcb_client_message_event_t *event)
{ {
if (event->window != connection()->clipboard()->owner() || !drag()) if (
#ifndef QT_NO_CLIPBOARD
event->window != connection()->clipboard()->owner() ||
#endif
!drag())
return; return;
xcb_client_message_event_t *lastEvent = const_cast<xcb_client_message_event_t *>(event); xcb_client_message_event_t *lastEvent = const_cast<xcb_client_message_event_t *>(event);
@ -914,7 +936,11 @@ void QXcbDrag::send_leave()
leave.window = current_target; leave.window = current_target;
leave.format = 32; leave.format = 32;
leave.type = atom(QXcbAtom::XdndLeave); leave.type = atom(QXcbAtom::XdndLeave);
#ifndef QT_NO_CLIPBOARD
leave.data.data32[0] = connection()->clipboard()->owner(); leave.data.data32[0] = connection()->clipboard()->owner();
#else
leave.data.data32[0] = 0;
#endif
leave.data.data32[1] = 0; // flags leave.data.data32[1] = 0; // flags
leave.data.data32[2] = 0; // x, y leave.data.data32[2] = 0; // x, y
leave.data.data32[3] = 0; // w, h leave.data.data32[3] = 0; // w, h
@ -1003,8 +1029,10 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e
void QXcbDrag::handleFinished(const xcb_client_message_event_t *event) void QXcbDrag::handleFinished(const xcb_client_message_event_t *event)
{ {
DEBUG("xdndHandleFinished"); DEBUG("xdndHandleFinished");
#ifndef QT_NO_CLIPBOARD
if (event->window != connection()->clipboard()->owner()) if (event->window != connection()->clipboard()->owner())
return; return;
#endif
const unsigned long *l = (const unsigned long *)event->data.data32; const unsigned long *l = (const unsigned long *)event->data.data32;
@ -1284,11 +1312,13 @@ QVariant QXcbDropData::xdndObtainData(const QByteArray &format, QVariant::Type r
if (a == XCB_NONE) if (a == XCB_NONE)
return result; return result;
#ifndef QT_NO_CLIPBOARD
if (c->clipboard()->getSelectionOwner(drag->atom(QXcbAtom::XdndSelection)) == XCB_NONE) if (c->clipboard()->getSelectionOwner(drag->atom(QXcbAtom::XdndSelection)) == XCB_NONE)
return result; // should never happen? return result; // should never happen?
xcb_atom_t xdnd_selection = c->atom(QXcbAtom::XdndSelection); xcb_atom_t xdnd_selection = c->atom(QXcbAtom::XdndSelection);
result = c->clipboard()->getSelection(xdnd_selection, a, xdnd_selection, drag->targetTime()); result = c->clipboard()->getSelection(xdnd_selection, a, xdnd_selection, drag->targetTime());
#endif
return mimeConvertToFormat(c, a, result, QLatin1String(format), requestedType, encoding); return mimeConvertToFormat(c, a, result, QLatin1String(format), requestedType, encoding);
} }

View File

@ -40,6 +40,8 @@
#include "qxcbsessionmanager.h" #include "qxcbsessionmanager.h"
#ifndef QT_NO_SESSIONMANAGER
#include <qguiapplication.h> #include <qguiapplication.h>
#include <qdatetime.h> #include <qdatetime.h>
#include <qfileinfo.h> #include <qfileinfo.h>
@ -491,3 +493,5 @@ void QXcbSessionManager::exitEventLoop()
} }
#include "qxcbsessionmanager.moc" #include "qxcbsessionmanager.moc"
#endif

View File

@ -52,6 +52,8 @@
#include <qpa/qplatformsessionmanager.h> #include <qpa/qplatformsessionmanager.h>
#ifndef QT_NO_SESSIONMANAGER
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QEventLoop; class QEventLoop;
@ -89,4 +91,6 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif //QT_NO_SESSIONMANAGER
#endif //QXCBSESSIONMANAGER_H #endif //QXCBSESSIONMANAGER_H

View File

@ -258,6 +258,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s)
free_prop = true; free_prop = true;
} }
#ifndef QT_NO_TEXTCODEC
static const QTextCodec* mapper = QTextCodec::codecForLocale(); static const QTextCodec* mapper = QTextCodec::codecForLocale();
int errCode = 0; int errCode = 0;
if (mapper) { if (mapper) {
@ -281,6 +282,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s)
tp.nitems = qcs.length(); tp.nitems = qcs.length();
free_prop = false; free_prop = false;
} }
#endif
return &tp; return &tp;
} }
#endif // XCB_USE_XLIB #endif // XCB_USE_XLIB

View File

@ -54,12 +54,12 @@
// //
#include <QtPrintSupport/private/qtprintsupportglobal_p.h> #include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#include <ui_qcupsjobwidget.h>
#include <private/qcups_p.h> #include <private/qcups_p.h>
QT_BEGIN_NAMESPACE
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_CUPS) #if !defined(QT_NO_PRINTER) && !defined(QT_NO_CUPS)
#include <ui_qcupsjobwidget.h>
QT_BEGIN_NAMESPACE
class QString; class QString;
class QTime; class QTime;
@ -107,8 +107,8 @@ private:
Q_DISABLE_COPY(QCupsJobWidget) Q_DISABLE_COPY(QCupsJobWidget)
}; };
#endif // QT_NO_PRINTER / QT_NO_CUPS
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_PRINTER / QT_NO_CUPS
#endif // QCUPSJOBWIDGET_P_H #endif // QCUPSJOBWIDGET_P_H

View File

@ -77,7 +77,9 @@ void ExtractImages::acceptUI(DomUI *node)
m_imagesDir = dir; m_imagesDir = dir;
m_output = new QTextStream(&f); m_output = new QTextStream(&f);
#ifndef QT_NO_TEXTCODEC
m_output->setCodec(QTextCodec::codecForName("UTF-8")); m_output->setCodec(QTextCodec::codecForName("UTF-8"));
#endif
QTextStream &out = *m_output; QTextStream &out = *m_output;
@ -121,7 +123,9 @@ void ExtractImages::acceptImage(DomImage *image)
if (isXPM_GZ) { if (isXPM_GZ) {
QTextStream *imageOut = new QTextStream(&f); QTextStream *imageOut = new QTextStream(&f);
#ifndef QT_NO_TEXTCODEC
imageOut->setCodec(QTextCodec::codecForName("UTF-8")); imageOut->setCodec(QTextCodec::codecForName("UTF-8"));
#endif
CPP::WriteIconData::writeImage(*imageOut, QString(), m_option.limitXPM_LineLength, image); CPP::WriteIconData::writeImage(*imageOut, QString(), m_option.limitXPM_LineLength, image);
delete imageOut; delete imageOut;

View File

@ -132,7 +132,9 @@ int runUic(int argc, char *argv[])
return 1; return 1;
} }
out = new QTextStream(&f); out = new QTextStream(&f);
#ifndef QT_NO_TEXTCODEC
out->setCodec(QTextCodec::codecForName("UTF-8")); out->setCodec(QTextCodec::codecForName("UTF-8"));
#endif
} }
bool rtn = driver.uic(inputFile, out); bool rtn = driver.uic(inputFile, out);

View File

@ -81,13 +81,22 @@ QAccessibleTable::QAccessibleTable(QWidget *w)
{ {
Q_ASSERT(view()); Q_ASSERT(view());
#ifndef QT_NO_TABLEVIEW
if (qobject_cast<const QTableView*>(view())) { if (qobject_cast<const QTableView*>(view())) {
m_role = QAccessible::Table; m_role = QAccessible::Table;
} else if (qobject_cast<const QTreeView*>(view())) { } else
#endif
#ifndef QT_NO_TREEVIEW
if (qobject_cast<const QTreeView*>(view())) {
m_role = QAccessible::Tree; m_role = QAccessible::Tree;
} else if (qobject_cast<const QListView*>(view())) { } else
#endif
#ifndef QT_NO_LISTVIEW
if (qobject_cast<const QListView*>(view())) {
m_role = QAccessible::List; m_role = QAccessible::List;
} else { } else
#endif
{
// is this our best guess? // is this our best guess?
m_role = QAccessible::Table; m_role = QAccessible::Table;
} }
@ -664,6 +673,8 @@ void QAccessibleTable::modelChange(QAccessibleTableModelChangeEvent *event)
} }
} }
#ifndef QT_NO_TREEVIEW
// TREE VIEW // TREE VIEW
QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const
@ -714,7 +725,6 @@ int QAccessibleTree::childCount() const
return (treeView->d_func()->viewItems.count() + hHeader)* view()->model()->columnCount(); return (treeView->d_func()->viewItems.count() + hHeader)* view()->model()->columnCount();
} }
QAccessibleInterface *QAccessibleTree::child(int logicalIndex) const QAccessibleInterface *QAccessibleTree::child(int logicalIndex) const
{ {
if (logicalIndex < 0 || !view()->model() || !view()->model()->columnCount()) if (logicalIndex < 0 || !view()->model() || !view()->model()->columnCount())
@ -836,6 +846,8 @@ bool QAccessibleTree::selectRow(int row)
return true; return true;
} }
#endif // QT_NO_TREEVIEW
// TABLE CELL // TABLE CELL
QAccessibleTableCell::QAccessibleTableCell(QAbstractItemView *view_, const QModelIndex &index_, QAccessible::Role role_) QAccessibleTableCell::QAccessibleTableCell(QAbstractItemView *view_, const QModelIndex &index_, QAccessible::Role role_)
@ -912,12 +924,14 @@ int QAccessibleTableCell::columnIndex() const
int QAccessibleTableCell::rowIndex() const int QAccessibleTableCell::rowIndex() const
{ {
#ifndef QT_NO_TREEVIEW
if (role() == QAccessible::TreeItem) { if (role() == QAccessible::TreeItem) {
const QTreeView *treeView = qobject_cast<const QTreeView*>(view); const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
Q_ASSERT(treeView); Q_ASSERT(treeView);
int row = treeView->d_func()->viewIndex(m_index); int row = treeView->d_func()->viewIndex(m_index);
return row; return row;
} }
#endif
return m_index.row(); return m_index.row();
} }
@ -1046,6 +1060,7 @@ QAccessible::State QAccessibleTableCell::state() const
if (view->selectionMode() == QAbstractItemView::ExtendedSelection) if (view->selectionMode() == QAbstractItemView::ExtendedSelection)
st.extSelectable = true; st.extSelectable = true;
} }
#ifndef QT_NO_TREEVIEW
if (m_role == QAccessible::TreeItem) { if (m_role == QAccessible::TreeItem) {
const QTreeView *treeView = qobject_cast<const QTreeView*>(view); const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
if (treeView->model()->hasChildren(m_index)) if (treeView->model()->hasChildren(m_index))
@ -1053,6 +1068,7 @@ QAccessible::State QAccessibleTableCell::state() const
if (treeView->isExpanded(m_index)) if (treeView->isExpanded(m_index))
st.expanded = true; st.expanded = true;
} }
#endif
return st; return st;
} }

View File

@ -145,6 +145,7 @@ private:
QAccessible::Role m_role; QAccessible::Role m_role;
}; };
#ifndef QT_NO_TREEVIEW
class QAccessibleTree :public QAccessibleTable class QAccessibleTree :public QAccessibleTable
{ {
public: public:
@ -172,6 +173,7 @@ private:
inline int logicalIndex(const QModelIndex &index) const; inline int logicalIndex(const QModelIndex &index) const;
}; };
#endif
class QAccessibleTableCell: public QAccessibleInterface, public QAccessibleTableCellInterface, public QAccessibleActionInterface class QAccessibleTableCell: public QAccessibleInterface, public QAccessibleTableCellInterface, public QAccessibleActionInterface
{ {
@ -221,7 +223,9 @@ private:
void unselectCell(); void unselectCell();
friend class QAccessibleTable; friend class QAccessibleTable;
#ifndef QT_NO_TREEVIEW
friend class QAccessibleTree; friend class QAccessibleTree;
#endif
}; };
@ -255,7 +259,9 @@ private:
Qt::Orientation orientation; Qt::Orientation orientation;
friend class QAccessibleTable; friend class QAccessibleTable;
#ifndef QT_NO_TREEVIEW
friend class QAccessibleTree; friend class QAccessibleTree;
#endif
}; };
// This is the corner button on the top left of a table. // This is the corner button on the top left of a table.

View File

@ -142,9 +142,11 @@ QString qt_accStripAmp(const QString &text)
QString qt_accHotKey(const QString &text) QString qt_accHotKey(const QString &text)
{ {
#ifndef QT_NO_SHORTCUT
int ampIndex = qt_accAmpIndex(text); int ampIndex = qt_accAmpIndex(text);
if (ampIndex != -1) if (ampIndex != -1)
return QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + text.at(ampIndex + 1); return QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + text.at(ampIndex + 1);
#endif
return QString(); return QString();
} }

View File

@ -139,9 +139,11 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QMenu")) { } else if (classname == QLatin1String("QMenu")) {
iface = new QAccessibleMenu(widget); iface = new QAccessibleMenu(widget);
#endif #endif
#ifndef QT_NO_ITEMVIEWS #ifndef QT_NO_TREEVIEW
} else if (classname == QLatin1String("QTreeView")) { } else if (classname == QLatin1String("QTreeView")) {
iface = new QAccessibleTree(widget); iface = new QAccessibleTree(widget);
#endif // QT_NO_TREEVIEW
#ifndef QT_NO_ITEMVIEWS
} else if (classname == QLatin1String("QTableView") || classname == QLatin1String("QListView")) { } else if (classname == QLatin1String("QTableView") || classname == QLatin1String("QListView")) {
iface = new QAccessibleTable(widget); iface = new QAccessibleTable(widget);
// ### This should be cleaned up. We return the parent for the scrollarea to hide it. // ### This should be cleaned up. We return the parent for the scrollarea to hide it.

View File

@ -404,8 +404,10 @@ QAccessible::Role QAccessibleDisplay::role() const
} else if (qobject_cast<QProgressBar*>(object())) { } else if (qobject_cast<QProgressBar*>(object())) {
return QAccessible::ProgressBar; return QAccessible::ProgressBar;
#endif #endif
#ifndef QT_NO_STATUSBAR
} else if (qobject_cast<QStatusBar*>(object())) { } else if (qobject_cast<QStatusBar*>(object())) {
return QAccessible::StatusBar; return QAccessible::StatusBar;
#endif
} }
return QAccessibleWidget::role(); return QAccessibleWidget::role();
} }
@ -428,8 +430,10 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const
str = doc.toPlainText(); str = doc.toPlainText();
} }
#endif #endif
#ifndef QT_NO_SHORTCUT
if (label->buddy()) if (label->buddy())
str = qt_accStripAmp(str); str = qt_accStripAmp(str);
#endif
#ifndef QT_NO_LCDNUMBER #ifndef QT_NO_LCDNUMBER
} else if (qobject_cast<QLCDNumber*>(object())) { } else if (qobject_cast<QLCDNumber*>(object())) {
QLCDNumber *l = qobject_cast<QLCDNumber*>(object()); QLCDNumber *l = qobject_cast<QLCDNumber*>(object());
@ -438,8 +442,10 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const
else else
str = QString::number(l->intValue()); str = QString::number(l->intValue());
#endif #endif
#ifndef QT_NO_STATUSBAR
} else if (qobject_cast<QStatusBar*>(object())) { } else if (qobject_cast<QStatusBar*>(object())) {
return qobject_cast<QStatusBar*>(object())->currentMessage(); return qobject_cast<QStatusBar*>(object())->currentMessage();
#endif
} }
} }
break; break;

View File

@ -634,12 +634,14 @@ void QDialog::contextMenuEvent(QContextMenuEvent *e)
/*! \reimp */ /*! \reimp */
void QDialog::keyPressEvent(QKeyEvent *e) void QDialog::keyPressEvent(QKeyEvent *e)
{ {
#ifndef QT_NO_SHORTCUT
// Calls reject() if Escape is pressed. Simulates a button // Calls reject() if Escape is pressed. Simulates a button
// click for the default button if Enter is pressed. Move focus // click for the default button if Enter is pressed. Move focus
// for the arrow keys. Ignore the rest. // for the arrow keys. Ignore the rest.
if (e->matches(QKeySequence::Cancel)) { if (e->matches(QKeySequence::Cancel)) {
reject(); reject();
} else } else
#endif
if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) { if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) {
switch (e->key()) { switch (e->key()) {
case Qt::Key_Enter: case Qt::Key_Enter:

View File

@ -114,8 +114,8 @@ private:
int m_numSortedElements; int m_numSortedElements;
}; };
#endif // QT_NO_GRAPHICSVIEW
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_GRAPHICSVIEW
#endif // QGRAPHICSSCENELINEARINDEX_H #endif // QGRAPHICSSCENELINEARINDEX_H

View File

@ -464,11 +464,13 @@ bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *ev
if (editorHandlesKeyEvent(editor, keyEvent)) if (editorHandlesKeyEvent(editor, keyEvent))
return false; return false;
#ifndef QT_NO_SHORTCUT
if (keyEvent->matches(QKeySequence::Cancel)) { if (keyEvent->matches(QKeySequence::Cancel)) {
// don't commit data // don't commit data
emit q->closeEditor(editor, QAbstractItemDelegate::RevertModelCache); emit q->closeEditor(editor, QAbstractItemDelegate::RevertModelCache);
return true; return true;
} }
#endif
switch (keyEvent->key()) { switch (keyEvent->key()) {
case Qt::Key_Tab: case Qt::Key_Tab:
@ -519,11 +521,13 @@ bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *ev
emit q->closeEditor(editor, QAbstractItemDelegate::NoHint); emit q->closeEditor(editor, QAbstractItemDelegate::NoHint);
} }
#ifndef QT_NO_SHORTCUT
} else if (event->type() == QEvent::ShortcutOverride) { } else if (event->type() == QEvent::ShortcutOverride) {
if (static_cast<QKeyEvent*>(event)->matches(QKeySequence::Cancel)) { if (static_cast<QKeyEvent*>(event)->matches(QKeySequence::Cancel)) {
event->accept(); event->accept();
return true; return true;
} }
#endif
} }
return false; return false;
} }

View File

@ -2473,10 +2473,12 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
break; break;
#endif #endif
default: { default: {
#ifndef QT_NO_SHORTCUT
if (event == QKeySequence::SelectAll && selectionMode() != NoSelection) { if (event == QKeySequence::SelectAll && selectionMode() != NoSelection) {
selectAll(); selectAll();
break; break;
} }
#endif
#ifdef Q_OS_OSX #ifdef Q_OS_OSX
if (event->key() == Qt::Key_O && event->modifiers() & Qt::ControlModifier && currentIndex().isValid()) { if (event->key() == Qt::Key_O && event->modifiers() & Qt::ControlModifier && currentIndex().isValid()) {
emit activated(currentIndex()); emit activated(currentIndex());

View File

@ -1304,8 +1304,10 @@ Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QAction *action)
d << " toolTip=" << action->toolTip(); d << " toolTip=" << action->toolTip();
if (action->isCheckable()) if (action->isCheckable())
d << " checked=" << action->isChecked(); d << " checked=" << action->isChecked();
#ifndef QT_NO_SHORTCUT
if (!action->shortcut().isEmpty()) if (!action->shortcut().isEmpty())
d << " shortcut=" << action->shortcut(); d << " shortcut=" << action->shortcut();
#endif
d << " menuRole="; d << " menuRole=";
QtDebugUtils::formatQEnum(d, action->menuRole()); QtDebugUtils::formatQEnum(d, action->menuRole());
d << " visible=" << action->isVisible(); d << " visible=" << action->isVisible();

View File

@ -141,7 +141,7 @@ bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context)
static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidget *active_window) static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidget *active_window)
{ {
bool visible = w->isVisible(); bool visible = w->isVisible();
#ifdef Q_OS_MAC #if defined(Q_OS_DARWIN) && !defined(QT_NO_MENUBAR)
if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w)) if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w))
visible = true; visible = true;
#endif #endif
@ -204,7 +204,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge
static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window) static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window)
{ {
bool visible = w->isVisible(); bool visible = w->isVisible();
#ifdef Q_OS_MAC #if defined(Q_OS_DARWIN) && !defined(QT_NO_MENUBAR)
if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w)) if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w))
visible = true; visible = true;
#endif #endif
@ -272,7 +272,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
QWidget *w = widgets.at(i); QWidget *w = widgets.at(i);
#ifndef QT_NO_MENU #ifndef QT_NO_MENU
if (QMenu *menu = qobject_cast<QMenu *>(w)) { if (QMenu *menu = qobject_cast<QMenu *>(w)) {
#ifdef Q_OS_MAC #ifdef Q_OS_DARWIN
// On Mac, menu item shortcuts are processed before reaching any window. // On Mac, menu item shortcuts are processed before reaching any window.
// That means that if a menu action shortcut has not been already processed // That means that if a menu action shortcut has not been already processed
// (and reaches this point), then the menu item itself has been disabled. // (and reaches this point), then the menu item itself has been disabled.

View File

@ -9441,10 +9441,13 @@ void QWidget::tabletEvent(QTabletEvent *event)
void QWidget::keyPressEvent(QKeyEvent *event) void QWidget::keyPressEvent(QKeyEvent *event)
{ {
#ifndef QT_NO_SHORTCUT
if ((windowType() == Qt::Popup) && event->matches(QKeySequence::Cancel)) { if ((windowType() == Qt::Popup) && event->matches(QKeySequence::Cancel)) {
event->accept(); event->accept();
close(); close();
} else { } else
#endif
{
event->ignore(); event->ignore();
} }
} }

View File

@ -97,11 +97,14 @@ public:
} }
QWidget *p = q->parentWidget(); QWidget *p = q->parentWidget();
while (p) { while (p) {
if ( if (false
#ifndef QT_NO_MDIAREA #ifndef QT_NO_MDIAREA
qobject_cast<QMdiSubWindow *>(p) != 0 || || qobject_cast<QMdiSubWindow *>(p) != 0
#endif #endif
qobject_cast<QAbstractScrollArea *>(p) != 0) { #ifndef QT_NO_SCROLLAREA
|| qobject_cast<QAbstractScrollArea *>(p) != 0
#endif
) {
q->winId(); q->winId();
usesNativeWidgets = true; usesNativeWidgets = true;
break; break;

View File

@ -190,12 +190,14 @@ typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *);
static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0; static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0;
static int closeButtonSize = 12; static int closeButtonSize = 12;
#ifndef QT_NO_TABBAR
static bool isVerticalTabs(const QTabBar::Shape shape) { static bool isVerticalTabs(const QTabBar::Shape shape) {
return (shape == QTabBar::RoundedEast return (shape == QTabBar::RoundedEast
|| shape == QTabBar::TriangularEast || shape == QTabBar::TriangularEast
|| shape == QTabBar::RoundedWest || shape == QTabBar::RoundedWest
|| shape == QTabBar::TriangularWest); || shape == QTabBar::TriangularWest);
} }
#endif
static bool isInMacUnifiedToolbarArea(QWindow *window, int windowY) static bool isInMacUnifiedToolbarArea(QWindow *window, int windowY)
{ {
@ -247,6 +249,7 @@ void drawTabCloseButton(QPainter *p, bool hover, bool active, bool selected)
p->drawLine(min, max, max, min); p->drawLine(min, max, max, min);
} }
#ifndef QT_NO_TABBAR
QRect rotateTabPainter(QPainter *p, QTabBar::Shape shape, QRect tabRect) QRect rotateTabPainter(QPainter *p, QTabBar::Shape shape, QRect tabRect)
{ {
if (isVerticalTabs(shape)) { if (isVerticalTabs(shape)) {
@ -430,6 +433,7 @@ void drawTabBase(QPainter *p, const QStyleOptionTabBarBase *tbb, const QWidget *
p->setPen(borderBottom); p->setPen(borderBottom);
p->drawLine(tabRect.x(), height - 1, width, height - 1); p->drawLine(tabRect.x(), height - 1, width, height - 1);
} }
#endif
static int getControlSize(const QStyleOption *option, const QWidget *widget) static int getControlSize(const QStyleOption *option, const QWidget *widget)
{ {
@ -445,13 +449,16 @@ static int getControlSize(const QStyleOption *option, const QWidget *widget)
} }
#ifndef QT_NO_TREEVIEW
static inline bool isTreeView(const QWidget *widget) static inline bool isTreeView(const QWidget *widget)
{ {
return (widget && widget->parentWidget() && return (widget && widget->parentWidget() &&
(qobject_cast<const QTreeView *>(widget->parentWidget()) (qobject_cast<const QTreeView *>(widget->parentWidget())
)); ));
} }
#endif
#ifndef QT_NO_TABBAR
static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape) static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape)
{ {
ThemeTabDirection ttd; ThemeTabDirection ttd;
@ -476,6 +483,7 @@ static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape)
} }
return ttd; return ttd;
} }
#endif
static QString qt_mac_removeMnemonics(const QString &original) static QString qt_mac_removeMnemonics(const QString &original)
{ {
@ -742,8 +750,10 @@ inline bool qt_mac_is_metal(const QWidget *w)
if (w->isWindow() && w->testAttribute(Qt::WA_WState_Created)) { // If not created will fall through to the opaque check and be fine anyway. if (w->isWindow() && w->testAttribute(Qt::WA_WState_Created)) { // If not created will fall through to the opaque check and be fine anyway.
return qt_macWindowIsTextured(w); return qt_macWindowIsTextured(w);
} }
#ifndef QT_NO_ACCESSIBILITY
if (w->d_func()->isOpaque) if (w->d_func()->isOpaque)
break; break;
#endif
} }
return false; return false;
} }
@ -778,22 +788,34 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
ct = QStyle::CT_RadioButton; ct = QStyle::CT_RadioButton;
else if (qobject_cast<const QCheckBox *>(widg)) else if (qobject_cast<const QCheckBox *>(widg))
ct = QStyle::CT_CheckBox; ct = QStyle::CT_CheckBox;
#ifndef QT_NO_COMBOBOX
else if (qobject_cast<const QComboBox *>(widg)) else if (qobject_cast<const QComboBox *>(widg))
ct = QStyle::CT_ComboBox; ct = QStyle::CT_ComboBox;
#endif
#ifndef QT_NO_TOOLBUTTON
else if (qobject_cast<const QToolButton *>(widg)) else if (qobject_cast<const QToolButton *>(widg))
ct = QStyle::CT_ToolButton; ct = QStyle::CT_ToolButton;
#endif
else if (qobject_cast<const QSlider *>(widg)) else if (qobject_cast<const QSlider *>(widg))
ct = QStyle::CT_Slider; ct = QStyle::CT_Slider;
#ifndef QT_NO_PROGRESSBAR
else if (qobject_cast<const QProgressBar *>(widg)) else if (qobject_cast<const QProgressBar *>(widg))
ct = QStyle::CT_ProgressBar; ct = QStyle::CT_ProgressBar;
#endif
#ifndef QT_NO_LINEEDIT
else if (qobject_cast<const QLineEdit *>(widg)) else if (qobject_cast<const QLineEdit *>(widg))
ct = QStyle::CT_LineEdit; ct = QStyle::CT_LineEdit;
#endif
else if (qobject_cast<const QHeaderView *>(widg)) else if (qobject_cast<const QHeaderView *>(widg))
ct = QStyle::CT_HeaderSection; ct = QStyle::CT_HeaderSection;
#ifndef QT_NO_MENUBAR
else if (qobject_cast<const QMenuBar *>(widg)) else if (qobject_cast<const QMenuBar *>(widg))
ct = QStyle::CT_MenuBar; ct = QStyle::CT_MenuBar;
#endif
#ifndef QT_NO_SIZEGRIP
else if (qobject_cast<const QSizeGrip *>(widg)) else if (qobject_cast<const QSizeGrip *>(widg))
ct = QStyle::CT_SizeGrip; ct = QStyle::CT_SizeGrip;
#endif
else else
return ret; return ret;
} }
@ -903,6 +925,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
if (sz == QAquaSizeSmall) { if (sz == QAquaSizeSmall) {
int width = 0, height = 0; int width = 0, height = 0;
if (szHint == QSize(-1, -1)) { //just 'guess'.. if (szHint == QSize(-1, -1)) { //just 'guess'..
#ifndef QT_NO_TOOLBUTTON
const QToolButton *bt = qobject_cast<const QToolButton *>(widg); const QToolButton *bt = qobject_cast<const QToolButton *>(widg);
// If this conversion fails then the widget was not what it claimed to be. // If this conversion fails then the widget was not what it claimed to be.
if(bt) { if(bt) {
@ -923,7 +946,9 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
width = qMax(height, text_height); width = qMax(height, text_height);
} }
} }
} else { } else
#endif
{
// Let's return the size hint... // Let's return the size hint...
width = szHint.width(); width = szHint.width();
height = szHint.height(); height = szHint.height();
@ -987,6 +1012,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
ret.setWidth(w); ret.setWidth(w);
break; break;
} }
#ifndef QT_NO_PROGRESSBAR
case QStyle::CT_ProgressBar: { case QStyle::CT_ProgressBar: {
int finalValue = -1; int finalValue = -1;
Qt::Orientation orient = Qt::Horizontal; Qt::Orientation orient = Qt::Horizontal;
@ -1005,6 +1031,8 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
ret.setWidth(finalValue); ret.setWidth(finalValue);
break; break;
} }
#endif
#ifndef QT_NO_COMBOBOX
case QStyle::CT_LineEdit: case QStyle::CT_LineEdit:
if (!widg || !qobject_cast<QComboBox *>(widg->parentWidget())) { if (!widg || !qobject_cast<QComboBox *>(widg->parentWidget())) {
//should I take into account the font dimentions of the lineedit? -Sam //should I take into account the font dimentions of the lineedit? -Sam
@ -1014,9 +1042,12 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
ret = QSize(-1, 19); ret = QSize(-1, 19);
} }
break; break;
#endif
case QStyle::CT_HeaderSection: case QStyle::CT_HeaderSection:
#ifndef QT_NO_TREEVIEW
if (isTreeView(widg)) if (isTreeView(widg))
ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricListHeaderHeight)); ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricListHeaderHeight));
#endif
break; break;
case QStyle::CT_MenuBar: case QStyle::CT_MenuBar:
if (sz == QAquaSizeLarge) { if (sz == QAquaSizeLarge) {
@ -1424,6 +1455,7 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem
// an extra check here before using the mini and small buttons. // an extra check here before using the mini and small buttons.
int h = combo->rect.size().height(); int h = combo->rect.size().height();
if (combo->editable){ if (combo->editable){
#ifndef QT_NO_DATETIMEEDIT
if (qobject_cast<const QDateTimeEdit *>(widget)) { if (qobject_cast<const QDateTimeEdit *>(widget)) {
// Except when, you know, we get a QDateTimeEdit with calendarPopup // Except when, you know, we get a QDateTimeEdit with calendarPopup
// enabled. And then things get weird, basically because it's a // enabled. And then things get weird, basically because it's a
@ -1440,7 +1472,9 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem
bdi->kind = kThemeComboBoxSmall; bdi->kind = kThemeComboBoxSmall;
else else
bdi->kind = kThemeComboBox; bdi->kind = kThemeComboBox;
} else { } else
#endif
{
if (h < 21) if (h < 21)
bdi->kind = kThemeComboBoxMini; bdi->kind = kThemeComboBoxMini;
else if (h < 26) else if (h < 26)
@ -2308,7 +2342,12 @@ void QMacStyle::polish(QWidget* w)
w->setAttribute(Qt::WA_SetPalette, false); w->setAttribute(Qt::WA_SetPalette, false);
} }
if (qobject_cast<QMenu*>(w) || qobject_cast<QComboBoxPrivateContainer *>(w)) { #ifndef QT_NO_MENU
if (qobject_cast<QMenu*>(w)
#ifndef QT_NO_COMBOBOX
|| qobject_cast<QComboBoxPrivateContainer *>(w)
#endif
) {
w->setWindowOpacity(0.985); w->setWindowOpacity(0.985);
if (!w->testAttribute(Qt::WA_SetPalette)) { if (!w->testAttribute(Qt::WA_SetPalette)) {
QPixmap px(64, 64); QPixmap px(64, 64);
@ -2328,7 +2367,9 @@ void QMacStyle::polish(QWidget* w)
w->setAttribute(Qt::WA_SetPalette, false); w->setAttribute(Qt::WA_SetPalette, false);
} }
} }
#endif
#ifndef QT_NO_TABBAR
if (QTabBar *tb = qobject_cast<QTabBar*>(w)) { if (QTabBar *tb = qobject_cast<QTabBar*>(w)) {
if (tb->documentMode()) { if (tb->documentMode()) {
w->setAttribute(Qt::WA_Hover); w->setAttribute(Qt::WA_Hover);
@ -2338,6 +2379,7 @@ void QMacStyle::polish(QWidget* w)
w->setPalette(p); w->setPalette(p);
} }
} }
#endif
QCommonStyle::polish(w); QCommonStyle::polish(w);
@ -2356,19 +2398,26 @@ void QMacStyle::polish(QWidget* w)
void QMacStyle::unpolish(QWidget* w) void QMacStyle::unpolish(QWidget* w)
{ {
if ((qobject_cast<QMenu*>(w) || qt_mac_is_metal(w)) && !w->testAttribute(Qt::WA_SetPalette)) { if ((
#ifndef QT_NO_MENU
qobject_cast<QMenu*>(w) ||
#endif
qt_mac_is_metal(w)
) && !w->testAttribute(Qt::WA_SetPalette)) {
QPalette pal = qApp->palette(w); QPalette pal = qApp->palette(w);
w->setPalette(pal); w->setPalette(pal);
w->setAttribute(Qt::WA_SetPalette, false); w->setAttribute(Qt::WA_SetPalette, false);
w->setWindowOpacity(1.0); w->setWindowOpacity(1.0);
} }
#ifndef QT_NO_COMBOBOX
if (QComboBox *combo = qobject_cast<QComboBox *>(w)) { if (QComboBox *combo = qobject_cast<QComboBox *>(w)) {
if (!combo->isEditable()) { if (!combo->isEditable()) {
if (QWidget *widget = combo->findChild<QComboBoxPrivateContainer *>()) if (QWidget *widget = combo->findChild<QComboBoxPrivateContainer *>())
widget->setWindowOpacity(1.0); widget->setWindowOpacity(1.0);
} }
} }
#endif
if (QRubberBand *rubber = qobject_cast<QRubberBand*>(w)) { if (QRubberBand *rubber = qobject_cast<QRubberBand*>(w)) {
rubber->setWindowOpacity(1.0); rubber->setWindowOpacity(1.0);
@ -2878,9 +2927,12 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
ret = QEvent::MouseButtonRelease; ret = QEvent::MouseButtonRelease;
break; break;
case SH_TabBar_SelectMouseType: case SH_TabBar_SelectMouseType:
#ifndef QT_NO_TABBAR
if (const QStyleOptionTabBarBase *opt2 = qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) { if (const QStyleOptionTabBarBase *opt2 = qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
ret = opt2->documentMode ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; ret = opt2->documentMode ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease;
} else { } else
#endif
{
ret = QEvent::MouseButtonRelease; ret = QEvent::MouseButtonRelease;
} }
break; break;
@ -2900,18 +2952,22 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
ret = Qt::AlignRight; ret = Qt::AlignRight;
break; break;
case SH_TabBar_Alignment: { case SH_TabBar_Alignment: {
#ifndef QT_NO_TABWIDGET
if (const QTabWidget *tab = qobject_cast<const QTabWidget*>(w)) { if (const QTabWidget *tab = qobject_cast<const QTabWidget*>(w)) {
if (tab->documentMode()) { if (tab->documentMode()) {
ret = Qt::AlignLeft; ret = Qt::AlignLeft;
break; break;
} }
} }
#endif
#ifndef QT_NO_TABBAR
if (const QTabBar *tab = qobject_cast<const QTabBar*>(w)) { if (const QTabBar *tab = qobject_cast<const QTabBar*>(w)) {
if (tab->documentMode()) { if (tab->documentMode()) {
ret = Qt::AlignLeft; ret = Qt::AlignLeft;
break; break;
} }
} }
#endif
ret = Qt::AlignCenter; ret = Qt::AlignCenter;
} break; } break;
case SH_UnderlineShortcut: case SH_UnderlineShortcut:
@ -3041,9 +3097,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
case SH_FocusFrame_AboveWidget: case SH_FocusFrame_AboveWidget:
ret = true; ret = true;
break; break;
#ifndef QT_NO_WIZARD
case SH_WizardStyle: case SH_WizardStyle:
ret = QWizard::MacStyle; ret = QWizard::MacStyle;
break; break;
#endif
case SH_ItemView_ArrowKeysNavigateIntoChildren: case SH_ItemView_ArrowKeysNavigateIntoChildren:
ret = false; ret = false;
break; break;
@ -3061,9 +3119,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
opt->rect.width(), opt->rect.height() - 8); opt->rect.width(), opt->rect.height() - 8);
HIThemeMenuDrawInfo mdi; HIThemeMenuDrawInfo mdi;
mdi.version = 0; mdi.version = 0;
#ifndef QT_NO_MENU
if (w && qobject_cast<QMenu *>(w->parentWidget())) if (w && qobject_cast<QMenu *>(w->parentWidget()))
mdi.menuType = kThemeMenuTypeHierarchical; mdi.menuType = kThemeMenuTypeHierarchical;
else else
#endif
mdi.menuType = kThemeMenuTypePopUp; mdi.menuType = kThemeMenuTypePopUp;
QCFType<HIShapeRef> shape; QCFType<HIShapeRef> shape;
HIThemeGetMenuBackgroundShape(&menuRect, &mdi, &shape); HIThemeGetMenuBackgroundShape(&menuRect, &mdi, &shape);
@ -3075,9 +3135,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
case SH_ItemView_PaintAlternatingRowColorsForEmptyArea: case SH_ItemView_PaintAlternatingRowColorsForEmptyArea:
ret = true; ret = true;
break; break;
#ifndef QT_NO_TABBAR
case SH_TabBar_CloseButtonPosition: case SH_TabBar_CloseButtonPosition:
ret = QTabBar::LeftSide; ret = QTabBar::LeftSide;
break; break;
#endif
case SH_DockWidget_ButtonsHaveFrame: case SH_DockWidget_ButtonsHaveFrame:
ret = false; ret = false;
break; break;
@ -3246,6 +3308,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
p->drawPath(path); p->drawPath(path);
p->restore(); p->restore();
break; } break; }
#ifndef QT_NO_TABBAR
case PE_FrameTabBarBase: case PE_FrameTabBarBase:
if (const QStyleOptionTabBarBase *tbb if (const QStyleOptionTabBarBase *tbb
= qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) { = qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
@ -3281,6 +3344,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
p->restore(); p->restore();
} }
break; break;
#endif
case PE_PanelTipLabel: case PE_PanelTipLabel:
p->fillRect(opt->rect, opt->palette.brush(QPalette::ToolTipBase)); p->fillRect(opt->rect, opt->palette.brush(QPalette::ToolTipBase));
break; break;
@ -3292,9 +3356,11 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
HIThemeGroupBoxDrawInfo gdi; HIThemeGroupBoxDrawInfo gdi;
gdi.version = qt_mac_hitheme_version; gdi.version = qt_mac_hitheme_version;
gdi.state = tds; gdi.state = tds;
#ifndef QT_NO_GROUPBOX
if (w && qobject_cast<QGroupBox *>(w->parentWidget())) if (w && qobject_cast<QGroupBox *>(w->parentWidget()))
gdi.kind = kHIThemeGroupBoxKindSecondary; gdi.kind = kHIThemeGroupBoxKindSecondary;
else else
#endif
gdi.kind = kHIThemeGroupBoxKindPrimary; gdi.kind = kHIThemeGroupBoxKindPrimary;
HIRect hirect = qt_hirectForQRect(opt->rect); HIRect hirect = qt_hirectForQRect(opt->rect);
HIThemeDrawGroupBox(&hirect, &gdi, cg, kHIThemeOrientationNormal); HIThemeDrawGroupBox(&hirect, &gdi, cg, kHIThemeOrientationNormal);
@ -3528,6 +3594,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
// Draw the focus frame for widgets other than QLineEdit (e.g. for line edits in Webkit). // Draw the focus frame for widgets other than QLineEdit (e.g. for line edits in Webkit).
// Focus frame is drawn outside the rectangle passed in the option-rect. // Focus frame is drawn outside the rectangle passed in the option-rect.
if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) { if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
#ifndef QT_NO_LINEEDIT
if ((opt->state & State_HasFocus) && !qobject_cast<const QLineEdit*>(w)) { if ((opt->state & State_HasFocus) && !qobject_cast<const QLineEdit*>(w)) {
int vmargin = pixelMetric(QStyle::PM_FocusFrameVMargin); int vmargin = pixelMetric(QStyle::PM_FocusFrameVMargin);
int hmargin = pixelMetric(QStyle::PM_FocusFrameHMargin); int hmargin = pixelMetric(QStyle::PM_FocusFrameHMargin);
@ -3535,9 +3602,11 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
focusFrame.rect = panel->rect.adjusted(-hmargin, -vmargin, hmargin, vmargin); focusFrame.rect = panel->rect.adjusted(-hmargin, -vmargin, hmargin, vmargin);
drawControl(CE_FocusFrame, &focusFrame, p, w); drawControl(CE_FocusFrame, &focusFrame, p, w);
} }
#endif
} }
break; break;
#ifndef QT_NO_TABWIDGET
case PE_FrameTabWidget: case PE_FrameTabWidget:
if (const QStyleOptionTabWidgetFrame *twf if (const QStyleOptionTabWidgetFrame *twf
= qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
@ -3552,6 +3621,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
HIThemeDrawTabPane(&hirect, &tpdi, cg, kHIThemeOrientationNormal); HIThemeDrawTabPane(&hirect, &tpdi, cg, kHIThemeOrientationNormal);
} }
break; break;
#endif
case PE_PanelScrollAreaCorner: { case PE_PanelScrollAreaCorner: {
const QBrush brush(opt->palette.brush(QPalette::Base)); const QBrush brush(opt->palette.brush(QPalette::Base));
p->fillRect(opt->rect, brush); p->fillRect(opt->rect, brush);
@ -3695,9 +3765,11 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
HIRect bounds = qt_hirectForQRect(ir); HIRect bounds = qt_hirectForQRect(ir);
bool noVerticalHeader = true; bool noVerticalHeader = true;
#ifndef QT_NO_TABLEVIEW
if (w) if (w)
if (const QTableView *table = qobject_cast<const QTableView *>(w->parentWidget())) if (const QTableView *table = qobject_cast<const QTableView *>(w->parentWidget()))
noVerticalHeader = !table->verticalHeader()->isVisible(); noVerticalHeader = !table->verticalHeader()->isVisible();
#endif
bool drawTopBorder = header->orientation == Qt::Horizontal; bool drawTopBorder = header->orientation == Qt::Horizontal;
bool drawLeftBorder = header->orientation == Qt::Vertical bool drawLeftBorder = header->orientation == Qt::Vertical
@ -4131,6 +4203,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
QCommonStyle::drawControl(CE_ComboBoxLabel, &comboCopy, p, w); QCommonStyle::drawControl(CE_ComboBoxLabel, &comboCopy, p, w);
} }
break; break;
#ifndef QT_NO_TABBAR
case CE_TabBarTabShape: case CE_TabBarTabShape:
if (const QStyleOptionTab *tabOpt = qstyleoption_cast<const QStyleOptionTab *>(opt)) { if (const QStyleOptionTab *tabOpt = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
@ -4337,6 +4410,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
} }
} }
break; break;
#endif
#ifndef QT_NO_DOCKWIDGET
case CE_DockWidgetTitle: case CE_DockWidgetTitle:
if (const QDockWidget *dockWidget = qobject_cast<const QDockWidget *>(w)) { if (const QDockWidget *dockWidget = qobject_cast<const QDockWidget *>(w)) {
bool floating = dockWidget->isFloating(); bool floating = dockWidget->isFloating();
@ -4412,6 +4487,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
} }
} }
break; break;
#endif
case CE_FocusFrame: { case CE_FocusFrame: {
const int hMargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, w); const int hMargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, w);
const int vMargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin, opt, w); const int vMargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin, opt, w);
@ -4536,9 +4612,11 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
// Always be normal or disabled to follow the Mac style. // Always be normal or disabled to follow the Mac style.
int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize); int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize);
QSize iconSize(smallIconSize, smallIconSize); QSize iconSize(smallIconSize, smallIconSize);
#ifndef QT_NO_COMBOBOX
if (const QComboBox *comboBox = qobject_cast<const QComboBox *>(w)) { if (const QComboBox *comboBox = qobject_cast<const QComboBox *>(w)) {
iconSize = comboBox->iconSize(); iconSize = comboBox->iconSize();
} }
#endif
QPixmap pixmap = mi->icon.pixmap(window, iconSize, mode); QPixmap pixmap = mi->icon.pixmap(window, iconSize, mode);
int pixw = pixmap.width() / pixmap.devicePixelRatio(); int pixw = pixmap.width() / pixmap.devicePixelRatio();
int pixh = pixmap.height() / pixmap.devicePixelRatio(); int pixh = pixmap.height() / pixmap.devicePixelRatio();
@ -4822,6 +4900,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
} }
} }
break; break;
#ifndef QT_NO_TOOLBAR
case CE_ToolBar: { case CE_ToolBar: {
const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(opt); const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(opt);
@ -4830,6 +4909,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
// the title bar. The following code fills the toolBar area with transparent pixels // the title bar. The following code fills the toolBar area with transparent pixels
// to make that gradient visible. // to make that gradient visible.
if (w) { if (w) {
#ifndef QT_NO_MAINWINDOW
if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(w->window())) { if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(w->window())) {
if (toolBar && toolBar->toolBarArea == Qt::TopToolBarArea && mainWindow->unifiedTitleAndToolBarOnMac()) { if (toolBar && toolBar->toolBarArea == Qt::TopToolBarArea && mainWindow->unifiedTitleAndToolBarOnMac()) {
@ -4858,6 +4938,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
break; break;
} }
} }
#endif
} }
// draw background gradient // draw background gradient
@ -4888,6 +4969,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
} break; } break;
#endif
default: default:
QCommonStyle::drawControl(ce, opt, p, w); QCommonStyle::drawControl(ce, opt, p, w);
break; break;
@ -4979,6 +5061,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
int(outRect.size.height)); int(outRect.size.height));
break; break;
} }
#ifndef QT_NO_TABWIDGET
case SE_TabWidgetLeftCorner: case SE_TabWidgetLeftCorner:
if (const QStyleOptionTabWidgetFrame *twf if (const QStyleOptionTabWidgetFrame *twf
= qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
@ -5040,11 +5123,14 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
} }
} }
break; break;
#endif
case SE_LineEditContents: case SE_LineEditContents:
rect = QCommonStyle::subElementRect(sr, opt, widget); rect = QCommonStyle::subElementRect(sr, opt, widget);
#ifndef QT_NO_COMBOBOX
if (widget && qobject_cast<const QComboBox*>(widget->parentWidget())) if (widget && qobject_cast<const QComboBox*>(widget->parentWidget()))
rect.adjust(-1, -2, 0, 0); rect.adjust(-1, -2, 0, 0);
else else
#endif
rect.adjust(-1, -1, 0, +1); rect.adjust(-1, -1, 0, +1);
break; break;
case SE_CheckBoxLayoutItem: case SE_CheckBoxLayoutItem:
@ -5058,12 +5144,15 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
} }
break; break;
case SE_ComboBoxLayoutItem: case SE_ComboBoxLayoutItem:
#ifndef QT_NO_TOOLBAR
if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) { if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) {
// Do nothing, because QToolbar needs the entire widget rect. // Do nothing, because QToolbar needs the entire widget rect.
// Otherwise it will be clipped. Equivalent to // Otherwise it will be clipped. Equivalent to
// widget->setAttribute(Qt::WA_LayoutUsesWidgetRect), but without // widget->setAttribute(Qt::WA_LayoutUsesWidgetRect), but without
// all the hassle. // all the hassle.
} else { } else
#endif
{
rect = opt->rect; rect = opt->rect;
if (controlSize == QAquaSizeLarge) { if (controlSize == QAquaSizeLarge) {
rect.adjust(+3, +2, -3, -4); rect.adjust(+3, +2, -3, -4);
@ -5181,6 +5270,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
} }
rect.setBottom(rect.bottom() - 1); rect.setBottom(rect.bottom() - 1);
break; break;
#ifndef QT_NO_TABWIDGET
case SE_TabWidgetLayoutItem: case SE_TabWidgetLayoutItem:
if (const QStyleOptionTabWidgetFrame *tabWidgetOpt = if (const QStyleOptionTabWidgetFrame *tabWidgetOpt =
qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
@ -5194,6 +5284,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
rect.setTop(rect.top() + SIZE(6 /* AHIG */, 3 /* guess */, 2 /* AHIG */)); rect.setTop(rect.top() + SIZE(6 /* AHIG */, 3 /* guess */, 2 /* AHIG */));
} }
break; break;
#endif
#ifndef QT_NO_DOCKWIDGET #ifndef QT_NO_DOCKWIDGET
case SE_DockWidgetCloseButton: case SE_DockWidgetCloseButton:
case SE_DockWidgetFloatButton: case SE_DockWidgetFloatButton:
@ -5700,6 +5791,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
} }
} }
break; break;
#ifndef QT_NO_SPINBOX
case CC_SpinBox: case CC_SpinBox:
if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
QStyleOptionSpinBox newSB = *sb; QStyleOptionSpinBox newSB = *sb;
@ -5770,6 +5862,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
} }
} }
break; break;
#endif
case CC_ComboBox: case CC_ComboBox:
if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(opt)){ if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(opt)){
HIThemeButtonDrawInfo bdi; HIThemeButtonDrawInfo bdi;
@ -6075,10 +6168,12 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
#endif #endif
} }
break; break;
#ifndef QT_NO_DIAL
case CC_Dial: case CC_Dial:
if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(opt)) if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(opt))
QStyleHelper::drawDial(dial, p); QStyleHelper::drawDial(dial, p);
break; break;
#endif
default: default:
QCommonStyle::drawComplexControl(cc, opt, p, widget); QCommonStyle::drawComplexControl(cc, opt, p, widget);
break; break;
@ -6456,6 +6551,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
} }
} }
break; break;
#ifndef QT_NO_SPINBOX
case CC_SpinBox: case CC_SpinBox:
if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
QAquaWidgetSize aquaSize = d->aquaSizeConstrain(spin, widget); QAquaWidgetSize aquaSize = d->aquaSizeConstrain(spin, widget);
@ -6549,6 +6645,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
} }
} }
break; break;
#endif
case CC_ToolButton: case CC_ToolButton:
ret = QCommonStyle::subControlRect(cc, opt, sc, widget); ret = QCommonStyle::subControlRect(cc, opt, sc, widget);
if (sc == SC_ToolButtonMenu if (sc == SC_ToolButtonMenu
@ -6574,7 +6671,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
bool useAquaGuideline = true; bool useAquaGuideline = true;
switch (ct) { switch (ct) {
#ifndef QT_NO_SPINBOX
case CT_SpinBox: case CT_SpinBox:
if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
// Add button + frame widths // Add button + frame widths
@ -6583,6 +6680,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
sz += QSize(buttonWidth + 2*fw, 2*fw - 3); sz += QSize(buttonWidth + 2*fw, 2*fw - 3);
} }
break; break;
#endif
case QStyle::CT_TabWidget: case QStyle::CT_TabWidget:
// the size between the pane and the "contentsRect" (+4,+4) // the size between the pane and the "contentsRect" (+4,+4)
// (the "contentsRect" is on the inside of the pane) // (the "contentsRect" is on the inside of the pane)
@ -6618,7 +6716,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
* overlap is how much the pane should overlap the tab bar * overlap is how much the pane should overlap the tab bar
*/ */
// then add the size between the stackwidget and the "contentsRect" // then add the size between the stackwidget and the "contentsRect"
#ifndef QT_NO_TABWIDGET
if (const QStyleOptionTabWidgetFrame *twf if (const QStyleOptionTabWidgetFrame *twf
= qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
QSize extra(0,0); QSize extra(0,0);
@ -6632,8 +6730,9 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
} }
sz+= extra; sz+= extra;
} }
#endif
break; break;
#ifndef QT_NO_TABBAR
case QStyle::CT_TabBarTab: case QStyle::CT_TabBarTab:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
const QAquaWidgetSize AquaSize = d->aquaSizeConstrain(opt, widget); const QAquaWidgetSize AquaSize = d->aquaSizeConstrain(opt, widget);
@ -6701,6 +6800,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
} }
} }
break; break;
#endif
case QStyle::CT_PushButton: case QStyle::CT_PushButton:
// By default, we fit the contents inside a normal rounded push button. // By default, we fit the contents inside a normal rounded push button.
// Do this by add enough space around the contents so that rounded // Do this by add enough space around the contents so that rounded
@ -6714,7 +6814,9 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
case QStyle::CT_MenuItem: case QStyle::CT_MenuItem:
if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
int maxpmw = mi->maxIconWidth; int maxpmw = mi->maxIconWidth;
#ifndef QT_NO_COMBOBOX
const QComboBox *comboBox = qobject_cast<const QComboBox *>(widget); const QComboBox *comboBox = qobject_cast<const QComboBox *>(widget);
#endif
int w = sz.width(), int w = sz.width(),
h = sz.height(); h = sz.height();
if (mi->menuItemType == QStyleOptionMenuItem::Separator) { if (mi->menuItemType == QStyleOptionMenuItem::Separator) {
@ -6725,11 +6827,14 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
} else { } else {
h = mi->fontMetrics.height() + 2; h = mi->fontMetrics.height() + 2;
if (!mi->icon.isNull()) { if (!mi->icon.isNull()) {
#ifndef QT_NO_COMBOBOX
if (comboBox) { if (comboBox) {
const QSize &iconSize = comboBox->iconSize(); const QSize &iconSize = comboBox->iconSize();
h = qMax(h, iconSize.height() + 4); h = qMax(h, iconSize.height() + 4);
maxpmw = qMax(maxpmw, iconSize.width()); maxpmw = qMax(maxpmw, iconSize.width());
} else { } else
#endif
{
int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
h = qMax(h, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 4); h = qMax(h, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 4);
} }
@ -6743,6 +6848,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
w += maxpmw + 6; w += maxpmw + 6;
// add space for a check. All items have place for a check too. // add space for a check. All items have place for a check too.
w += 20; w += 20;
#ifndef QT_NO_COMBOBOX
if (comboBox && comboBox->isVisible()) { if (comboBox && comboBox->isVisible()) {
QStyleOptionComboBox cmb; QStyleOptionComboBox cmb;
cmb.initFrom(comboBox); cmb.initFrom(comboBox);
@ -6752,7 +6858,9 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
w = qMax(w, subControlRect(QStyle::CC_ComboBox, &cmb, w = qMax(w, subControlRect(QStyle::CC_ComboBox, &cmb,
QStyle::SC_ComboBoxEditField, QStyle::SC_ComboBoxEditField,
comboBox).width()); comboBox).width());
} else { } else
#endif
{
w += 12; w += 12;
} }
sz = QSize(w, h); sz = QSize(w, h);

View File

@ -391,9 +391,11 @@ void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rec
QColor backgroundColor(const QPalette &pal, const QWidget* widget) QColor backgroundColor(const QPalette &pal, const QWidget* widget)
{ {
#ifndef QT_NO_SCROLLBAR
if (qobject_cast<const QScrollBar *>(widget) && widget->parent() && if (qobject_cast<const QScrollBar *>(widget) && widget->parent() &&
qobject_cast<const QAbstractScrollArea *>(widget->parent()->parent())) qobject_cast<const QAbstractScrollArea *>(widget->parent()->parent()))
return widget->parentWidget()->parentWidget()->palette().color(QPalette::Base); return widget->parentWidget()->parentWidget()->palette().color(QPalette::Base);
#endif
return pal.color(QPalette::Base); return pal.color(QPalette::Base);
} }

View File

@ -1100,6 +1100,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e)
break; break;
} }
default: default:
#ifndef QT_NO_SHORTCUT
if (e->matches(QKeySequence::Cancel) && d->down) { if (e->matches(QKeySequence::Cancel) && d->down) {
setDown(false); setDown(false);
repaint(); //flush paint event before invoking potentially expensive operation repaint(); //flush paint event before invoking potentially expensive operation
@ -1107,6 +1108,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e)
d->emitReleased(); d->emitReleased();
return; return;
} }
#endif
e->ignore(); e->ignore();
} }
} }

View File

@ -202,10 +202,13 @@ bool QAlphaWidget::eventFilter(QObject *o, QEvent *e)
render(); render();
break; break;
case QEvent::KeyPress: { case QEvent::KeyPress: {
#ifndef QT_NO_SHORTCUT
QKeyEvent *ke = (QKeyEvent*)e; QKeyEvent *ke = (QKeyEvent*)e;
if (ke->matches(QKeySequence::Cancel)) { if (ke->matches(QKeySequence::Cancel)) {
showWidget = false; showWidget = false;
} else { } else
#endif
{
duration = 0; duration = 0;
} }
render(); render();

View File

@ -2731,7 +2731,10 @@ QMenu::event(QEvent *e)
if (kev->key() == Qt::Key_Up || kev->key() == Qt::Key_Down if (kev->key() == Qt::Key_Up || kev->key() == Qt::Key_Down
|| kev->key() == Qt::Key_Left || kev->key() == Qt::Key_Right || kev->key() == Qt::Key_Left || kev->key() == Qt::Key_Right
|| kev->key() == Qt::Key_Enter || kev->key() == Qt::Key_Return || kev->key() == Qt::Key_Enter || kev->key() == Qt::Key_Return
|| kev->matches(QKeySequence::Cancel)) { #ifndef QT_NO_SHORTCUT
|| kev->matches(QKeySequence::Cancel)
#endif
) {
e->accept(); e->accept();
return true; return true;
} }
@ -3059,7 +3062,11 @@ void QMenu::keyPressEvent(QKeyEvent *e)
key_consumed = false; key_consumed = false;
} }
if (!key_consumed && (e->matches(QKeySequence::Cancel) if (!key_consumed && (
false
#ifndef QT_NO_SHORTCUT
|| e->matches(QKeySequence::Cancel)
#endif
#ifdef QT_KEYPAD_NAVIGATION #ifdef QT_KEYPAD_NAVIGATION
|| e->key() == Qt::Key_Back || e->key() == Qt::Key_Back
#endif #endif
@ -3275,7 +3282,9 @@ static void copyActionToPlatformItem(const QAction *action, QPlatformMenuItem *i
item->setIcon(QIcon()); item->setIcon(QIcon());
} }
item->setVisible(action->isVisible()); item->setVisible(action->isVisible());
#ifndef QT_NO_SHORTCUT
item->setShortcut(action->shortcut()); item->setShortcut(action->shortcut());
#endif
item->setCheckable(action->isCheckable()); item->setCheckable(action->isCheckable());
item->setChecked(action->isChecked()); item->setChecked(action->isChecked());
item->setHasExclusiveGroup(action->actionGroup() && action->actionGroup()->isExclusive()); item->setHasExclusiveGroup(action->actionGroup() && action->actionGroup()->isExclusive());

View File

@ -1113,11 +1113,13 @@ void QMenuBar::keyPressEvent(QKeyEvent *e)
key_consumed = false; key_consumed = false;
} }
#ifndef QT_NO_SHORTCUT
if (!key_consumed && e->matches(QKeySequence::Cancel)) { if (!key_consumed && e->matches(QKeySequence::Cancel)) {
d->setCurrentAction(0); d->setCurrentAction(0);
d->setKeyboardMode(false); d->setKeyboardMode(false);
key_consumed = true; key_consumed = true;
} }
#endif
if(!key_consumed && if(!key_consumed &&
(!e->modifiers() || (!e->modifiers() ||
@ -1425,6 +1427,7 @@ bool QMenuBar::event(QEvent *e)
case QEvent::Show: case QEvent::Show:
d->_q_updateLayout(); d->_q_updateLayout();
break; break;
#ifndef QT_NO_SHORTCUT
case QEvent::ShortcutOverride: { case QEvent::ShortcutOverride: {
QKeyEvent *kev = static_cast<QKeyEvent*>(e); QKeyEvent *kev = static_cast<QKeyEvent*>(e);
//we only filter out escape if there is a current action //we only filter out escape if there is a current action
@ -1434,8 +1437,7 @@ bool QMenuBar::event(QEvent *e)
} }
} }
break; break;
#endif
#ifndef QT_NO_WHATSTHIS #ifndef QT_NO_WHATSTHIS
case QEvent::QueryWhatsThis: case QEvent::QueryWhatsThis:
e->setAccepted(d->whatsThis.size()); e->setAccepted(d->whatsThis.size());