summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-11-01 10:27:41 +0100
committerLiang Qi <liang.qi@qt.io>2016-11-02 09:24:11 +0100
commitd7e4980132057aa10e54137114bf65e06c455030 (patch)
tree9d6ae36efa0cf84a612bfec6cf3dd2ea7f7e3446 /src/widgets
parent44c402b4bfba44480382244b8409fb3cf34d7ac1 (diff)
parenta732576a66ff2bbd9c0b41cd5f3505a4d2fbf043 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Blacklist tst_QMenuBar::taskQTBUG46812_doNotLeaveMenubarHighlighted() on macOS. Conflicts: mkspecs/features/mac/default_post.prf mkspecs/features/mac/sdk.prf mkspecs/features/uikit/default_post.prf mkspecs/features/uikit/sdk.prf src/angle/src/libEGL/libEGL.pro src/platformsupport/fontdatabases/fontdatabases.pro src/platformsupport/platformsupport.pro src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp src/plugins/platforms/ios/ios.pro src/plugins/platforms/ios/kernel.pro tests/auto/widgets/widgets/qmenubar/BLACKLIST tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp Task-number: QTBUG-56853 Change-Id: If58785210feee3550892fc7768cce90e75a2416c
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/configure.json6
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp5
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp14
-rw-r--r--src/widgets/doc/snippets/code/doc_src_styles.cpp2
-rw-r--r--src/widgets/doc/snippets/macmainwindow.mm4
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsview_p.h4
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicswidget_p.cpp4
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp2
-rw-r--r--src/widgets/itemviews/qheaderview.cpp2
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp2
-rw-r--r--src/widgets/itemviews/qtreeview.cpp2
-rw-r--r--src/widgets/kernel/qapplication.cpp9
-rw-r--r--src/widgets/kernel/qapplication_p.h20
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp4
-rw-r--r--src/widgets/kernel/qt_widgets_pch.h2
-rw-r--r--src/widgets/kernel/qtooltip.cpp16
-rw-r--r--src/widgets/kernel/qwhatsthis.cpp6
-rw-r--r--src/widgets/kernel/qwidget.cpp201
-rw-r--r--src/widgets/kernel/qwidget.h4
-rw-r--r--src/widgets/kernel/qwidget_p.h21
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp14
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp2
-rw-r--r--src/widgets/styles/qcommonstyle.cpp10
-rw-r--r--src/widgets/styles/qfusionstyle.cpp2
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm8
-rw-r--r--src/widgets/styles/qmacstyle_mac_p.h2
-rw-r--r--src/widgets/styles/qpixmapstyle.cpp4
-rw-r--r--src/widgets/styles/qstylefactory.cpp4
-rw-r--r--src/widgets/styles/qstyleoption.cpp2
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp2
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp36
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p_p.h4
-rw-r--r--src/widgets/util/qflickgesture.cpp2
-rw-r--r--src/widgets/util/qscroller.cpp6
-rw-r--r--src/widgets/util/qscroller_mac.mm2
-rw-r--r--src/widgets/util/qscrollerproperties.cpp4
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp2
-rw-r--r--src/widgets/util/qundostack.cpp27
-rw-r--r--src/widgets/util/qundostack.h1
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp28
-rw-r--r--src/widgets/widgets/qabstractscrollarea_p.h4
-rw-r--r--src/widgets/widgets/qabstractslider.cpp2
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp6
-rw-r--r--src/widgets/widgets/qcombobox.cpp15
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp6
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp2
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp10
-rw-r--r--src/widgets/widgets/qdockwidget.cpp8
-rw-r--r--src/widgets/widgets/qlineedit.cpp8
-rw-r--r--src/widgets/widgets/qmainwindow.cpp22
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp24
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h4
-rw-r--r--src/widgets/widgets/qmdiarea.cpp8
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp6
-rw-r--r--src/widgets/widgets/qmenu.cpp203
-rw-r--r--src/widgets/widgets/qmenu_mac.mm6
-rw-r--r--src/widgets/widgets/qmenu_p.h22
-rw-r--r--src/widgets/widgets/qmenubar.cpp4
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp2
-rw-r--r--src/widgets/widgets/qpushbutton.cpp8
-rw-r--r--src/widgets/widgets/qpushbutton.h4
-rw-r--r--src/widgets/widgets/qpushbutton_p.h2
-rw-r--r--src/widgets/widgets/qrubberband.cpp8
-rw-r--r--src/widgets/widgets/qsizegrip.cpp18
-rw-r--r--src/widgets/widgets/qstatusbar.cpp4
-rw-r--r--src/widgets/widgets/qtabbar.cpp15
-rw-r--r--src/widgets/widgets/qtabbar_p.h4
-rw-r--r--src/widgets/widgets/qtextedit.cpp2
-rw-r--r--src/widgets/widgets/qtoolbar.cpp2
-rw-r--r--src/widgets/widgets/qtoolbararealayout.cpp7
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp2
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol_p.h8
-rw-r--r--src/widgets/widgets/qwidgetresizehandler.cpp4
77 files changed, 561 insertions, 393 deletions
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index c1931d9d80..b241fcdf11 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -8,7 +8,6 @@
"commandline": {
"options": {
- "android-style-assets": "boolean",
"gtk": { "type": "boolean", "name": "gtk3" },
"style-windows": "boolean",
"style-windowsxp": "boolean",
@@ -78,11 +77,6 @@
"condition": "features.style-windows && features.properties && features.cssparser",
"output": [ "publicFeature", "feature" ]
},
- "android-style-assets": {
- "label": "Android Style Assets",
- "condition": "features.style-android",
- "output": [ "privateConfig" ]
- },
"effects": {
"label": "Effects",
"purpose": "Provides special widget effects (e.g. fading and scrolling).",
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 879f085f11..74875faf21 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -892,6 +892,9 @@ void QFileDialogPrivate::_q_goToUrl(const QUrl &url)
{QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).last()},
a native image picker dialog will be used for accessing the user's photo album.
The filename returned can be loaded using QFile and related APIs.
+ For this to be enabled, the Info.plist assigned to QMAKE_INFO_PLIST in the
+ project file must contain the key \c NSPhotoLibraryUsageDescription. See
+ Info.plist documentation from Apple for more information regarding this key.
This feature was added in Qt 5.5.
*/
void QFileDialog::setDirectory(const QString &directory)
@@ -2034,10 +2037,12 @@ QString QFileDialog::labelText(DialogLabel label) const
button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Save);
if (button)
return button->text();
+ break;
case Reject:
button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Cancel);
if (button)
return button->text();
+ break;
}
return QString();
}
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 6e1bee94c4..db1ce3fe0e 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -904,16 +904,14 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in
int visibleLocation = parentNode->visibleLocation(parentNode->children.value(indexNode->fileName)->fileName);
parentNode->visibleChildren.removeAt(visibleLocation);
- QFileSystemModelPrivate::QFileSystemNode * oldValue = parentNode->children.value(oldName);
- parentNode->children[newName] = oldValue;
- oldValue->fileName = newName;
- oldValue->parent = parentNode;
+ QScopedPointer<QFileSystemModelPrivate::QFileSystemNode> nodeToRename(parentNode->children.take(oldName));
+ nodeToRename->fileName = newName;
+ nodeToRename->parent = parentNode;
#ifndef QT_NO_FILESYSTEMWATCHER
- oldValue->populate(d->fileInfoGatherer.getInfo(QFileInfo(parentPath, newName)));
+ nodeToRename->populate(d->fileInfoGatherer.getInfo(QFileInfo(parentPath, newName)));
#endif
- oldValue->isVisible = true;
-
- parentNode->children.remove(oldName);
+ nodeToRename->isVisible = true;
+ parentNode->children[newName] = nodeToRename.take();
parentNode->visibleChildren.insert(visibleLocation, newName);
d->delayedSort();
diff --git a/src/widgets/doc/snippets/code/doc_src_styles.cpp b/src/widgets/doc/snippets/code/doc_src_styles.cpp
index b10c875111..a70ed6b11d 100644
--- a/src/widgets/doc/snippets/code/doc_src_styles.cpp
+++ b/src/widgets/doc/snippets/code/doc_src_styles.cpp
@@ -81,7 +81,7 @@
state |= QStyle::State_MouseOver;
if (widget->window()->isActiveWindow())
state |= QStyle::State_Active;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
extern bool qt_mac_can_clickThrough(const QWidget *w); //qwidget_mac.cpp
if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget))
state &= ~QStyle::State_Enabled;
diff --git a/src/widgets/doc/snippets/macmainwindow.mm b/src/widgets/doc/snippets/macmainwindow.mm
index f74f8453c7..d848e6442d 100644
--- a/src/widgets/doc/snippets/macmainwindow.mm
+++ b/src/widgets/doc/snippets/macmainwindow.mm
@@ -41,7 +41,7 @@
#include <QtGui>
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
#include <Carbon/Carbon.h>
@@ -289,4 +289,4 @@ QAbstractItemModel *MacMainWindow::createDocumentModel()
return model;
}
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index 5492862287..6124796073 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -7492,7 +7492,7 @@ void QGraphicsItem::setInputMethodHints(Qt::InputMethodHints hints)
*/
void QGraphicsItem::updateMicroFocus()
{
-#if !defined(QT_NO_IM) && defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if !defined(QT_NO_IM) && 0 /* Used to be included in Qt4 for Q_WS_X11 */
if (QWidget *fw = QApplication::focusWidget()) {
if (scene()) {
for (int i = 0 ; i < scene()->views().count() ; ++i) {
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index 5b46eb35be..e6726285d9 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -4160,7 +4160,7 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent)
wheelEvent->scenePos(),
wheelEvent->widget());
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// On Mac, ignore the event if the first item under the mouse is not the last opened
// popup (or one of its descendant)
if (!d->popupWidgets.isEmpty() && !wheelCandidates.isEmpty() && wheelCandidates.first() != d->popupWidgets.back() && !d->popupWidgets.back()->isAncestorOf(wheelCandidates.first())) {
@@ -4399,7 +4399,7 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
// Render directly, using no cache.
if (cacheMode == QGraphicsItem::NoCache
-#ifdef Q_DEAD_CODE_FROM_QT4_X11
+#if 0 // Used to be included in Qt4 for Q_WS_X11
|| !X11->use_xrender
#endif
) {
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index 3f7d2d1cd1..41f5eddd99 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -3490,7 +3490,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
// Draw background
if ((d->cacheMode & CacheBackground)
-#ifdef Q_DEAD_CODE_FROM_QT4_X11
+#if 0 // Used to be included in Qt4 for Q_WS_X11
&& X11->use_xrender
#endif
) {
@@ -3689,7 +3689,7 @@ void QGraphicsView::scrollContentsBy(int dx, int dy)
d->updateLastCenterPoint();
if ((d->cacheMode & CacheBackground)
-#ifdef Q_DEAD_CODE_FROM_QT4_X11
+#if 0 // Used to be included in Qt4 for Q_WS_X11
&& X11->use_xrender
#endif
) {
diff --git a/src/widgets/graphicsview/qgraphicsview_p.h b/src/widgets/graphicsview/qgraphicsview_p.h
index 9065650216..10103a1809 100644
--- a/src/widgets/graphicsview/qgraphicsview_p.h
+++ b/src/widgets/graphicsview/qgraphicsview_p.h
@@ -184,7 +184,7 @@ public:
inline void dispatchPendingUpdateRequests()
{
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// QWidget::update() works slightly different on the Mac without the raster engine;
// it's not part of our backing store so it needs special threatment.
if (QApplicationPrivate::graphics_system_name != QLatin1String("raster")) {
@@ -195,7 +195,7 @@ public:
extern void qt_mac_dispatchPendingUpdateRequests(QWidget *);
qt_mac_dispatchPendingUpdateRequests(viewport->window());
} else
-#endif // !Q_DEAD_CODE_FROM_QT4_MAC
+#endif
{
if (qt_widget_private(viewport)->paintOnScreen())
QCoreApplication::sendPostedEvents(viewport, QEvent::UpdateRequest);
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index e1ba3759e0..d153915ae6 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -708,7 +708,7 @@ void QGraphicsWidget::initStyleOption(QStyleOption *option) const
option->state |= QStyle::State_Window;
/*
###
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
extern bool qt_mac_can_clickThrough(const QGraphicsWidget *w); //qwidget_mac.cpp
if (!(option->state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget))
option->state &= ~QStyle::State_Enabled;
diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp
index faf1a4c49a..4beb64a254 100644
--- a/src/widgets/graphicsview/qgraphicswidget_p.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp
@@ -52,7 +52,7 @@
#include <QtWidgets/qstyleoption.h>
#include <QtWidgets/QStyleOptionTitleBar>
#include <QtWidgets/QGraphicsSceneMouseEvent>
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC) && !defined(QT_NO_STYLE_MAC)
+#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_STYLE_MAC)
# include <private/qmacstyle_mac_p.h>
#endif
@@ -704,7 +704,7 @@ void QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(QGraphicsSceneHoverEvent
case Qt::TitleBarArea:
windowData->buttonRect = q->style()->subControlRect(
QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, 0);
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// On mac we should hover if we are in the 'area' of the buttons
windowData->buttonRect |= q->style()->subControlRect(
QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarMinButton, 0);
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index fff09b46d0..6ecf5a664f 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -3698,7 +3698,7 @@ QStyleOptionViewItem QAbstractItemView::viewOptions() const
option.state &= ~QStyle::State_MouseOver;
option.font = font();
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
// On mac the focus appearance follows window activation
// not widget activation
if (!hasFocus())
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 85bd3003e1..837383f016 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -2450,7 +2450,7 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
if (pos < 0 && d->state != QHeaderViewPrivate::SelectSections)
return;
if (e->buttons() == Qt::NoButton) {
-#if !defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
// Under Cocoa, when the mouse button is released, may include an extra
// simulated mouse moved event. The state of the buttons when this event
// is generated is already "no button" and the code below gets executed
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index bab8436dce..e4115c9e60 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -366,7 +366,7 @@ void QStyledItemDelegate::initStyleOption(QStyleOptionViewItem *option,
if it is enabled or selected.
After painting, you should ensure that the painter is returned to
- its the state it was supplied in when this function was called.
+ the state it was supplied in when this function was called.
For example, it may be useful to call QPainter::save() before
painting and QPainter::restore() afterwards.
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index cfe68d6b6a..2d1d1f43d0 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -2194,7 +2194,7 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
return QModelIndex();
}
int vi = -1;
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC) && !defined(QT_NO_STYLE_MAC)
+#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_STYLE_MAC)
// Selection behavior is slightly different on the Mac.
if (d->selectionMode == QAbstractItemView::ExtendedSelection
&& d->selectionModel
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index b94aa826d3..89eff898fe 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -4160,13 +4160,10 @@ void QApplication::beep()
\relates QApplication
A global pointer referring to the unique application object. It is
- equivalent to the pointer returned by the QCoreApplication::instance()
- function except that, in GUI applications, it is a pointer to a
- QApplication instance.
+ equivalent to QCoreApplication::instance(), but cast as a QApplication pointer,
+ so only valid when the unique application object is a QApplication.
- Only one application object can be created.
-
- \sa QCoreApplication::instance()
+ \sa QCoreApplication::instance(), qGuiApp
*/
/*!
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 02079fb8d5..2a7859b056 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -112,7 +112,7 @@ public:
virtual bool shouldQuit() Q_DECL_OVERRIDE;
bool tryCloseAllWindows() Q_DECL_OVERRIDE;
-#if defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if 0 // Used to be included in Qt4 for Q_WS_X11
#ifndef QT_NO_SETTINGS
static bool x11_apply_settings();
#endif
@@ -132,7 +132,7 @@ public:
static bool isBlockedByModal(QWidget *widget);
static bool modalState();
static bool tryModalHelper(QWidget *widget, QWidget **rettop = 0);
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
static QWidget *tryModalHelper_sys(QWidget *top);
bool canQuit();
#endif
@@ -146,14 +146,14 @@ public:
bool notify_helper(QObject *receiver, QEvent * e);
void init(
-#ifdef Q_DEAD_CODE_FROM_QT4_X11
+#if 0 // Used to be included in Qt4 for Q_WS_X11
Display *dpy = 0, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0
#endif
);
void initialize();
void process_cmdline();
-#if defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if 0 // Used to be included in Qt4 for Q_WS_X11
static void x11_initialize_style();
#endif
@@ -208,7 +208,7 @@ public:
static void initializeWidgetFontHash();
static void setSystemFont(const QFont &font);
-#if defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if 0 // Used to be included in Qt4 for Q_WS_X11
static void applyX11SpecificCommandLineArguments(QWidget *main_widget);
#endif
@@ -219,7 +219,7 @@ public:
static Qt::NavigationMode navigationMode;
#endif
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC) || defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ || 0 /* Used to be included in Qt4 for Q_WS_X11 */
void _q_alertTimeOut();
QHash<QWidget *, QTimer *> alertTimerHash;
#endif
@@ -259,12 +259,12 @@ public:
QGestureManager *gestureManager;
QWidget *gestureWidget;
#endif
-#if defined(Q_DEAD_CODE_FROM_QT4_X11) || defined(Q_DEAD_CODE_FROM_QT4_WIN)
+#if 0 /* Used to be included in Qt4 for Q_WS_X11 */ || 0 /* Used to be included in Qt4 for Q_WS_WIN */
QPixmap *move_cursor;
QPixmap *copy_cursor;
QPixmap *link_cursor;
#endif
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN)
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
QPixmap *ignore_cursor;
#endif
@@ -295,9 +295,9 @@ private:
static bool isAlien(QWidget *);
};
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN)
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
extern void qt_win_set_cursor(QWidget *, bool);
-#elif defined(Q_DEAD_CODE_FROM_QT4_X11)
+#elif 0 // Used to be included in Qt4 for Q_WS_X11
extern void qt_x11_enforce_cursor(QWidget *, bool);
extern void qt_x11_enforce_cursor(QWidget *);
#else
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index c901285d1a..2e5c2c53bd 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -52,7 +52,7 @@
#ifdef Q_OS_OSX
#include "qmacgesturerecognizer_p.h"
#endif
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN) && !defined(QT_NO_NATIVE_GESTURES)
+#if 0 /* Used to be included in Qt4 for Q_WS_WIN */ && !defined(QT_NO_NATIVE_GESTURES)
#include "qwinnativepangesturerecognizer_win_p.h"
#endif
@@ -100,7 +100,7 @@ QGestureManager::QGestureManager(QObject *parent)
registerGestureRecognizer(new QSwipeGestureRecognizer);
registerGestureRecognizer(new QTapGestureRecognizer);
#endif
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN)
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
#if !defined(QT_NO_NATIVE_GESTURES)
if (QApplicationPrivate::HasTouchSupport)
registerGestureRecognizer(new QWinNativePanGestureRecognizer);
diff --git a/src/widgets/kernel/qt_widgets_pch.h b/src/widgets/kernel/qt_widgets_pch.h
index f30202d89e..924a68d62e 100644
--- a/src/widgets/kernel/qt_widgets_pch.h
+++ b/src/widgets/kernel/qt_widgets_pch.h
@@ -50,7 +50,7 @@
#include <qtwidgetsglobal.h>
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
# define _POSIX_
# include <limits.h>
# undef _POSIX_
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index 78929d8cd5..a92dc2cbf7 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -36,7 +36,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
# include <private/qcore_mac_p.h>
#endif
@@ -56,7 +56,7 @@
#include <private/qstylesheetstyle_p.h>
#ifndef QT_NO_TOOLTIP
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
# include <private/qcore_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
#endif
@@ -284,7 +284,7 @@ void QTipLabel::timerEvent(QTimerEvent *e)
|| e->timerId() == expireTimer.timerId()){
hideTimer.stop();
expireTimer.stop();
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC) && !defined(QT_NO_EFFECTS)
+#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_EFFECTS)
if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)){
// Fade out tip on mac (makes it invisible).
// The tip will not be deleted until a new tip is shown.
@@ -304,7 +304,7 @@ void QTipLabel::timerEvent(QTimerEvent *e)
bool QTipLabel::eventFilter(QObject *o, QEvent *e)
{
switch (e->type()) {
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
case QEvent::KeyPress:
case QEvent::KeyRelease: {
int key = static_cast<QKeyEvent *>(e)->key();
@@ -386,7 +386,7 @@ void QTipLabel::placeTip(const QPoint &pos, QWidget *w)
#endif //QT_NO_STYLE_STYLESHEET
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// When in full screen mode, there is no Dock nor Menu so we can use
// the whole screen for displaying the tooltip. However when not in
// full screen mode we need to save space for the dock, so we use
@@ -403,7 +403,7 @@ void QTipLabel::placeTip(const QPoint &pos, QWidget *w)
QPoint p = pos;
p += QPoint(2,
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
21
#else
16
@@ -492,7 +492,7 @@ void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, cons
}
if (!text.isEmpty()){ // no tip can be reused, create new tip:
-#ifndef Q_DEAD_CODE_FROM_QT4_WIN
+#if 1 // Used to be excluded in Qt4 for Q_WS_WIN
new QTipLabel(text, w, msecDisplayTime); // sets QTipLabel::instance to itself
#else
// On windows, we can't use the widget as parent otherwise the window will be
@@ -504,7 +504,7 @@ void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, cons
QTipLabel::instance->setObjectName(QLatin1String("qtooltip_label"));
-#if !defined(QT_NO_EFFECTS) && !defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if !defined(QT_NO_EFFECTS) && !0 /* Used to be included in Qt4 for Q_WS_MAC */
if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip))
qFadeEffect(QTipLabel::instance);
else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip))
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index 32fe5f5e64..6061af5f38 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -570,7 +570,7 @@ void QWhatsThisPrivate::say(QWidget * widget, const QString &text, int x, int y)
// make a fresh widget, and set it up
QWhatsThat *whatsThat = new QWhatsThat(
text,
-#if defined(Q_DEAD_CODE_FROM_QT4_X11) && !defined(QT_NO_CURSOR)
+#if 0 /* Used to be included in Qt4 for Q_WS_X11 */ && !defined(QT_NO_CURSOR)
QApplication::desktop()->screen(widget ? widget->x11Info().screen() : QCursor::x11Screen()),
#else
0,
@@ -583,11 +583,11 @@ void QWhatsThisPrivate::say(QWidget * widget, const QString &text, int x, int y)
int scr = (widget ?
QApplication::desktop()->screenNumber(widget) :
-#if defined(Q_DEAD_CODE_FROM_QT4_X11) && !defined(QT_NO_CURSOR)
+#if 0 /* Used to be included in Qt4 for Q_WS_X11 */ && !defined(QT_NO_CURSOR)
QCursor::x11Screen()
#else
QApplication::desktop()->screenNumber(QPoint(x,y))
-#endif // Q_DEAD_CODE_FROM_QT4_X11
+#endif
);
QRect screen = QApplication::desktop()->screenGeometry(scr);
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 51e1ef9aaf..dc04bfb632 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -59,7 +59,7 @@
#ifndef QT_NO_ACCESSIBILITY
# include "qaccessible.h"
#endif
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
# include "qt_mac_p.h"
# include "qt_cocoa_helpers_mac_p.h"
# include "qmainwindow.h"
@@ -85,7 +85,7 @@
#include <private/qgraphicseffect_p.h>
#include <qbackingstore.h>
#include <private/qwidgetbackingstore_p.h>
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
# include <private/qpaintengine_mac_p.h>
#endif
#include <private/qpaintengine_raster_p.h>
@@ -118,7 +118,7 @@
QT_BEGIN_NAMESPACE
static bool qt_enable_backingstore = true;
-#ifdef Q_DEAD_CODE_FROM_QT4_X11
+#if 0 // Used to be included in Qt4 for Q_WS_X11
// for compatibility with Qt 4.0
Q_WIDGETS_EXPORT void qt_x11_set_global_double_buffer(bool enable)
{
@@ -126,7 +126,7 @@ Q_WIDGETS_EXPORT void qt_x11_set_global_double_buffer(bool enable)
}
#endif
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
bool qt_mac_clearDirtyOnWidgetInsideDrawWidget = false;
#endif
@@ -141,7 +141,7 @@ static inline bool hasBackingStoreSupport()
return true;
}
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
# define QT_NO_PAINT_DEBUG
#endif
@@ -288,13 +288,13 @@ QWidgetPrivate::QWidgetPrivate(int version)
#if defined(Q_OS_WIN)
, noPaintOnScreen(0)
#endif
-#if defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if 0 // Used to be included in Qt4 for Q_WS_X11
, picture(0)
-#elif defined(Q_DEAD_CODE_FROM_QT4_WIN)
+#elif 0 // Used to be included in Qt4 for Q_WS_WIN
#ifndef QT_NO_GESTURES
, nativeGesturePanEnabled(0)
#endif
-#elif defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#elif 0 // Used to be included in Qt4 for Q_WS_MAC
, needWindowChange(0)
, window_event(0)
, qd_hd(0)
@@ -317,7 +317,7 @@ QWidgetPrivate::QWidgetPrivate(int version)
isWidget = true;
memset(high_attributes, 0, sizeof(high_attributes));
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
drawRectOriginalAdded = false;
originalDrawMethod = true;
changeMethods = false;
@@ -326,7 +326,7 @@ QWidgetPrivate::QWidgetPrivate(int version)
toolbar_ancestor = 0;
flushRequested = false;
touchEventsEnabled = false;
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
#ifdef QWIDGET_EXTRA_DEBUG
static int count = 0;
qDebug() << "widgets" << ++count;
@@ -809,6 +809,10 @@ void QWidget::setAutoFillBackground(bool enabled)
parentWidget(), window(), setParent(), winId(),
find(), metric().
+ \row \li Context menu \li
+ contextMenuPolicy, contextMenuEvent(),
+ customContextMenuRequested(), actions()
+
\row \li Interactive help \li
setToolTip(), setWhatsThis()
@@ -1087,7 +1091,7 @@ void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w)
// Only enable this on non-Mac platforms. Since the old way of doing this would
// interpret WindowSystemMenuHint as a close button and we can't change that behavior
// we can't just add this in.
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
if ((flags & (Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::WindowContextHelpButtonHint))
# ifdef Q_OS_WIN
&& type != Qt::Dialog // QTBUG-2027, allow for menu-less dialogs.
@@ -1147,7 +1151,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
}
#endif
-#if defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if 0 // Used to be included in Qt4 for Q_WS_X11
if (desktopWidget) {
// make sure the widget is created on the same screen as the
// programmer specified desktop widget
@@ -1181,7 +1185,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
mustHaveWindowHandle = 1;
q->setAttribute(Qt::WA_NativeWindow);
}
-//#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+//#if 0 // Used to be included in Qt4 for Q_WS_MAC
// q->setAttribute(Qt::WA_NativeWindow);
//#endif
@@ -1206,9 +1210,9 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
setOpaque(q->isWindow() && background.style() != Qt::NoBrush && background.isOpaque());
}
data.fnt = QFont(data.fnt, q);
-#if defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if 0 // Used to be included in Qt4 for Q_WS_X11
data.fnt.x11SetScreen(xinfo.screen());
-#endif // Q_DEAD_CODE_FROM_QT4_X11
+#endif
q->setAttribute(Qt::WA_PendingMoveEvent);
q->setAttribute(Qt::WA_PendingResizeEvent);
@@ -1225,7 +1229,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
extraPaintEngine = 0;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// If we add a child to the unified toolbar, we have to redirect the painting.
if (parentWidget && parentWidget->d_func() && parentWidget->d_func()->isInUnifiedToolbar) {
if (parentWidget->d_func()->unifiedSurface) {
@@ -1233,7 +1237,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
parentWidget->d_func()->unifiedSurface->recursiveRedirect(toolbar, toolbar, toolbar->d_func()->toolbar_offset);
}
}
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
}
@@ -1323,14 +1327,14 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
<< "Alien?" << !testAttribute(Qt::WA_NativeWindow);
#endif
-#if defined (Q_DEAD_CODE_FROM_QT4_WIN) && !defined(QT_NO_DRAGANDDROP)
+#if 0 /* Used to be included in Qt4 for Q_WS_WIN */ && !defined(QT_NO_DRAGANDDROP)
// Unregister the dropsite (if already registered) before we
// re-create the widget with a native window.
if (testAttribute(Qt::WA_WState_Created) && !internalWinId() && testAttribute(Qt::WA_NativeWindow)
&& d->extra && d->extra->dropTarget) {
d->registerDropSite(false);
}
-#endif // defined (Q_DEAD_CODE_FROM_QT4_WIN) && !defined(QT_NO_DRAGANDDROP)
+#endif
d->updateIsOpaque();
@@ -1630,7 +1634,7 @@ QWidget::~QWidget()
}
}
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN) || defined(Q_DEAD_CODE_FROM_QT4_X11)|| defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 0 /* Used to be included in Qt4 for Q_WS_WIN */ || 0 /* Used to be included in Qt4 for Q_WS_X11 */|| 0 /* Used to be included in Qt4 for Q_WS_MAC */
else if (!internalWinId() && isVisible()) {
qApp->d_func()->sendSyntheticEnterLeave(this);
}
@@ -1677,7 +1681,7 @@ QWidget::~QWidget()
d->blockSig = blocked;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// QCocoaView holds a pointer back to this widget. Clear it now
// to make sure it's not followed later on. The lifetime of the
// QCocoaView might exceed the lifetime of this widget in cases
@@ -1728,7 +1732,7 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier
const WId oldWinId = data.winid;
data.winid = id;
-#if defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if 0 // Used to be included in Qt4 for Q_WS_X11
hd = id; // X11: hd == ident
#endif
if (mapper && id && !userDesktopWidget) {
@@ -1764,9 +1768,9 @@ void QWidgetPrivate::createTLExtra()
x->window = 0;
x->shareContext = 0;
x->initialScreenIndex = -1;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
x->wasMaximized = false;
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
#ifdef QWIDGET_EXTRA_DEBUG
static int count = 0;
qDebug() << "tlextra" << ++count;
@@ -2191,10 +2195,10 @@ void QWidgetPrivate::subtractOpaqueSiblings(QRegion &sourceRegion, bool *hasDirt
if (disableSubtractOpaqueSiblings || q->isWindow())
return;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (q->d_func()->isInUnifiedToolbar)
return;
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
QRect clipBoundingRect;
bool dirtyClipBoundingRect = true;
@@ -2328,7 +2332,7 @@ void QWidgetPrivate::updateIsOpaque()
#endif //QT_NO_GRAPHICSEFFECT
Q_Q(QWidget);
-#ifdef Q_DEAD_CODE_FROM_QT4_X11
+#if 0 // Used to be included in Qt4 for Q_WS_X11
if (q->testAttribute(Qt::WA_X11OpenGLOverlay)) {
setOpaque(false);
return;
@@ -2387,7 +2391,7 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus
Q_ASSERT(painter);
if (brush.style() == Qt::TexturePattern) {
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// Optimize pattern filling on mac by using HITheme directly
// when filling with the standard widget background.
// Defined in qmacstyle_mac.cpp
@@ -2399,7 +2403,7 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus
painter->setClipRegion(rgn);
painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
}
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
} else if (brush.gradient()
&& brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode) {
@@ -2470,7 +2474,7 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int
visible widgets.
*/
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
extern QPointer<QWidget> qt_button_down;
#else
extern QWidget *qt_button_down;
@@ -2750,7 +2754,7 @@ void QWidget::setStyle(QStyle *style)
}
void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate, bool
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
metalHack
#endif
)
@@ -2761,7 +2765,7 @@ void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate, bool
QPointer<QStyle> origStyle;
#endif
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// the metalhack boolean allows Qt/Mac to do a proper re-polish depending
// on how the Qt::WA_MacBrushedMetal attribute is set. It is only ever
// set when changing that attribute and passes the widget's CURRENT style.
@@ -2781,12 +2785,12 @@ void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate, bool
if (q->windowType() != Qt::Desktop) {
if (polished) {
oldStyle->unpolish(q);
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (metalHack)
macUpdateMetalAttribute();
#endif
q->style()->polish(q);
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
} else if (metalHack) {
macUpdateMetalAttribute();
#endif
@@ -3151,7 +3155,7 @@ bool QWidget::isFullScreen() const
*/
void QWidget::showFullScreen()
{
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// If the unified toolbar is enabled, we have to disable it before going fullscreen.
QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this);
if (mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()) {
@@ -3159,7 +3163,7 @@ void QWidget::showFullScreen()
QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout());
mainLayout->activateUnifiedToolbarAfterFullScreen = true;
}
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
ensurePolished();
setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized))
@@ -3187,7 +3191,7 @@ void QWidget::showMaximized()
setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen))
| Qt::WindowMaximized);
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// If the unified toolbar was enabled before going fullscreen, we have to enable it back.
QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this);
if (mainWindow)
@@ -3198,7 +3202,7 @@ void QWidget::showMaximized()
mainLayout->activateUnifiedToolbarAfterFullScreen = false;
}
}
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
setVisible(true);
}
@@ -3216,7 +3220,7 @@ void QWidget::showNormal()
setWindowState(windowState() & ~(Qt::WindowMinimized
| Qt::WindowMaximized
| Qt::WindowFullScreen));
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// If the unified toolbar was enabled before going fullscreen, we have to enable it back.
QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this);
if (mainWindow)
@@ -3227,7 +3231,7 @@ void QWidget::showNormal()
mainLayout->activateUnifiedToolbarAfterFullScreen = false;
}
}
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
setVisible(true);
}
@@ -3443,7 +3447,7 @@ void QWidgetPrivate::setEnabled_helper(bool enable)
if (w && !w->testAttribute(attribute))
w->d_func()->setEnabled_helper(enable);
}
-#if defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if 0 // Used to be included in Qt4 for Q_WS_X11
if (q->testAttribute(Qt::WA_SetCursor) || q->isWindow()) {
// enforce the windows behavior of clearing the cursor on
// disabled widgets
@@ -3457,7 +3461,7 @@ void QWidgetPrivate::setEnabled_helper(bool enable)
qt_qpa_set_cursor(q, false);
}
#endif
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
setEnabled_helper_sys(enable);
#endif
#ifndef QT_NO_IM
@@ -4561,7 +4565,7 @@ const QPalette &QWidget::palette() const
) {
data->pal.setCurrentColorGroup(QPalette::Active);
} else {
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
extern bool qt_mac_can_clickThrough(const QWidget *); //qwidget_mac.cpp
if (qt_mac_can_clickThrough(this))
data->pal.setCurrentColorGroup(QPalette::Active);
@@ -4819,7 +4823,7 @@ void QWidgetPrivate::updateFont(const QFont &font)
#endif
data.fnt = QFont(font, q);
-#if defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if 0 // Used to be included in Qt4 for Q_WS_X11
// make sure the font set on this widget is associated with the correct screen
data.fnt.x11SetScreen(xinfo.screen());
#endif
@@ -4992,7 +4996,7 @@ void QWidget::setCursor(const QCursor &cursor)
{
Q_D(QWidget);
// On Mac we must set the cursor even if it is the ArrowCursor.
-#if !defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
if (cursor.shape() != Qt::ArrowCursor
|| (d->extra && d->extra->curs))
#endif
@@ -5424,7 +5428,7 @@ void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset
Q_ASSERT(!toBePainted.isEmpty());
Q_Q(QWidget);
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
const QTransform originalTransform = painter->worldTransform();
const bool useDeviceCoordinates = originalTransform.isScaling();
if (!useDeviceCoordinates) {
@@ -5451,7 +5455,7 @@ void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset
if (restore)
painter->setRenderHints(QPainter::SmoothPixmapTransform, false);
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
} else {
// Render via a pixmap in device coordinates (to avoid pixmap scaling).
QTransform transform = originalTransform;
@@ -5560,7 +5564,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
if (paintEngine) {
setRedirected(pdev, -offset);
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// (Alien support) Special case for Mac when redirecting: If the paint device
// is of the Widget type we need to set WA_WState_InPaintEvent since painting
// outside the paint event is not supported on QWidgets. The attributeis
@@ -5646,7 +5650,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
//restore
if (paintEngine) {
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (pdev->devType() == QInternal::Widget)
static_cast<QWidget *>(pdev)->setAttribute(Qt::WA_WState_InPaintEvent, false);
#endif
@@ -5720,7 +5724,7 @@ void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset,
if (paintRegion.isEmpty())
return;
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
QPainter *oldSharedPainter = inRenderWithPainter ? sharedPainter() : 0;
// Use the target's shared painter if set (typically set when doing
@@ -6501,7 +6505,7 @@ void QWidget::setFocus(Qt::FocusReason reason)
f = f->d_func()->extra->focus_proxy;
if (QApplication::focusWidget() == f
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN)
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
&& GetFocus() == f->internalWinId()
#endif
)
@@ -6686,7 +6690,7 @@ void QWidget::clearFocus()
if (hasFocus()) {
// Update proxy state
QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason);
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN)
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
if (!(windowType() == Qt::Popup) && GetFocus() == internalWinId())
SetFocus(0);
else
@@ -7318,7 +7322,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
*/
QByteArray QWidget::saveGeometry() const
{
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// We check if the window was maximized during this invocation. If so, we need to record the
// starting position as 0,0.
Q_D(const QWidget);
@@ -7329,7 +7333,7 @@ QByteArray QWidget::saveGeometry() const
newFramePosition.moveTo(0, 0);
newNormalPosition.moveTo(0, 0);
}
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
QByteArray array;
QDataStream stream(&array, QIODevice::WriteOnly);
stream.setVersion(QDataStream::Qt_4_0);
@@ -7343,13 +7347,13 @@ QByteArray QWidget::saveGeometry() const
stream << magicNumber
<< majorVersion
<< minorVersion
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
<< newFramePosition
<< newNormalPosition
#else
<< frameGeometry()
<< normalGeometry()
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
<< qint32(screenNumber)
<< quint8(windowState() & Qt::WindowMaximized)
<< quint8(windowState() & Qt::WindowFullScreen)
@@ -7457,7 +7461,7 @@ bool QWidget::restoreGeometry(const QByteArray &geometry)
// - The title bar is outside the available geometry.
// - (Mac only) The window is higher than the available geometry. It must
// be possible to bring the size grip on screen by moving the window.
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
restoredFrameGeometry.setHeight(qMin(restoredFrameGeometry.height(), availableGeometry.height()));
restoredNormalGeometry.setHeight(qMin(restoredNormalGeometry.height(), availableGeometry.height() - frameHeight));
#endif
@@ -7506,7 +7510,7 @@ bool QWidget::restoreGeometry(const QByteArray &geometry)
d_func()->topData()->normalGeometry = restoredNormalGeometry;
} else {
QPoint offset;
-#ifdef Q_DEAD_CODE_FROM_QT4_X11
+#if 0 // Used to be included in Qt4 for Q_WS_X11
if (isFullScreen())
offset = d_func()->topData()->fullScreenOffset;
#endif
@@ -7904,7 +7908,7 @@ void QWidgetPrivate::show_helper()
// On Windows, show the popup now so that our own focus handling
// stores the correct old focus widget even if it's stolen in the
// showevent
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN) || defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 0 /* Used to be included in Qt4 for Q_WS_WIN */ || 0 /* Used to be included in Qt4 for Q_WS_MAC */
if (!isEmbedded && q->windowType() == Qt::Popup)
qApp->d_func()->openPopup(q);
#endif
@@ -8033,7 +8037,7 @@ void QWidgetPrivate::hide_helper()
if (!isEmbedded && (q->windowType() == Qt::Popup))
qApp->d_func()->closePopup(q);
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN)
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
if (q->isWindow() && !(q->windowType() == Qt::Popup) && q->parentWidget()
&& !q->parentWidget()->isHidden() && q->isActiveWindow())
q->parentWidget()->activateWindow(); // Activate parent
@@ -8217,7 +8221,7 @@ void QWidget::setVisible(bool visible)
} else { // hide
if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden))
return;
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN)
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
// reset WS_DISABLED style in a Blocked window
if(isWindow() && testAttribute(Qt::WA_WState_Created)
&& QApplicationPrivate::isBlockedByModal(this))
@@ -8302,7 +8306,7 @@ void QWidgetPrivate::hideChildren(bool spontaneous)
QWidget *widget = qobject_cast<QWidget*>(childList.at(i));
if (!widget || widget->isWindow() || widget->testAttribute(Qt::WA_WState_Hidden))
continue;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// Before doing anything we need to make sure that we don't leave anything in a non-consistent state.
// When hiding a widget we need to make sure that no mouse_down events are active, because
// the mouse_up event will never be received by a hidden widget or one of its descendants.
@@ -8318,7 +8322,7 @@ void QWidgetPrivate::hideChildren(bool spontaneous)
// supposed to trigger because it is not visible.
if(widget == qt_button_down)
qt_button_down = 0;
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
if (spontaneous)
widget->setAttribute(Qt::WA_Mapped, false);
else
@@ -8553,7 +8557,7 @@ QSize QWidgetPrivate::adjustedSize() const
s.setWidth(qMax(s.width(), 200));
if (exp & Qt::Vertical)
s.setHeight(qMax(s.height(), 100));
-#if defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if 0 // Used to be included in Qt4 for Q_WS_X11
QRect screen = QApplication::desktop()->screenGeometry(q->x11Info().screen());
#else // all others
QRect screen = QApplication::desktop()->screenGeometry(q->pos());
@@ -8682,7 +8686,7 @@ bool QWidget::isAncestorOf(const QWidget *child) const
return false;
}
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN)
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
inline void setDisabledStyle(QWidget *w, bool setStyle)
{
// set/reset WS_DISABLED style.
@@ -9114,7 +9118,7 @@ bool QWidget::event(QEvent *event)
}
}
}
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN)
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
setDisabledStyle(this, (event->type() == QEvent::WindowBlocked));
#endif
break;
@@ -9141,7 +9145,7 @@ bool QWidget::event(QEvent *event)
case QEvent::EmbeddingControl:
d->topData()->frameStrut.setCoords(0 ,0, 0, 0);
data->fstrut_dirty = false;
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN) || defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if 0 /* Used to be included in Qt4 for Q_WS_WIN */ || 0 /* Used to be included in Qt4 for Q_WS_X11 */
d->topData()->embedded = 1;
#endif
break;
@@ -9166,7 +9170,7 @@ bool QWidget::event(QEvent *event)
}
break;
}
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
case QEvent::MacGLWindowChange:
d->needWindowChange = false;
break;
@@ -9280,7 +9284,7 @@ void QWidget::changeEvent(QEvent * event)
case QEvent::MacSizeChange:
updateGeometry();
break;
-#elif defined Q_DEAD_CODE_FROM_QT4_MAC
+#elif 0 // Used to be included in Qt4 for Q_WS_MAC
case QEvent::ToolTipChange:
case QEvent::MouseTrackingChange:
qt_mac_update_mouseTracking(this);
@@ -10561,7 +10565,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
// (f & Qt::MSWindowsOwnDC) clause (which is set on QGLWidgets on all
// platforms).
if (newParent
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN) || defined(QT_OPENGL_ES)
+#if 0 /* Used to be included in Qt4 for Q_WS_WIN */ || defined(QT_OPENGL_ES)
|| (f & Qt::MSWindowsOwnDC)
#endif
) {
@@ -10581,7 +10585,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
}
//### already hidden above ---> must probably do something smart on the mac
-// #ifdef Q_DEAD_CODE_FROM_QT4_MAC
+// #if 0 // Used to be included in Qt4 for Q_WS_MAC
// extern bool qt_mac_is_macdrawer(const QWidget *); //qwidget_mac.cpp
// if(!qt_mac_is_macdrawer(q)) //special case
// q->setAttribute(Qt::WA_WState_Hidden);
@@ -11109,7 +11113,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
d->receiveChildEvents = !on;
break;
case Qt::WA_MacBrushedMetal:
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
d->setStyle_helper(style(), false, true); // Make sure things get unpolished/polished correctly.
// fall through since changing the metal attribute affects the opaque size grip.
case Qt::WA_MacOpaqueSizeGrip:
@@ -11126,7 +11130,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
break;
#endif
case Qt::WA_MacAlwaysShowToolWindow:
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
d->macUpdateHideOnSuspend();
#endif
break;
@@ -11203,7 +11207,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
}
case Qt::WA_PaintOnScreen:
d->updateIsOpaque();
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN) || defined(Q_DEAD_CODE_FROM_QT4_X11) || defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 0 /* Used to be included in Qt4 for Q_WS_WIN */ || 0 /* Used to be included in Qt4 for Q_WS_X11 */ || 0 /* Used to be included in Qt4 for Q_WS_MAC */
// Recreate the widget if it's already created as an alien widget and
// WA_PaintOnScreen is enabled. Paint on screen widgets must have win id.
// So must their children.
@@ -11223,7 +11227,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
d->updateSystemBackground();
break;
case Qt::WA_TransparentForMouseEvents:
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
d->macUpdateIgnoreMouseEvents();
#endif
break;
@@ -11242,7 +11246,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
d->resolveFont();
d->resolveLocale();
break;
-#ifdef Q_DEAD_CODE_FROM_QT4_X11
+#if 0 // Used to be included in Qt4 for Q_WS_X11
case Qt::WA_NoX11EventCompression:
if (!d->extra)
d->createExtra();
@@ -11299,7 +11303,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
break;
case Qt::WA_AcceptTouchEvents:
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN) || defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 0 /* Used to be included in Qt4 for Q_WS_WIN */ || 0 /* Used to be included in Qt4 for Q_WS_MAC */
if (on)
d->registerTouchWindow();
#endif
@@ -11918,7 +11922,7 @@ QRect QWidgetPrivate::frameStrut() const
}
if (data.fstrut_dirty
-#ifndef Q_DEAD_CODE_FROM_QT4_WIN
+#if 1 // Used to be excluded in Qt4 for Q_WS_WIN
// ### Fix properly for 4.3
&& q->isVisible()
#endif
@@ -12854,7 +12858,7 @@ void QWidget::setMask(const QRegion &newMask)
d->extra->mask = newMask;
d->extra->hasMask = !newMask.isEmpty();
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
if (!testAttribute(Qt::WA_WState_Created))
return;
#endif
@@ -13050,45 +13054,6 @@ QDebug operator<<(QDebug debug, const QWidget *widget)
}
#endif // !QT_NO_DEBUG_STREAM
-/*! \fn Qt::HANDLE QWidget::macCGHandle() const
- \internal
-
- Returns the CoreGraphics handle of the widget. Use of this function is not portable.
- This function will return 0 if no painter context can be established, or if the handle
- could not be created.
-
- \warning This function is only available on \macos.
-*/
-/*! \fn Qt::HANDLE QWidget::macQDHandle() const
- \internal
-
- Returns the QuickDraw handle of the widget. Use of this function is not portable.
- This function will return 0 if QuickDraw is not supported, or if the handle could
- not be created.
-
- \warning This function is only available on \macos.
-*/
-/*! \fn const QX11Info &QWidget::x11Info() const
- \internal
-
- Returns information about the configuration of the X display used to display
- the widget.
-
- \warning This function is only available on X11.
-*/
-
-/*! \fn Qt::HANDLE QWidget::x11PictureHandle() const
- \internal
-
- Returns the X11 picture handle of the widget for XRender
- support. Use of this function is not portable. This function will
- return 0 if XRender support is not compiled into Qt, if the
- XRender extension is not supported on the X11 display, or if the
- handle could not be created.
-
- \warning This function is only available on X11.
-
-*/
QT_END_NAMESPACE
#include "moc_qwidget.cpp"
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index bca89fe2c5..5edf2c62da 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -570,12 +570,12 @@ public:
inline QWidget *childAt(int x, int y) const;
QWidget *childAt(const QPoint &p) const;
-#if defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if 0 // Used to be included in Qt4 for Q_WS_X11
const QX11Info &x11Info() const;
Qt::HANDLE x11PictureHandle() const;
#endif
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
Qt::HANDLE macQDHandle() const;
Qt::HANDLE macCGHandle() const;
#endif
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 3e57f9de41..68e063c25a 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -189,7 +189,7 @@ struct QTLWExtra {
uint embedded : 1;
// *************************** Platform specific values (bit fields first) **********
-#if defined(Q_DEAD_CODE_FROM_QT4_X11) // <----------------------------------------------------------- X11
+#if 0 /* Used to be included in Qt4 for Q_WS_X11 */ // <----------------------------------------------------------- X11
uint spont_unmapped: 1; // window was spontaneously unmapped
uint dnd : 1; // DND properties installed
uint validWMState : 1; // is WM_STATE valid?
@@ -203,11 +203,11 @@ struct QTLWExtra {
qint32 newCounterValueHi;
quint32 newCounterValueLo;
#endif
-#elif defined(Q_DEAD_CODE_FROM_QT4_WIN) // <--------------------------------------------------------- WIN
+#elif 0 /* Used to be included in Qt4 for Q_WS_WIN */ // <--------------------------------------------------------- WIN
uint hotkeyRegistered: 1; // Hot key from the STARTUPINFO has been registered.
HICON winIconBig; // internal big Windows icon
HICON winIconSmall; // internal small Windows icon
-#elif defined(Q_DEAD_CODE_FROM_QT4_MAC) // <--------------------------------------------------------- MAC
+#elif 0 /* Used to be included in Qt4 for Q_WS_MAC */ // <--------------------------------------------------------- MAC
uint resizer : 4;
uint isSetGeometry : 1;
uint isMove : 1;
@@ -262,15 +262,15 @@ struct QWExtra {
uint hasWindowContainer : 1;
// *************************** Platform specific values (bit fields first) **********
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN) // <----------------------------------------------------------- WIN
+#if 0 /* Used to be included in Qt4 for Q_WS_WIN */ // <----------------------------------------------------------- WIN
#ifndef QT_NO_DRAGANDDROP
QOleDropTarget *dropTarget; // drop target
QList<QPointer<QWidget> > oleDropWidgets;
#endif
-#elif defined(Q_DEAD_CODE_FROM_QT4_X11) // <--------------------------------------------------------- X11
+#elif 0 /* Used to be included in Qt4 for Q_WS_X11 */ // <--------------------------------------------------------- X11
uint compress_events : 1;
WId xDndProxy; // XDND forwarding to embedded windows
-#elif defined(Q_DEAD_CODE_FROM_QT4_MAC) // <------------------------------------------------------ MAC
+#elif 0 /* Used to be included in Qt4 for Q_WS_MAC */ // <------------------------------------------------------ MAC
// Cocoa Mask stuff
QImage maskBits;
CGImageRef imageMask;
@@ -402,9 +402,6 @@ public:
const QRegion &rgn, const QPoint &offset, int flags,
QPainter *sharedPainter, QWidgetBackingStore *backingStore);
-
- QPainter *beginSharedPainter();
- bool endSharedPainter();
#ifndef QT_NO_GRAPHICSVIEW
static QGraphicsProxyWidget * nearestGraphicsProxyWidget(const QWidget *origin);
#endif
@@ -761,7 +758,7 @@ public:
#if defined(Q_OS_WIN)
uint noPaintOnScreen : 1; // see qwidget.cpp ::paintEngine()
#endif
-#if defined(Q_DEAD_CODE_FROM_QT4_X11) // <----------------------------------------------------------- X11
+#if 0 /* Used to be included in Qt4 for Q_WS_X11 */ // <----------------------------------------------------------- X11
Qt::HANDLE picture;
static QWidget *mouseGrabber;
static QWidget *keyboardGrabber;
@@ -773,7 +770,7 @@ public:
void updateX11AcceptFocus();
QPoint mapToGlobal(const QPoint &pos) const;
QPoint mapFromGlobal(const QPoint &pos) const;
-#elif defined(Q_DEAD_CODE_FROM_QT4_WIN) // <--------------------------------------------------------- WIN
+#elif 0 /* Used to be included in Qt4 for Q_WS_WIN */ // <--------------------------------------------------------- WIN
#ifndef QT_NO_GESTURES
uint nativeGesturePanEnabled : 1;
#endif
@@ -789,7 +786,7 @@ public:
void winSetupGestures();
#elif defined(Q_OS_MAC) // <--------------------------------------------------------- MAC
void macUpdateSizeAttribute();
-#elif defined(Q_DEAD_CODE_FROM_QT4_MAC) // <--------------------------------------------------------- MAC (old stuff)
+#elif 0 /* Used to be included in Qt4 for Q_WS_MAC */ // <--------------------------------------------------------- MAC (old stuff)
// This is new stuff
uint needWindowChange : 1;
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 81fbe49a43..910704498c 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -112,6 +112,7 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion &region, QBack
if (widget != tlw)
offset += widget->mapTo(tlw, QPoint());
+ QRegion effectiveRegion = region;
#ifndef QT_NO_OPENGL
const bool compositionWasActive = widget->d_func()->renderToTextureComposeActive;
if (!widgetTextures) {
@@ -125,6 +126,11 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion &region, QBack
} else {
widget->d_func()->renderToTextureComposeActive = true;
}
+ // When changing the composition status, make sure the dirty region covers
+ // the entire widget. Just having e.g. the shown/hidden render-to-texture
+ // widget's area marked as dirty is incorrect when changing flush paths.
+ if (compositionWasActive != widget->d_func()->renderToTextureComposeActive)
+ effectiveRegion = widget->rect();
// re-test since we may have been forced to this path via the dummy texture list above
if (widgetTextures) {
@@ -136,12 +142,12 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion &region, QBack
const bool translucentBackground = widget->testAttribute(Qt::WA_TranslucentBackground);
// Use the tlw's context, not widget's. The difference is important with native child
// widgets where tlw != widget.
- backingStore->handle()->composeAndFlush(widget->windowHandle(), region, offset, widgetTextures,
+ backingStore->handle()->composeAndFlush(widget->windowHandle(), effectiveRegion, offset, widgetTextures,
tlw->d_func()->shareContext(), translucentBackground);
widget->window()->d_func()->sendComposeStatus(widget->window(), true);
} else
#endif
- backingStore->flush(region, widget->windowHandle(), offset);
+ backingStore->flush(effectiveRegion, widget->windowHandle(), offset);
}
#ifndef QT_NO_PAINT_DEBUG
@@ -699,7 +705,7 @@ void QWidgetBackingStore::markDirtyOnScreen(const QRegion &region, QWidget *widg
if (!widget || widget->d_func()->paintOnScreen() || region.isEmpty())
return;
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (!widget->testAttribute(Qt::WA_WState_InPaintEvent))
dirtyOnScreen += region.translated(topLevelOffset);
return;
@@ -1624,7 +1630,7 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn)
&& (usesDoubleBufferedGLContext || q->autoFillBackground());
QRegion toBePainted(noPartialUpdateSupport ? q->rect() : rgn);
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// No difference between update() and repaint() on the Mac.
update_sys(toBePainted);
return;
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index f3fbe13763..3e15b6977a 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -535,7 +535,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
// activate window of the widget under mouse pointer
if (!w->isActiveWindow()) {
w->activateWindow();
- w->raise();
+ w->window()->raise();
}
QWindow *win = w->windowHandle();
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 140f0ad2f3..690c811140 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -5246,6 +5246,8 @@ static QPixmap cachedPixmapFromXPM(const char * const *xpm)
return result;
}
+static inline QPixmap titleBarMenuCachedPixmapFromXPM() { return cachedPixmapFromXPM(qt_menu_xpm); }
+
#ifndef QT_NO_IMAGEFORMAT_PNG
static inline QString clearText16IconPath()
{
@@ -5590,7 +5592,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
#ifndef QT_NO_IMAGEFORMAT_XPM
switch (sp) {
case SP_TitleBarMenuButton:
- return cachedPixmapFromXPM(qt_menu_xpm);
+ return titleBarMenuCachedPixmapFromXPM();
case SP_TitleBarShadeButton:
return cachedPixmapFromXPM(qt_shade_xpm);
case SP_TitleBarUnshadeButton:
@@ -6130,6 +6132,12 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
case SP_MediaVolumeMuted:
icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png"), QSize(16, 16));
break;
+ case SP_TitleBarMenuButton:
+# ifndef QT_NO_IMAGEFORMAT_XPM
+ icon.addPixmap(titleBarMenuCachedPixmapFromXPM());
+# endif
+ icon.addFile(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png"));
+ break;
#endif // QT_NO_IMAGEFORMAT_PNG
default:
icon.addPixmap(proxy()->standardPixmap(standardIcon, option, widget));
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 06c3101643..3473ec7fb0 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -1080,8 +1080,8 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
painter->setPen(innerLine);
painter->drawRoundedRect(option->rect.adjusted(1, 1, -2, -2), 1, 1);
painter->restore();
- return;
}
+ break;
case CE_SizeGrip:
painter->save();
{
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 6fbc7c9eea..2d1de790c4 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -950,6 +950,8 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
#if defined(QMAC_QAQUASTYLE_SIZE_CONSTRAIN) || defined(DEBUG_SIZE_CONSTRAINT)
static QAquaWidgetSize qt_aqua_guess_size(const QWidget *widg, QSize large, QSize small, QSize mini)
{
+ Q_UNUSED(widg);
+
if (large == QSize(-1, -1)) {
if (small != QSize(-1, -1))
return QAquaSizeSmall;
@@ -965,7 +967,7 @@ static QAquaWidgetSize qt_aqua_guess_size(const QWidget *widg, QSize large, QSiz
}
#ifndef QT_NO_MAINWINDOW
- if (qobject_cast<QDockWidget *>(widg->window()) || qEnvironmentVariableIsSet("QWIDGET_ALL_SMALL")) {
+ if (qEnvironmentVariableIsSet("QWIDGET_ALL_SMALL")) {
//if (small.width() != -1 || small.height() != -1)
return QAquaSizeSmall;
} else if (qEnvironmentVariableIsSet("QWIDGET_ALL_MINI")) {
@@ -4214,10 +4216,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
bool verticalTabs = ttd == kThemeTabWest || ttd == kThemeTabEast;
bool selected = (myTab.state & QStyle::State_Selected);
- if (selected && !myTab.documentMode
- && (!usingYosemiteOrLater || myTab.state & State_Active))
- myTab.palette.setColor(QPalette::WindowText, Qt::white);
-
// Check to see if we use have the same as the system font
// (QComboMenuItem is internal and should never be seen by the
// outside world, unless they read the source, in which case, it's
diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h
index fdc22794b4..459784c538 100644
--- a/src/widgets/styles/qmacstyle_mac_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p.h
@@ -134,7 +134,7 @@ private:
friend bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option);
};
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp
index ee5fd704dc..b51860045d 100644
--- a/src/widgets/styles/qpixmapstyle.cpp
+++ b/src/widgets/styles/qpixmapstyle.cpp
@@ -108,7 +108,7 @@ QPixmapStyle::~QPixmapStyle()
void QPixmapStyle::polish(QApplication *application)
{
QCommonStyle::polish(application);
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN)
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
QApplication::setEffectEnabled(Qt::UI_AnimateCombo, false);
#endif
}
@@ -170,7 +170,7 @@ void QPixmapStyle::polish(QWidget *widget)
frame->setContentsMargins(pix.margins.left(), desc.margins.top(),
pix.margins.right(), desc.margins.bottom());
frame->setAttribute(Qt::WA_TranslucentBackground);
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
// FramelessWindowHint is needed on windows to make
// WA_TranslucentBackground work properly
frame->setWindowFlags(widget->windowFlags() | Qt::FramelessWindowHint);
diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp
index bb849c148f..09cccff4e8 100644
--- a/src/widgets/styles/qstylefactory.cpp
+++ b/src/widgets/styles/qstylefactory.cpp
@@ -131,7 +131,7 @@ QStyle *QStyleFactory::create(const QString& key)
#ifndef QT_NO_STYLE_MAC
if (style.startsWith(QLatin1String("macintosh"))) {
ret = new QMacStyle;
-# ifdef Q_DEAD_CODE_FROM_QT4_MAC
+# if 0 // Used to be included in Qt4 for Q_WS_MAC
if (style == QLatin1String("macintosh"))
style += QLatin1String(" (aqua)");
# endif
@@ -184,7 +184,7 @@ QStringList QStyleFactory::keys()
#endif
#ifndef QT_NO_STYLE_MAC
QString mstyle = QLatin1String("Macintosh");
-# ifdef Q_DEAD_CODE_FROM_QT4_MAC
+# if 0 // Used to be included in Qt4 for Q_WS_MAC
mstyle += QLatin1String(" (aqua)");
# endif
if (!list.contains(mstyle))
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index 71cf2fb267..83739655af 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -199,7 +199,7 @@ void QStyleOption::init(const QWidget *widget)
state |= QStyle::State_Active;
if (widget->isWindow())
state |= QStyle::State_Window;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
extern bool qt_mac_can_clickThrough(const QWidget *w); //qwidget_mac.cpp
if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget))
state &= ~QStyle::State_Enabled;
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index b214dae154..8e77ae0e44 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -5045,7 +5045,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
sz = csz + QSize(vertical ? 0 : spaceForIcon, vertical ? spaceForIcon : 0);
return subRule.boxSize(subRule.adjustSize(sz));
}
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (baseStyle()->inherits("QMacStyle")) {
//adjust the size after the call to the style because the mac style ignore the size arguments anyway.
//this might cause the (max-){width,height} property to include the native style border while they should not.
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index 9d764d2a41..4ce359a7c4 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -699,7 +699,7 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
bool translucentToplevel = false;
const QPaintDevice *paintDevice = painter->device();
- const qreal aditionalDevicePixelRatio = themeData.widget ? themeData.widget->devicePixelRatio() : 1;
+ const qreal aditionalDevicePixelRatio = themeData.widget ? themeData.widget->devicePixelRatioF() : qreal(1);
if (paintDevice->devType() == QInternal::Widget) {
const QWidget *window = static_cast<const QWidget *>(paintDevice)->window();
translucentToplevel = window->testAttribute(Qt::WA_TranslucentBackground);
@@ -727,28 +727,28 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
const HDC dc = canDrawDirectly ? hdcForWidgetBackingStore(themeData.widget) : HDC(0);
const bool result = dc
- ? drawBackgroundDirectly(dc, themeData, qRound(aditionalDevicePixelRatio))
- : drawBackgroundThruNativeBuffer(themeData, qRound(aditionalDevicePixelRatio));
+ ? drawBackgroundDirectly(dc, themeData, aditionalDevicePixelRatio)
+ : drawBackgroundThruNativeBuffer(themeData, aditionalDevicePixelRatio);
painter->restore();
return result;
}
-static inline QRect scaleRect(const QRect &r, int factor)
+static inline QRectF scaleRect(const QRectF &r, qreal factor)
{
return r.isValid() && factor > 1
- ? QRect(r.topLeft() * factor, r.size() * factor)
+ ? QRectF(r.topLeft() * factor, r.size() * factor)
: r;
}
-static QRegion scaleRegion(const QRegion &region, int factor)
+static QRegion scaleRegion(const QRegion &region, qreal factor)
{
- if (region.isEmpty() || factor == 1)
+ if (region.isEmpty() || qFuzzyCompare(factor, qreal(1)))
return region;
if (region.rectCount() == 1)
- return QRegion(scaleRect(region.boundingRect(), factor));
+ return QRegion(scaleRect(QRectF(region.boundingRect()), factor).toRect());
QRegion result;
foreach (const QRect &rect, region.rects())
- result += QRect(rect.topLeft() * factor, rect.size() * factor);
+ result += QRectF(QPointF(rect.topLeft()) * factor, QSizeF(rect.size() * factor)).toRect();
return result;
}
@@ -757,13 +757,12 @@ static QRegion scaleRegion(const QRegion &region, int factor)
Do not use this if you need to perform other transformations on the
resulting data.
*/
-bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeData, int additionalDevicePixelRatio)
+bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeData, qreal additionalDevicePixelRatio)
{
QPainter *painter = themeData.painter;
- QPoint redirectionDelta(int(painter->deviceMatrix().dx()),
- int(painter->deviceMatrix().dy()));
- QRect area = scaleRect(themeData.rect, additionalDevicePixelRatio).translated(redirectionDelta);
+ const QPointF redirectionDelta(painter->deviceMatrix().dx(), painter->deviceMatrix().dy());
+ const QRect area = scaleRect(QRectF(themeData.rect), additionalDevicePixelRatio).translated(redirectionDelta).toRect();
QRegion sysRgn = painter->paintEngine()->systemClip();
if (sysRgn.isEmpty())
@@ -771,7 +770,7 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeDa
else
sysRgn &= area;
if (painter->hasClipping())
- sysRgn &= scaleRegion(painter->clipRegion(), additionalDevicePixelRatio).translated(redirectionDelta);
+ sysRgn &= scaleRegion(painter->clipRegion(), additionalDevicePixelRatio).translated(redirectionDelta.toPoint());
HRGN hrgn = qt_hrgn_from_qregion(sysRgn);
SelectClipRgn(dc, hrgn);
@@ -806,15 +805,16 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeDa
engine).
*/
bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeData,
- int additionalDevicePixelRatio)
+ qreal additionalDevicePixelRatio)
{
QPainter *painter = themeData.painter;
- QRect rect = scaleRect(themeData.rect, additionalDevicePixelRatio);
+ QRectF rectF = scaleRect(QRectF(themeData.rect), additionalDevicePixelRatio);
if ((themeData.rotate + 90) % 180 == 0) { // Catch 90,270,etc.. degree flips.
- rect = QRect(0, 0, rect.height(), rect.width());
+ rectF = QRectF(0, 0, rectF.height(), rectF.width());
}
- rect.moveTo(0,0);
+ rectF.moveTo(0, 0);
+ QRect rect = rectF.toRect();
int partId = themeData.partId;
int stateId = themeData.stateId;
int w = rect.width();
diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h
index 7cbccdaf67..d6702c8803 100644
--- a/src/widgets/styles/qwindowsxpstyle_p_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p_p.h
@@ -240,8 +240,8 @@ public:
void setTransparency(QWidget *widget, XPThemeData &themeData);
bool drawBackground(XPThemeData &themeData);
- bool drawBackgroundThruNativeBuffer(XPThemeData &themeData, int aditionalDevicePixelRatio);
- bool drawBackgroundDirectly(HDC dc, XPThemeData &themeData, int aditionalDevicePixelRatio);
+ bool drawBackgroundThruNativeBuffer(XPThemeData &themeData, qreal aditionalDevicePixelRatio);
+ bool drawBackgroundDirectly(HDC dc, XPThemeData &themeData, qreal aditionalDevicePixelRatio);
bool hasAlphaChannel(const QRect &rect);
bool fixAlphaChannel(const QRect &rect);
diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp
index 57db9ff7fc..10e92e04e1 100644
--- a/src/widgets/util/qflickgesture.cpp
+++ b/src/widgets/util/qflickgesture.cpp
@@ -460,7 +460,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
}
break;
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// the only way to distinguish between real mouse wheels and wheel
// events generated by the native 2 finger swipe gesture is to listen
// for these events (according to Apple's Cocoa Event-Handling Guide)
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index 9973940c16..a348327c92 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -1011,12 +1011,12 @@ bool QScroller::handleInput(Input input, const QPointF &position, qint64 timesta
return false;
}
-#if !defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
// the Mac version is implemented in qscroller_mac.mm
QPointF QScrollerPrivate::realDpi(int screen) const
{
-# if defined(Q_DEAD_CODE_FROM_QT4_X11) && !defined(QT_NO_XRANDR)
+# if 0 /* Used to be included in Qt4 for Q_WS_X11 */ && !defined(QT_NO_XRANDR)
if (X11 && X11->use_xrandr && X11->ptrXRRSizes && X11->ptrXRRRootToScreen) {
int nsizes = 0;
// QDesktopWidget is based on Xinerama screens, which do not always
@@ -1042,7 +1042,7 @@ QPointF QScrollerPrivate::realDpi(int screen) const
return QPointF(w->physicalDpiX(), w->physicalDpiY());
}
-#endif // !Q_DEAD_CODE_FROM_QT4_MAC
+#endif
/*! \internal
diff --git a/src/widgets/util/qscroller_mac.mm b/src/widgets/util/qscroller_mac.mm
index 31316f5518..6dbb483089 100644
--- a/src/widgets/util/qscroller_mac.mm
+++ b/src/widgets/util/qscroller_mac.mm
@@ -39,7 +39,7 @@
#include <QtCore/qglobal.h>
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
#import <AppKit/AppKit.h>
diff --git a/src/widgets/util/qscrollerproperties.cpp b/src/widgets/util/qscrollerproperties.cpp
index 35e1be15db..c26fba2cd3 100644
--- a/src/widgets/util/qscrollerproperties.cpp
+++ b/src/widgets/util/qscrollerproperties.cpp
@@ -40,7 +40,7 @@
#include <QPointer>
#include <QObject>
#include <QtCore/qmath.h>
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
# include <QLibrary>
#endif
@@ -73,7 +73,7 @@ QScrollerPropertiesPrivate *QScrollerPropertiesPrivate::defaults()
spp.overshootDragDistanceFactor = qreal(1);
spp.overshootScrollDistanceFactor = qreal(0.5);
spp.overshootScrollTime = qreal(0.7);
-# ifdef Q_DEAD_CODE_FROM_QT4_WIN
+# if 0 // Used to be included in Qt4 for Q_WS_WIN
if (QLibrary::resolve(QLatin1String("UxTheme"), "BeginPanningFeedback"))
spp.overshootScrollTime = qreal(0.35);
# endif
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index e44207301b..64daad87ae 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -586,7 +586,7 @@ void QBalloonTip::balloon(const QPoint& pos, int msecs, bool showArrow)
}
QPainterPath path;
-#if defined(QT_NO_XSHAPE) && defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if defined(QT_NO_XSHAPE) && 0 /* Used to be included in Qt4 for Q_WS_X11 */
// XShape is required for setting the mask, so we just
// draw an ugly square when its not available
path.moveTo(0, 0);
diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp
index 18f85ca505..59d517e77b 100644
--- a/src/widgets/util/qundostack.cpp
+++ b/src/widgets/util/qundostack.cpp
@@ -633,7 +633,7 @@ void QUndoStack::push(QUndoCommand *cmd)
commands, it emits the signal cleanChanged(). This signal is also
emitted when the stack leaves the clean state.
- \sa isClean(), cleanIndex()
+ \sa isClean(), resetClean(), cleanIndex()
*/
void QUndoStack::setClean()
@@ -648,6 +648,30 @@ void QUndoStack::setClean()
}
/*!
+ \since 5.8
+
+ Leaves the clean state and emits cleanChanged() if the stack was clean.
+ This method resets the clean index to -1.
+
+ This is typically called in the following cases, when a document has been:
+ \li created basing on some template and has not been saved,
+ so no filename has been associated with the document yet.
+ \li restored from a backup file.
+ \li changed outside of the editor and the user did not reload it.
+
+ \sa isClean(), setClean(), cleanIndex()
+*/
+
+void QUndoStack::resetClean()
+{
+ Q_D(QUndoStack);
+ const bool was_clean = isClean();
+ d->clean_index = -1;
+ if (was_clean)
+ emit cleanChanged(false);
+}
+
+/*!
If the stack is in the clean state, returns \c true; otherwise returns \c false.
\sa setClean(), cleanIndex()
@@ -668,6 +692,7 @@ bool QUndoStack::isClean() const
some commands are undone, then a new command is pushed. Since
push() deletes all the undone commands before pushing the new command, the stack
can't return to the clean state again. In this case, this function returns -1.
+ The -1 may also be returned after an explicit call to resetClean().
\sa isClean(), setClean()
*/
diff --git a/src/widgets/util/qundostack.h b/src/widgets/util/qundostack.h
index f4db78300b..ca918b0618 100644
--- a/src/widgets/util/qundostack.h
+++ b/src/widgets/util/qundostack.h
@@ -128,6 +128,7 @@ public:
public Q_SLOTS:
void setClean();
+ void resetClean();
void setIndex(int idx);
void undo();
void redo();
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp
index 2587a7a03b..5b31e4467f 100644
--- a/src/widgets/widgets/qabstractscrollarea.cpp
+++ b/src/widgets/widgets/qabstractscrollarea.cpp
@@ -60,7 +60,7 @@
#include <private/qapplication_p.h>
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
#include <private/qt_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
#endif
@@ -168,7 +168,7 @@ QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate()
shownOnce(false), inResize(false), sizeAdjustPolicy(QAbstractScrollArea::AdjustIgnored),
viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0),
xoffset(0), yoffset(0), viewportFilter(0)
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
, singleFingerPanEnabled(false)
#endif
{
@@ -321,7 +321,7 @@ void QAbstractScrollAreaPrivate::init()
#endif
}
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
void QAbstractScrollAreaPrivate::setSingleFingerPanEnabled(bool on)
{
singleFingerPanEnabled = on;
@@ -329,7 +329,7 @@ void QAbstractScrollAreaPrivate::setSingleFingerPanEnabled(bool on)
if (dd)
dd->winSetupGestures();
}
-#endif // Q_DEAD_CODE_FROM_QT4_WIN
+#endif
void QAbstractScrollAreaPrivate::layoutChildren()
{
@@ -350,7 +350,7 @@ void QAbstractScrollAreaPrivate::layoutChildren()
const int hscrollOverlap = hbar->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarOverlap, &opt, hbar);
const int vscrollOverlap = vbar->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarOverlap, &opt, vbar);
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
QWidget * const window = q->window();
// Use small scroll bars for tool windows, to match the native size grip.
@@ -393,7 +393,7 @@ void QAbstractScrollAreaPrivate::layoutChildren()
// If the scroll bars are at the very right and bottom of the window we
// move their positions to be aligned with the size grip.
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// Check if a native sizegrip is present.
bool hasMacReverseSizeGrip = false;
bool hasMacSizeGrip = false;
@@ -446,7 +446,7 @@ void QAbstractScrollAreaPrivate::layoutChildren()
if (hasCornerWidget && ((needv && vscrollOverlap == 0) || (needh && hscrollOverlap == 0)))
cornerOffset = extPoint;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// Also move the scroll bars if they are covered by the native Mac size grip.
if (hasMacSizeGrip)
cornerOffset = extPoint;
@@ -463,7 +463,7 @@ void QAbstractScrollAreaPrivate::layoutChildren()
else
cornerPaintingRect = QRect();
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (hasMacReverseSizeGrip)
reverseCornerPaintingRect = QRect(controlsRect.bottomRight() + QPoint(1, 1) - extPoint, extSize);
else
@@ -488,7 +488,7 @@ void QAbstractScrollAreaPrivate::layoutChildren()
if (needh) {
QRect horizontalScrollBarRect(QPoint(controlsRect.left() + vHeaderRight, cornerPoint.y()), QPoint(cornerPoint.x() - 1, controlsRect.bottom()));
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (hasMacReverseSizeGrip)
horizontalScrollBarRect.adjust(vsbExt, 0, 0, 0);
#endif
@@ -602,7 +602,7 @@ void QAbstractScrollArea::setViewport(QWidget *widget)
d->viewport->setParent(this);
d->viewport->setFocusProxy(this);
d->viewport->installEventFilter(d->viewportFilter.data());
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
#ifndef QT_NO_GESTURES
d->viewport->grabGesture(Qt::PanGesture);
#endif
@@ -1029,7 +1029,7 @@ bool QAbstractScrollArea::event(QEvent *e)
QPainter p(this);
style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, &option, &p, this);
}
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (d->reverseCornerPaintingRect.isValid()) {
option.rect = d->reverseCornerPaintingRect;
QPainter p(this);
@@ -1108,7 +1108,7 @@ bool QAbstractScrollArea::event(QEvent *e)
hBar->setValue(se->contentPos().x());
vBar->setValue(se->contentPos().y());
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
typedef BOOL (*PtrBeginPanningFeedback)(HWND);
typedef BOOL (*PtrUpdatePanningFeedback)(HWND, LONG, LONG, BOOL);
typedef BOOL (*PtrEndPanningFeedback)(HWND, BOOL);
@@ -1532,13 +1532,13 @@ void QAbstractScrollAreaPrivate::_q_vslide(int y)
void QAbstractScrollAreaPrivate::_q_showOrHideScrollBars()
{
layoutChildren();
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
// Need to re-subscribe to gestures as the content changes to make sure we
// enable/disable panning when needed.
QWidgetPrivate *dd = static_cast<QWidgetPrivate *>(QObjectPrivate::get(viewport));
if (dd)
dd->winSetupGestures();
-#endif // Q_DEAD_CODE_FROM_QT4_WIN
+#endif
}
QPoint QAbstractScrollAreaPrivate::contentsOffset() const
diff --git a/src/widgets/widgets/qabstractscrollarea_p.h b/src/widgets/widgets/qabstractscrollarea_p.h
index 600c834c29..a3af77b11b 100644
--- a/src/widgets/widgets/qabstractscrollarea_p.h
+++ b/src/widgets/widgets/qabstractscrollarea_p.h
@@ -85,7 +85,7 @@ public:
QWidget *viewport;
QWidget *cornerWidget;
QRect cornerPaintingRect;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
QRect reverseCornerPaintingRect;
#endif
int left, top, right, bottom; // viewport margin
@@ -112,7 +112,7 @@ public:
{ return q_func()->viewportEvent(event); }
QScopedPointer<QObject> viewportFilter;
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
bool singleFingerPanEnabled;
void setSingleFingerPanEnabled(bool on = true);
#endif
diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp
index e85d82edb8..cc6a407bf8 100644
--- a/src/widgets/widgets/qabstractslider.cpp
+++ b/src/widgets/widgets/qabstractslider.cpp
@@ -721,7 +721,7 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb
offset_accumulated = 0;
offset_accumulated += stepsToScrollF;
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
// Don't scroll more than one page in any case:
stepsToScroll = qBound(-pageStep, int(offset_accumulated), pageStep);
#else
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index caeabb660b..b0ded70c4a 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -213,10 +213,9 @@ QString QCalendarDayValidator::text(const QDate &date, int repeat) const
return formatNumber(date.day(), 2);
} else if (repeat == 3) {
return m_locale.dayName(date.dayOfWeek(), QLocale::ShortFormat);
- } else if (repeat >= 4) {
+ } else /* repeat >= 4 */ {
return m_locale.dayName(date.dayOfWeek(), QLocale::LongFormat);
}
- return QString();
}
//////////////////////////////////
@@ -1579,7 +1578,7 @@ protected:
{
Q_UNUSED(e)
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
QStyleOptionToolButton opt;
initStyleOption(&opt);
@@ -3030,6 +3029,7 @@ bool QCalendarWidget::event(QEvent *event)
switch (event->type()) {
case QEvent::LayoutDirectionChange:
d->updateButtonIcons();
+ break;
case QEvent::LocaleChange:
d->m_model->setFirstColumnDay(locale().firstDayOfWeek());
d->cachedSizeHint = QSize();
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 693d5f9e93..52e7962109 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -66,7 +66,7 @@
#include <private/qabstractitemmodel_p.h>
#include <private/qabstractscrollarea_p.h>
#include <qdebug.h>
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC) && !defined(QT_NO_EFFECTS) && !defined(QT_NO_STYLE_MAC)
+#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_EFFECTS) && !defined(QT_NO_STYLE_MAC)
#include <private/qcore_mac_p.h>
#include <private/qmacstyle_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
@@ -415,7 +415,7 @@ void QComboBoxPrivateContainer::leaveEvent(QEvent *)
{
// On Mac using the Mac style we want to clear the selection
// when the mouse moves outside the popup.
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
QStyleOptionComboBox opt = comboStyleOption();
if (combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo))
view->clearSelection();
@@ -1684,6 +1684,9 @@ void QComboBox::setIconSize(const QSize &size)
By default, this property is \c false. The effect of editing depends
on the insert policy.
+ \note When disabling the \a editable state, the validator and
+ completer are removed.
+
\sa InsertPolicy
*/
bool QComboBox::isEditable() const
@@ -1837,6 +1840,8 @@ QLineEdit *QComboBox::lineEdit() const
\fn void QComboBox::setValidator(const QValidator *validator)
Sets the \a validator to use instead of the current validator.
+
+ \note The validator is removed when the editable property becomes \c false.
*/
void QComboBox::setValidator(const QValidator *v)
@@ -1870,6 +1875,8 @@ const QValidator *QComboBox::validator() const
By default, for an editable combo box, a QCompleter that
performs case insensitive inline completion is automatically created.
+
+ \note The completer is removed when the \a editable property becomes \c false.
*/
void QComboBox::setCompleter(QCompleter *c)
{
@@ -3126,6 +3133,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
case Qt::Key_Up:
if (e->modifiers() & Qt::ControlModifier)
break; // pass to line edit for auto completion
+ // fall through
case Qt::Key_PageUp:
#ifdef QT_KEYPAD_NAVIGATION
if (QApplication::keypadNavigationEnabled())
@@ -3168,6 +3176,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
showPopup();
return;
}
+ break;
case Qt::Key_Enter:
case Qt::Key_Return:
case Qt::Key_Escape:
@@ -3212,6 +3221,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
switch (move) {
case MoveFirst:
newIndex = -1;
+ // fall through
case MoveDown:
newIndex++;
while (newIndex < rowCount && !(d->model->index(newIndex, d->modelColumn, d->root).flags() & Qt::ItemIsEnabled))
@@ -3219,6 +3229,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
break;
case MoveLast:
newIndex = rowCount;
+ // fall through
case MoveUp:
newIndex--;
while ((newIndex >= 0) && !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled))
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index 54094de765..c5eab55a53 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -1125,7 +1125,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
select = false;
break;
}
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
else
#ifdef QT_KEYPAD_NAVIGATION
if (!QApplication::keypadNavigationEnabled())
@@ -2350,7 +2350,9 @@ void QDateTimeEditPrivate::interpret(EmitPolicy ep)
const QValidator::State state = q->validate(tmp, pos);
if (state != QValidator::Acceptable
&& correctionMode == QAbstractSpinBox::CorrectToPreviousValue
- && (state == QValidator::Invalid || !(fieldInfo(currentSectionIndex) & AllowPartial))) {
+ && (state == QValidator::Invalid
+ || currentSectionIndex < 0
+ || !(fieldInfo(currentSectionIndex) & AllowPartial))) {
setValue(value, ep);
updateTimeSpec();
} else {
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index 657eda3c68..23158cf82f 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -411,7 +411,7 @@ QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardBut
else
addButton(button, static_cast<QDialogButtonBox::ButtonRole>(role), doLayout);
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// Since mnemonics is off by default on Mac, we add a Cmd-D
// shortcut here to e.g. make the "Don't Save" button work nativly:
if (sbutton == QDialogButtonBox::Discard)
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index a7e865ff05..63f8172bf6 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -1935,7 +1935,7 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
QDockAreaLayoutItem item(new QDockWidgetItem(widget));
if (flags & StateFlagFloating) {
bool drawer = false;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC // drawer support
+#if 0 // Used to be included in Qt4 for Q_WS_MAC // drawer support
extern bool qt_mac_is_macdrawer(const QWidget *); //qwidget_mac.cpp
extern bool qt_mac_set_drawer_preferred_edge(QWidget *, Qt::DockWidgetArea); //qwidget_mac.cpp
drawer = qt_mac_is_macdrawer(widget);
@@ -1950,7 +1950,7 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
int x, y, w, h;
stream >> x >> y >> w >> h;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC // drawer support
+#if 0 // Used to be included in Qt4 for Q_WS_MAC // drawer support
if (drawer) {
mainWindow->window()->createWinId();
widget->window()->createWinId();
@@ -2050,7 +2050,7 @@ void QDockAreaLayoutInfo::updateSeparatorWidgets() const
}
j++;
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
sepWidget->raise();
#endif
QRect sepRect = separatorRect(i).adjusted(-2, -2, 2, 2);
@@ -3085,7 +3085,7 @@ bool QDockAreaLayout::restoreDockWidget(QDockWidget *dockWidget)
dockWidget->d_func()->setWindowState(true, true, r);
}
dockWidget->setVisible(!placeHolder->hidden);
-#ifdef Q_DEAD_CODE_FROM_QT4_X11
+#if 0 // Used to be included in Qt4 for Q_WS_X11
if (placeHolder->window) // gets rid of the X11BypassWindowManager window flag
dockWidget->d_func()->setWindowState(true);
#endif
@@ -3316,7 +3316,7 @@ void QDockAreaLayout::updateSeparatorWidgets() const
}
j++;
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
sepWidget->raise();
#endif
QRect sepRect = separatorRect(i).adjusted(-2, -2, 2, 2);
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index 5059616870..1df7259aba 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -58,7 +58,7 @@
#include "qdockwidget_p.h"
#include "qmainwindowlayout_p.h"
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
#include <private/qapplication_p.h>
#include <private/qt_mac_p.h>
#include <private/qmacstyle_mac_p.h>
@@ -916,7 +916,7 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event)
&& (event->pos() - state->pressPos).manhattanLength()
> QApplication::startDragDistance()) {
startDrag();
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
grabMouseWhileInWindow();
#else
q->grabMouse();
@@ -966,7 +966,7 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event)
QWidget *tl = q->topLevelWidget();
QRect geo = tl->geometry();
QRect titleRect = tl->frameGeometry();
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if ((features & QDockWidget::DockWidgetVerticalTitleBar)) {
titleRect.setTop(geo.top());
titleRect.setBottom(geo.bottom());
@@ -1508,7 +1508,7 @@ bool QDockWidget::event(QEvent *event)
if (d->mouseMoveEvent(static_cast<QMouseEvent *>(event)))
return true;
break;
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
case QEvent::Leave:
if (d->state != 0 && d->state->dragging && !d->state->nca) {
// This is a workaround for loosing the mouse on Vista.
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 2bc715724d..dd5f5325b1 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -87,7 +87,7 @@
QT_BEGIN_NAMESPACE
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
extern void qt_mac_secure_keyboard(bool); //qapplication_mac.cpp
#endif
@@ -573,7 +573,7 @@ void QLineEdit::setEchoMode(EchoMode mode)
setInputMethodHints(imHints);
d->control->setEchoMode(mode);
update();
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (hasFocus())
qt_mac_secure_keyboard(mode == Password || mode == NoEcho);
#endif
@@ -1810,7 +1810,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e)
if((!hasSelectedText() && d->control->preeditAreaText().isEmpty())
|| style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, this))
d->setCursorVisible(true);
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (d->control->echoMode() == Password || d->control->echoMode() == NoEcho)
qt_mac_secure_keyboard(true);
#endif
@@ -1858,7 +1858,7 @@ void QLineEdit::focusOutEvent(QFocusEvent *e)
if (hasAcceptableInput() || d->control->fixup())
emit editingFinished();
}
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (d->control->echoMode() == Password || d->control->echoMode() == NoEcho)
qt_mac_secure_keyboard(false);
#endif
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index 2477510520..e32e379198 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -61,7 +61,7 @@
#ifdef Q_OS_OSX
#include <qpa/qplatformnativeinterface.h>
#endif
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
#include <private/qt_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
QT_BEGIN_NAMESPACE
@@ -80,7 +80,7 @@ public:
#ifdef Q_OS_OSX
, useUnifiedToolBar(false)
#endif
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
, useHIToolBar(false)
, activateUnifiedToolbarAfterFullScreen(false)
#endif
@@ -95,7 +95,7 @@ public:
#ifdef Q_OS_OSX
bool useUnifiedToolBar;
#endif
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
bool useHIToolBar;
bool activateUnifiedToolbarAfterFullScreen;
#endif
@@ -682,8 +682,10 @@ QWidget *QMainWindow::takeCentralWidget()
{
Q_D(QMainWindow);
QWidget *oldcentralwidget = d->layout->centralWidget();
- oldcentralwidget->setParent(0);
- d->layout->setCentralWidget(0);
+ if (oldcentralwidget) {
+ oldcentralwidget->setParent(0);
+ d->layout->setCentralWidget(0);
+ }
return oldcentralwidget;
}
@@ -1110,7 +1112,7 @@ void QMainWindow::addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget
d_func()->layout->removeWidget(dockwidget); // in case it was already in here
addDockWidget(area, dockwidget, orientation);
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC //drawer support
+#if 0 // Used to be included in Qt4 for Q_WS_MAC //drawer support
QMacAutoReleasePool pool;
extern bool qt_mac_is_macdrawer(const QWidget *); //qwidget_mac.cpp
if (qt_mac_is_macdrawer(dockwidget)) {
@@ -1514,7 +1516,7 @@ bool QMainWindow::event(QEvent *event)
if (!d->explicitIconSize)
setIconSize(QSize());
break;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
case QEvent::Show:
if (unifiedTitleAndToolBarOnMac())
d->layout->syncUnifiedToolbarVisibility();
@@ -1533,7 +1535,7 @@ bool QMainWindow::event(QEvent *event)
}
}
break;
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR)
case QEvent::CursorChange:
// CursorChange events are triggered as mouse moves to new widgets even
@@ -1589,7 +1591,7 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set)
}
#endif
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
Q_D(QMainWindow);
if (!isWindow() || d->useHIToolBar == set || QSysInfo::MacintoshVersion < QSysInfo::MV_10_3)
return;
@@ -1624,7 +1626,7 @@ bool QMainWindow::unifiedTitleAndToolBarOnMac() const
#ifdef Q_OS_OSX
return d_func()->useUnifiedToolBar;
#endif
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
return d_func()->useHIToolBar && !testAttribute(Qt::WA_MacBrushedMetal) && !(windowFlags() & Qt::FramelessWindowHint);
#endif
return false;
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 939453473a..8df197e05c 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -70,7 +70,7 @@
#include <private/qapplication_p.h>
#include <private/qlayoutengine_p.h>
#include <private/qwidgetresizehandler_p.h>
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
# include <private/qcore_mac_p.h>
# include <private/qt_cocoa_helpers_mac_p.h>
#endif
@@ -1129,11 +1129,11 @@ void QMainWindowLayout::removeToolBar(QToolBar *toolbar)
QObject::disconnect(parentWidget(), SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)),
toolbar, SLOT(_q_updateToolButtonStyle(Qt::ToolButtonStyle)));
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (usesHIToolBar(toolbar)) {
removeFromMacToolbar(toolbar);
} else
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
{
removeWidget(toolbar);
}
@@ -1148,7 +1148,7 @@ void QMainWindowLayout::addToolBar(Qt::ToolBarArea area,
bool)
{
validateToolBarArea(area);
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if ((area == Qt::TopToolBarArea)
&& layoutState.mainWindow->unifiedTitleAndToolBarOnMac()) {
insertIntoMacToolbar(0, toolbar);
@@ -1174,11 +1174,11 @@ void QMainWindowLayout::addToolBar(Qt::ToolBarArea area,
*/
void QMainWindowLayout::insertToolBar(QToolBar *before, QToolBar *toolbar)
{
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (usesHIToolBar(before)) {
insertIntoMacToolbar(before, toolbar);
} else
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
{
addChildWidget(toolbar);
QLayoutItem * item = layoutState.toolBarAreaLayout.insertToolBar(before, toolbar);
@@ -1207,7 +1207,7 @@ Qt::ToolBarArea QMainWindowLayout::toolBarArea(QToolBar *toolbar) const
case QInternal::BottomDock: return Qt::BottomToolBarArea;
default: break;
}
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (pos == QInternal::DockCount) {
if (qtoolbarsInUnifiedToolbarList.contains(toolbar))
return Qt::TopToolBarArea;
@@ -1230,7 +1230,7 @@ void QMainWindowLayout::getStyleOptionInfo(QStyleOptionToolBar *option, QToolBar
void QMainWindowLayout::toggleToolBarsVisible()
{
bool updateNonUnifiedParts = true;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (layoutState.mainWindow->unifiedTitleAndToolBarOnMac()) {
// If we hit this case, someone has pressed the "toolbar button" which will
// toggle the unified toolbar visibility, because that's what the user wants.
@@ -1876,7 +1876,7 @@ QSize QMainWindowLayout::minimumSize() const
const QSize sbMin = statusbar ? statusbar->minimumSize() : QSize(0, 0);
minSize = QSize(qMax(sbMin.width(), minSize.width()),
sbMin.height() + minSize.height());
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
const QSize storedSize = minSize;
int minWidth = 0;
foreach (QToolBar *toolbar, qtoolbarsInUnifiedToolbarList) {
@@ -2186,7 +2186,7 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLay
#endif // QT_NO_DOCKWIDGET
, widgetAnimator(this)
, pluggingWidget(0)
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
, blockVisiblityCheck(false)
#endif
{
@@ -2213,7 +2213,7 @@ QMainWindowLayout::~QMainWindowLayout()
layoutState.deleteAllLayoutItems();
layoutState.deleteCentralWidgetItem();
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
cleanUpMacToolbarItems();
#endif
@@ -2581,7 +2581,7 @@ bool QMainWindowLayout::restoreState(QDataStream &stream)
// HIToolbar.
bool QMainWindowLayout::usesHIToolBar(QToolBar *toolbar) const
{
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
Q_UNUSED(toolbar);
return false;
#else
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h
index c06122b9c7..6e8b965431 100644
--- a/src/widgets/widgets/qmainwindowlayout_p.h
+++ b/src/widgets/widgets/qmainwindowlayout_p.h
@@ -325,7 +325,7 @@ private:
#ifndef QT_NO_TABBAR
void updateTabBarShapes();
#endif
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
static OSStatus qtmacToolbarDelegate(EventHandlerCallRef, EventRef , void *);
static OSStatus qtoolbarInHIToolbarHandler(EventHandlerCallRef inCallRef, EventRef event,
void *data);
@@ -358,7 +358,7 @@ public:
QUnifiedToolbarSurface *unifiedSurface;
void updateUnifiedToolbarOffset();
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
};
#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_DEBUG_STREAM)
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index 5f3aff5e10..183f1c2848 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -160,7 +160,7 @@
#include <QApplication>
#include <QStyle>
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC) && !defined(QT_NO_STYLE_MAC)
+#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_STYLE_MAC)
#include <private/qmacstyle_mac_p.h>
#endif
#include <QChildEvent>
@@ -2493,7 +2493,7 @@ bool QMdiArea::event(QEvent *event)
{
Q_D(QMdiArea);
switch (event->type()) {
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
// QWidgetPrivate::hide_helper activates another sub-window when closing a
// modal dialog on Windows (see activateWindow() inside the ifdef).
case QEvent::WindowUnblocked:
@@ -2557,7 +2557,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event)
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
// Ingore key events without a Ctrl modifier (except for press/release on the modifier itself).
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (!(keyEvent->modifiers() & Qt::MetaModifier) && keyEvent->key() != Qt::Key_Meta)
#else
if (!(keyEvent->modifiers() & Qt::ControlModifier) && keyEvent->key() != Qt::Key_Control)
@@ -2576,7 +2576,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event)
// 3) Ctrl-Shift-Tab (Tab, Tab, ...) -> iterate through all windows in the opposite
// direction (activatePreviousSubWindow())
switch (keyEvent->key()) {
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
case Qt::Key_Meta:
#else
case Qt::Key_Control:
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index afe87c6af9..2fff2fc729 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -280,7 +280,7 @@ static inline bool isHoverControl(QStyle::SubControl control)
return control != QStyle::SC_None && control != QStyle::SC_TitleBarLabel;
}
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN)
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
static inline QRgb colorref2qrgb(COLORREF col)
{
return qRgb(GetRValue(col),GetGValue(col),GetBValue(col));
@@ -1932,7 +1932,7 @@ QPalette QMdiSubWindowPrivate::desktopPalette() const
QPalette newPalette = q->palette();
bool colorsInitialized = false;
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN // ask system properties on windows
+#if 0 // Used to be included in Qt4 for Q_WS_WIN // ask system properties on windows
#ifndef SPI_GETGRADIENTCAPTIONS
#define SPI_GETGRADIENTCAPTIONS 0x1008
#endif
@@ -1968,7 +1968,7 @@ QPalette QMdiSubWindowPrivate::desktopPalette() const
newPalette.color(QPalette::Inactive, QPalette::Highlight));
}
}
-#endif // Q_DEAD_CODE_FROM_QT4_WIN
+#endif
if (!colorsInitialized) {
newPalette.setColor(QPalette::Active, QPalette::Highlight,
newPalette.color(QPalette::Active, QPalette::Highlight));
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index d957dda162..36a8a96b79 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -153,12 +153,19 @@ void QMenuPrivate::init()
scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone;
}
- setPlatformMenu(QGuiApplicationPrivate::platformTheme()->createPlatformMenu());
sloppyState.initialize(q);
delayState.initialize(q);
mousePopupDelay = q->style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, q);
}
+QPlatformMenu *QMenuPrivate::createPlatformMenu()
+{
+ Q_Q(QMenu);
+ if (platformMenu.isNull())
+ q->setPlatformMenu(QGuiApplicationPrivate::platformTheme()->createPlatformMenu());
+ return platformMenu.data();
+}
+
void QMenuPrivate::setPlatformMenu(QPlatformMenu *menu)
{
Q_Q(QMenu);
@@ -809,6 +816,93 @@ void QMenuPrivate::updateLayoutDirection()
}
}
+void QMenuPrivate::drawScroller(QPainter *painter, QMenuPrivate::ScrollerTearOffItem::Type type, const QRect &rect)
+{
+ if (!painter || rect.isEmpty())
+ return;
+
+ if (!scroll || !(scroll->scrollFlags & (QMenuPrivate::QMenuScroller::ScrollUp
+ | QMenuPrivate::QMenuScroller::ScrollDown)))
+ return;
+
+ Q_Q(QMenu);
+ QStyleOptionMenuItem menuOpt;
+ menuOpt.initFrom(q);
+ menuOpt.state = QStyle::State_None;
+ menuOpt.checkType = QStyleOptionMenuItem::NotCheckable;
+ menuOpt.maxIconWidth = 0;
+ menuOpt.tabWidth = 0;
+ menuOpt.rect = rect;
+ menuOpt.menuItemType = QStyleOptionMenuItem::Scroller;
+ menuOpt.state |= QStyle::State_Enabled;
+ if (type == QMenuPrivate::ScrollerTearOffItem::ScrollDown)
+ menuOpt.state |= QStyle::State_DownArrow;
+
+ painter->setClipRect(menuOpt.rect);
+ q->style()->drawControl(QStyle::CE_MenuScroller, &menuOpt, painter, q);
+}
+
+void QMenuPrivate::drawTearOff(QPainter *painter, const QRect &rect)
+{
+ if (!painter || rect.isEmpty())
+ return;
+
+ if (!tearoff)
+ return;
+
+ Q_Q(QMenu);
+ QStyleOptionMenuItem menuOpt;
+ menuOpt.initFrom(q);
+ menuOpt.state = QStyle::State_None;
+ menuOpt.checkType = QStyleOptionMenuItem::NotCheckable;
+ menuOpt.maxIconWidth = 0;
+ menuOpt.tabWidth = 0;
+ menuOpt.rect = rect;
+ menuOpt.menuItemType = QStyleOptionMenuItem::TearOff;
+ if (tearoffHighlighted)
+ menuOpt.state |= QStyle::State_Selected;
+
+ painter->setClipRect(menuOpt.rect);
+ q->style()->drawControl(QStyle::CE_MenuTearoff, &menuOpt, painter, q);
+}
+
+QMenuPrivate::ScrollerTearOffItem::ScrollerTearOffItem(QMenuPrivate::ScrollerTearOffItem::Type type, QMenuPrivate *mPrivate, QWidget *parent, Qt::WindowFlags f)
+ : QWidget(parent, f), menuPrivate(mPrivate), scrollType(type)
+{
+ if (parent)
+ setMouseTracking(parent->style()->styleHint(QStyle::SH_Menu_MouseTracking, 0, parent));
+}
+
+void QMenuPrivate::ScrollerTearOffItem::paintEvent(QPaintEvent *e)
+{
+ if (!e->rect().intersects(rect()))
+ return;
+
+ QPainter p(this);
+ QWidget *parent = parentWidget();
+
+ //paint scroll up / down arrows
+ menuPrivate->drawScroller(&p, scrollType, QRect(0, 0, width(), menuPrivate->scrollerHeight()));
+ //paint the tear off
+ if (scrollType == QMenuPrivate::ScrollerTearOffItem::ScrollUp) {
+ QRect rect(0, 0, width(), parent->style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, parent));
+ if (menuPrivate->scroll && menuPrivate->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
+ rect.translate(0, menuPrivate->scrollerHeight());
+ menuPrivate->drawTearOff(&p, rect);
+ }
+}
+
+void QMenuPrivate::ScrollerTearOffItem::updateScrollerRects(const QRect &rect)
+{
+ if (rect.isEmpty())
+ setVisible(false);
+ else {
+ setGeometry(rect);
+ raise();
+ setVisible(true);
+ }
+}
+
/*!
Returns the action associated with this menu.
@@ -2532,58 +2626,78 @@ void QMenu::paintEvent(QPaintEvent *e)
menuOpt.tabWidth = 0;
style()->drawPrimitive(QStyle::PE_PanelMenu, &menuOpt, &p, this);
+ //calculate the scroll up / down rect
+ const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this);
+ QRect scrollUpRect, scrollDownRect;
+ if (d->scroll) {
+ if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
+ scrollUpRect.setRect(fw, fw, width() - (fw * 2), d->scrollerHeight());
+
+ if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown)
+ scrollDownRect.setRect(fw, height() - d->scrollerHeight() - fw, width() - (fw * 2),
+ d->scrollerHeight());
+ }
+
+ //calculate the tear off rect
+ QRect tearOffRect;
+ if (d->tearoff) {
+ tearOffRect.setRect(fw, fw, width() - (fw * 2),
+ style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this));
+ if (d->scroll && d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
+ tearOffRect.translate(0, d->scrollerHeight());
+ }
+
//draw the items that need updating..
+ QRect scrollUpTearOffRect = scrollUpRect.united(tearOffRect);
for (int i = 0; i < d->actions.count(); ++i) {
QAction *action = d->actions.at(i);
- QRect adjustedActionRect = d->actionRects.at(i);
- if (!e->rect().intersects(adjustedActionRect)
+ QRect actionRect = d->actionRects.at(i);
+ if (!e->rect().intersects(actionRect)
|| d->widgetItems.value(action))
continue;
//set the clip region to be extra safe (and adjust for the scrollers)
+ emptyArea -= QRegion(actionRect);
+
+ QRect adjustedActionRect = actionRect;
+ if (adjustedActionRect.intersects(scrollUpTearOffRect)) {
+ if (adjustedActionRect.bottom() <= scrollUpTearOffRect.bottom())
+ continue;
+ else
+ adjustedActionRect.setTop(scrollUpTearOffRect.bottom()+1);
+ }
+
+ if (adjustedActionRect.intersects(scrollDownRect)) {
+ if (adjustedActionRect.top() >= scrollDownRect.top())
+ continue;
+ else
+ adjustedActionRect.setBottom(scrollDownRect.top()-1);
+ }
+
QRegion adjustedActionReg(adjustedActionRect);
- emptyArea -= adjustedActionReg;
p.setClipRegion(adjustedActionReg);
QStyleOptionMenuItem opt;
initStyleOption(&opt, action);
- opt.rect = adjustedActionRect;
+ opt.rect = actionRect;
style()->drawControl(QStyle::CE_MenuItem, &opt, &p, this);
}
- const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this);
- //draw the scroller regions..
- if (d->scroll) {
- menuOpt.menuItemType = QStyleOptionMenuItem::Scroller;
- menuOpt.state |= QStyle::State_Enabled;
- if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) {
- menuOpt.rect.setRect(fw, fw, width() - (fw * 2), d->scrollerHeight());
- emptyArea -= QRegion(menuOpt.rect);
- p.setClipRect(menuOpt.rect);
- style()->drawControl(QStyle::CE_MenuScroller, &menuOpt, &p, this);
- }
- if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown) {
- menuOpt.rect.setRect(fw, height() - d->scrollerHeight() - fw, width() - (fw * 2),
- d->scrollerHeight());
- emptyArea -= QRegion(menuOpt.rect);
- menuOpt.state |= QStyle::State_DownArrow;
- p.setClipRect(menuOpt.rect);
- style()->drawControl(QStyle::CE_MenuScroller, &menuOpt, &p, this);
- }
- }
- //paint the tear off..
- if (d->tearoff) {
- menuOpt.menuItemType = QStyleOptionMenuItem::TearOff;
- menuOpt.rect.setRect(fw, fw, width() - (fw * 2),
- style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this));
- if (d->scroll && d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)
- menuOpt.rect.translate(0, d->scrollerHeight());
- emptyArea -= QRegion(menuOpt.rect);
- p.setClipRect(menuOpt.rect);
- menuOpt.state = QStyle::State_None;
- if (d->tearoffHighlighted)
- menuOpt.state |= QStyle::State_Selected;
- style()->drawControl(QStyle::CE_MenuTearoff, &menuOpt, &p, this);
+ emptyArea -= QRegion(scrollUpTearOffRect);
+ emptyArea -= QRegion(scrollDownRect);
+
+ if (d->scrollUpTearOffItem || d->scrollDownItem) {
+ if (d->scrollUpTearOffItem)
+ d->scrollUpTearOffItem->updateScrollerRects(scrollUpTearOffRect);
+ if (d->scrollDownItem)
+ d->scrollDownItem->updateScrollerRects(scrollDownRect);
+ } else {
+ //paint scroll up /down
+ d->drawScroller(&p, QMenuPrivate::ScrollerTearOffItem::ScrollUp, scrollUpRect);
+ d->drawScroller(&p, QMenuPrivate::ScrollerTearOffItem::ScrollDown, scrollDownRect);
+ //paint the tear off..
+ d->drawTearOff(&p, tearOffRect);
}
+
//draw border
if (fw) {
QRegion borderReg;
@@ -2602,7 +2716,7 @@ void QMenu::paintEvent(QPaintEvent *e)
style()->drawPrimitive(QStyle::PE_FrameMenu, &frame, &p, this);
}
- //finally the rest of the space
+ //finally the rest of the spaces
p.setClipRegion(emptyArea);
menuOpt.state = QStyle::State_None;
menuOpt.menuItemType = QStyleOptionMenuItem::EmptyArea;
@@ -3314,8 +3428,17 @@ void QMenu::actionEvent(QActionEvent *e)
}
if (QWidgetAction *wa = qobject_cast<QWidgetAction *>(e->action())) {
QWidget *widget = wa->requestWidget(this);
- if (widget)
+ if (widget) {
d->widgetItems.insert(wa, widget);
+ if (d->scroll) {
+ if (!d->scrollUpTearOffItem)
+ d->scrollUpTearOffItem =
+ new QMenuPrivate::ScrollerTearOffItem(QMenuPrivate::ScrollerTearOffItem::ScrollUp, d, this);
+ if (!d->scrollDownItem)
+ d->scrollDownItem =
+ new QMenuPrivate::ScrollerTearOffItem(QMenuPrivate::ScrollerTearOffItem::ScrollDown, d, this);
+ }
+ }
}
} else if (e->type() == QEvent::ActionRemoved) {
e->action()->disconnect(this);
diff --git a/src/widgets/widgets/qmenu_mac.mm b/src/widgets/widgets/qmenu_mac.mm
index fef1eb2cf4..f9f3ad08dc 100644
--- a/src/widgets/widgets/qmenu_mac.mm
+++ b/src/widgets/widgets/qmenu_mac.mm
@@ -80,11 +80,12 @@ inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePla
*/
NSMenu *QMenu::toNSMenu()
{
+ Q_D(QMenu);
// Call into the cocoa platform plugin: qMenuToNSMenu(platformMenu())
QPlatformNativeInterface::NativeResourceForIntegrationFunction function = resolvePlatformFunction("qmenutonsmenu");
if (function) {
typedef void* (*QMenuToNSMenuFunction)(QPlatformMenu *platformMenu);
- return reinterpret_cast<NSMenu *>(reinterpret_cast<QMenuToNSMenuFunction>(function)(platformMenu()));
+ return reinterpret_cast<NSMenu *>(reinterpret_cast<QMenuToNSMenuFunction>(function)(d->createPlatformMenu()));
}
return nil;
}
@@ -98,11 +99,12 @@ NSMenu *QMenu::toNSMenu()
*/
void QMenu::setAsDockMenu()
{
+ Q_D(QMenu);
// Call into the cocoa platform plugin: setDockMenu(platformMenu())
QPlatformNativeInterface::NativeResourceForIntegrationFunction function = resolvePlatformFunction("setdockmenu");
if (function) {
typedef void (*SetDockMenuFunction)(QPlatformMenu *platformMenu);
- reinterpret_cast<SetDockMenuFunction>(function)(platformMenu());
+ reinterpret_cast<SetDockMenuFunction>(function)(d->createPlatformMenu());
}
}
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index 2b0dc482da..64291e842f 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -276,7 +276,8 @@ public:
cancelAction(0),
#endif
scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0),
- hasCheckableItems(0), doChildEffects(false), platformMenu(0)
+ hasCheckableItems(0), doChildEffects(false), platformMenu(0),
+ scrollUpTearOffItem(nullptr), scrollDownItem(nullptr)
{ }
~QMenuPrivate()
@@ -286,6 +287,7 @@ public:
delete platformMenu.data();
}
void init();
+ QPlatformMenu *createPlatformMenu();
void setPlatformMenu(QPlatformMenu *menu);
void syncPlatformMenu();
#ifdef Q_OS_OSX
@@ -444,6 +446,24 @@ public:
QPointer<QAction> actionAboutToTrigger;
QPointer<QWidget> noReplayFor;
+
+ class ScrollerTearOffItem : public QWidget {
+ public:
+ enum Type { ScrollUp, ScrollDown };
+ ScrollerTearOffItem(Type type, QMenuPrivate *mPrivate,
+ QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
+ void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
+ void updateScrollerRects(const QRect &rect);
+
+ private:
+ QMenuPrivate *menuPrivate;
+ Type scrollType;
+ };
+ ScrollerTearOffItem *scrollUpTearOffItem;
+ ScrollerTearOffItem *scrollDownItem;
+
+ void drawScroller(QPainter *painter, ScrollerTearOffItem::Type type, const QRect &rect);
+ void drawTearOff(QPainter *painter, const QRect &rect);
};
#endif // QT_NO_MENU
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index ce43740524..6b0c2fd621 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -1192,6 +1192,10 @@ QPlatformMenu *QMenuBarPrivate::getPlatformMenu(QAction *action)
QPlatformMenu *platformMenu = action->menu()->platformMenu();
if (!platformMenu && platformMenuBar) {
platformMenu = platformMenuBar->createMenu();
+ // QPlatformMenuBar::createMenu() was introduced in Qt 5.7. Not all third party
+ // platform themes are using it, so fallback to QPlatformTheme::createPlatformMenu().
+ if (!platformMenu)
+ platformMenu = QGuiApplicationPrivate::platformTheme()->createPlatformMenu();
if (platformMenu)
action->menu()->setPlatformMenu(platformMenu);
}
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 27f1b16f60..7e01f6f3d5 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -811,7 +811,7 @@ void QPlainTextEditPrivate::init(const QString &txt)
viewport->setCursor(Qt::IBeamCursor);
#endif
originalOffsetY = 0;
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
setSingleFingerPanEnabled(true);
#endif
}
diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp
index bf10b9fb75..3b1440edb6 100644
--- a/src/widgets/widgets/qpushbutton.cpp
+++ b/src/widgets/widgets/qpushbutton.cpp
@@ -56,10 +56,10 @@
#include "qdebug.h"
#include "qlayoutitem.h"
#include "qdialogbuttonbox.h"
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
#include "private/qmacstyle_mac_p.h"
#include "private/qmacstyle_mac_p_p.h"
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
@@ -675,7 +675,7 @@ bool QPushButton::event(QEvent *e)
return QAbstractButton::event(e);
}
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
/*! \reimp */
bool QPushButton::hitButton(const QPoint &pos) const
{
@@ -704,7 +704,7 @@ bool QPushButtonPrivate::hitButton(const QPoint &pos)
q->rect().height() - QMacStylePrivate::PushButtonBottomOffset);
return roundedRect.contains(pos);
}
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qpushbutton.h b/src/widgets/widgets/qpushbutton.h
index 56d4d1de20..859ac247fb 100644
--- a/src/widgets/widgets/qpushbutton.h
+++ b/src/widgets/widgets/qpushbutton.h
@@ -87,9 +87,9 @@ public Q_SLOTS:
protected:
bool event(QEvent *e) Q_DECL_OVERRIDE;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
bool hitButton(const QPoint &pos) const;
-#endif // Q_DEAD_CODE_FROM_QT4_MAC
+#endif
void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
void focusInEvent(QFocusEvent *) Q_DECL_OVERRIDE;
diff --git a/src/widgets/widgets/qpushbutton_p.h b/src/widgets/widgets/qpushbutton_p.h
index cd453a1339..ee41c345c8 100644
--- a/src/widgets/widgets/qpushbutton_p.h
+++ b/src/widgets/widgets/qpushbutton_p.h
@@ -71,7 +71,7 @@ public:
inline void init() { resetLayoutItemMargins(); }
static QPushButtonPrivate* get(QPushButton *b) { return b->d_func(); }
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
bool hitButton(const QPoint &pos);
#endif
#ifndef QT_NO_MENU
diff --git a/src/widgets/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp
index 123c955684..c91f837093 100644
--- a/src/widgets/widgets/qrubberband.cpp
+++ b/src/widgets/widgets/qrubberband.cpp
@@ -47,7 +47,7 @@
#include "qstyle.h"
#include "qstyleoption.h"
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
# include <private/qt_mac_p.h>
# include <private/qt_cocoa_helpers_mac_p.h>
#endif
@@ -142,12 +142,12 @@ QRubberBand::QRubberBand(Shape s, QWidget *p)
Q_D(QRubberBand);
d->shape = s;
setAttribute(Qt::WA_TransparentForMouseEvents);
-#ifndef Q_DEAD_CODE_FROM_QT4_WIN
+#if 1 // Used to be excluded in Qt4 for Q_WS_WIN
setAttribute(Qt::WA_NoSystemBackground);
-#endif //Q_DEAD_CODE_FROM_QT4_WIN
+#endif
setAttribute(Qt::WA_WState_ExplicitShowHide);
setVisible(false);
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (isWindow()) {
createWinId();
extern OSWindowRef qt_mac_window_for(const QWidget *); //qwidget_mac.cpp
diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp
index dd0b383d2b..5150601366 100644
--- a/src/widgets/widgets/qsizegrip.cpp
+++ b/src/widgets/widgets/qsizegrip.cpp
@@ -52,7 +52,7 @@
#include "qdebug.h"
#include <QDesktopWidget>
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
#include <private/qt_mac_p.h>
#endif
@@ -82,7 +82,7 @@ public:
Qt::Corner m_corner;
bool gotMousePress;
QPointer<QWidget> tlw;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
void updateMacSizer(bool hide) const;
#endif
Qt::Corner corner() const;
@@ -120,7 +120,7 @@ public:
updateTopLevelWidget();
if (tlw && showSizeGrip) {
Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen;
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
sizeGripNotVisibleState |= Qt::WindowMaximized;
#endif
// Don't show the size grip if the tlw is maximized or in full screen mode.
@@ -142,7 +142,7 @@ QSizeGripPrivate::QSizeGripPrivate()
{
}
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
void QSizeGripPrivate::updateMacSizer(bool hide) const
{
Q_Q(const QSizeGrip);
@@ -225,7 +225,7 @@ void QSizeGripPrivate::init()
Q_Q(QSizeGrip);
m_corner = q->isLeftToRight() ? Qt::BottomRightCorner : Qt::BottomLeftCorner;
-#if !defined(QT_NO_CURSOR) && !defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if !defined(QT_NO_CURSOR) && !0 /* Used to be included in Qt4 for Q_WS_MAC */
q->setCursor(m_corner == Qt::TopLeftCorner || m_corner == Qt::BottomRightCorner
? Qt::SizeFDiagCursor : Qt::SizeBDiagCursor);
#endif
@@ -438,7 +438,7 @@ void QSizeGrip::moveEvent(QMoveEvent * /*moveEvent*/)
return;
d->m_corner = d->corner();
-#if !defined(QT_NO_CURSOR) && !defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if !defined(QT_NO_CURSOR) && !0 /* Used to be included in Qt4 for Q_WS_MAC */
setCursor(d->m_corner == Qt::TopLeftCorner || d->m_corner == Qt::BottomRightCorner
? Qt::SizeFDiagCursor : Qt::SizeBDiagCursor);
#endif
@@ -449,7 +449,7 @@ void QSizeGrip::moveEvent(QMoveEvent * /*moveEvent*/)
*/
void QSizeGrip::showEvent(QShowEvent *showEvent)
{
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
d_func()->updateMacSizer(false);
#endif
QWidget::showEvent(showEvent);
@@ -460,7 +460,7 @@ void QSizeGrip::showEvent(QShowEvent *showEvent)
*/
void QSizeGrip::hideEvent(QHideEvent *hideEvent)
{
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
d_func()->updateMacSizer(true);
#endif
QWidget::hideEvent(hideEvent);
@@ -484,7 +484,7 @@ bool QSizeGrip::eventFilter(QObject *o, QEvent *e)
return QWidget::eventFilter(o, e);
}
Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen;
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
sizeGripNotVisibleState |= Qt::WindowMaximized;
#endif
// Don't show the size grip if the tlw is maximized or in full screen mode.
diff --git a/src/widgets/widgets/qstatusbar.cpp b/src/widgets/widgets/qstatusbar.cpp
index 5f1c373bb1..bdf728ead2 100644
--- a/src/widgets/widgets/qstatusbar.cpp
+++ b/src/widgets/widgets/qstatusbar.cpp
@@ -87,7 +87,7 @@ public:
int savedStrut;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
QPoint dragStart;
#endif
@@ -746,7 +746,7 @@ bool QStatusBar::event(QEvent *e)
// On Mac OS X Leopard it is possible to drag the window by clicking
// on the tool bar on most applications.
-#ifndef Q_DEAD_CODE_FROM_QT4_MAC
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
return QWidget::event(e);
#else
// Enable drag-click only if the status bar is the status bar for a
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index b6a3ef7eb8..6e34198f67 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -63,7 +63,7 @@
#ifndef QT_NO_TABBAR
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
#include <private/qt_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
#endif
@@ -176,7 +176,12 @@ void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex)
if (tab.textColor.isValid())
option->palette.setColor(q->foregroundRole(), tab.textColor);
-
+#ifdef Q_OS_MACOS
+ else if (isCurrent && !documentMode
+ && (QSysInfo::MacintoshVersion < QSysInfo::MV_10_10 || q->isActiveWindow())) {
+ option->palette.setColor(QPalette::WindowText, Qt::white);
+ }
+#endif
option->icon = tab.icon;
option->iconSize = q->iconSize(); // Will get the default value then.
@@ -1922,7 +1927,7 @@ void QTabBar::mousePressEvent(QMouseEvent *event)
d->moveTabFinished(d->pressedIndex);
d->pressedIndex = d->indexAtPos(event->pos());
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
d->previousPressedIndex = d->pressedIndex;
#endif
if (d->validIndex(d->pressedIndex)) {
@@ -2004,7 +2009,7 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event)
update();
}
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
} else if (!d->documentMode && event->buttons() == Qt::LeftButton && d->previousPressedIndex != -1) {
int newPressedIndex = d->indexAtPos(event->pos());
if (d->pressedIndex == -1 && d->previousPressedIndex == newPressedIndex) {
@@ -2102,7 +2107,7 @@ void QTabBar::mouseReleaseEvent(QMouseEvent *event)
event->ignore();
return;
}
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
d->previousPressedIndex = -1;
#endif
if (d->movable && d->dragInProgress && d->validIndex(d->pressedIndex)) {
diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h
index 0e9dce84b3..e8d5503fdf 100644
--- a/src/widgets/widgets/qtabbar_p.h
+++ b/src/widgets/widgets/qtabbar_p.h
@@ -91,7 +91,7 @@ public:
selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false),
dragInProgress(false), documentMode(false), autoHide(false), changeCurrentOnDrag(false),
switchTabCurrentIndex(-1), switchTabTimerId(0), movingTab(0)
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
, previousPressedIndex(-1)
#endif
{}
@@ -228,7 +228,7 @@ public:
int switchTabTimerId;
QMovableTabWidget *movingTab;
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
int previousPressedIndex;
#endif
// shared by tabwidget and qtabbar
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index f354495e70..66bf2919eb 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -184,7 +184,7 @@ void QTextEditPrivate::init(const QString &html)
#ifndef QT_NO_CURSOR
viewport->setCursor(Qt::IBeamCursor);
#endif
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
setSingleFingerPanEnabled(true);
#endif
}
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index 61bc6d19cf..2a0912df0a 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -322,7 +322,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event)
startDrag(moving);
if (!moving && !wasDragging) {
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
grabMouseWhileInWindow();
#else
q->grabMouse();
diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp
index 05564bb6b1..0c57d9251d 100644
--- a/src/widgets/widgets/qtoolbararealayout.cpp
+++ b/src/widgets/widgets/qtoolbararealayout.cpp
@@ -604,16 +604,21 @@ int QToolBarAreaLayoutInfo::distance(const QPoint &pos) const
case QInternal::LeftDock:
if (pos.y() < rect.bottom())
return pos.x() - rect.right();
+ break;
case QInternal::RightDock:
if (pos.y() < rect.bottom())
return rect.left() - pos.x();
+ break;
case QInternal::TopDock:
if (pos.x() < rect.right())
return pos.y() - rect.bottom();
+ break;
case QInternal::BottomDock:
if (pos.x() < rect.right())
return rect.top() - pos.y();
- default:
+ break;
+
+ case QInternal::DockCount:
break;
}
return -1;
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index 66f17dbe33..9b65dc43d1 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -72,7 +72,7 @@ int QWidgetLineControl::redoTextLayout() const
QTextLine l = m_textLayout.createLine();
m_textLayout.endLayout();
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (m_threadChecks)
m_textLayoutThread = QThread::currentThread();
#endif
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h
index db9039e302..d4a4534fb5 100644
--- a/src/widgets/widgets/qwidgetlinecontrol_p.h
+++ b/src/widgets/widgets/qwidgetlinecontrol_p.h
@@ -91,7 +91,7 @@ public:
m_selstart(0), m_selend(0), m_passwordEchoEditing(false)
, m_passwordEchoTimer(0)
, m_passwordMaskDelay(-1)
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
, m_threadChecks(false)
, m_textLayoutThread(0)
#endif
@@ -382,14 +382,14 @@ public:
QTextLayout *textLayout() const
{
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
if (m_threadChecks && QThread::currentThread() != m_textLayoutThread)
redoTextLayout();
#endif
return &m_textLayout;
}
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
void setThreadChecks(bool threadChecks)
{
m_threadChecks = threadChecks;
@@ -512,7 +512,7 @@ private:
}
int redoTextLayout() const;
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
bool m_threadChecks;
mutable QThread *m_textLayoutThread;
#endif
diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp
index 2a7b1eeecc..016598849b 100644
--- a/src/widgets/widgets/qwidgetresizehandler.cpp
+++ b/src/widgets/widgets/qwidgetresizehandler.cpp
@@ -120,7 +120,7 @@ bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee)
if (!widget->rect().contains(widget->mapFromGlobal(e->globalPos())))
return false;
if (e->button() == Qt::LeftButton) {
-#if defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if 0 // Used to be included in Qt4 for Q_WS_X11
/*
Implicit grabs do not stop the X server from changing
the cursor in children, which looks *really* bad when
@@ -134,7 +134,7 @@ bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee)
# else
widget->grabMouse();
# endif // QT_NO_CURSOR
-#endif // Q_DEAD_CODE_FROM_QT4_X11
+#endif
buttonDown = false;
emit activate();
bool me = movingEnabled;