summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qclipboard.cpp2
-rw-r--r--src/gui/kernel/qcursor.cpp8
-rw-r--r--src/gui/kernel/qdnd_p.h2
-rw-r--r--src/gui/kernel/qdrag.cpp2
-rw-r--r--src/gui/kernel/qdrag.h3
-rw-r--r--src/gui/kernel/qguiapplication.cpp75
-rw-r--r--src/gui/kernel/qguiapplication.h2
-rw-r--r--src/gui/kernel/qguiapplication_p.h6
-rw-r--r--src/gui/kernel/qkeymapper_p.h2
-rw-r--r--src/gui/kernel/qkeysequence.cpp6
-rw-r--r--src/gui/kernel/qoffscreensurface.h2
-rw-r--r--src/gui/kernel/qopenglcontext.cpp14
-rw-r--r--src/gui/kernel/qopenglcontext_p.h4
-rw-r--r--src/gui/kernel/qopenglwindow.cpp2
-rw-r--r--src/gui/kernel/qpalette.cpp6
-rw-r--r--src/gui/kernel/qpalette.h13
-rw-r--r--src/gui/kernel/qplatformclipboard.h3
-rw-r--r--src/gui/kernel/qplatformcursor.cpp2
-rw-r--r--src/gui/kernel/qplatformcursor.h2
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp24
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h5
-rw-r--r--src/gui/kernel/qplatformdrag.h4
-rw-r--r--src/gui/kernel/qplatformgraphicsbuffer.cpp2
-rw-r--r--src/gui/kernel/qplatformgraphicsbuffer.h2
-rw-r--r--src/gui/kernel/qplatforminputcontext.h2
-rw-r--r--src/gui/kernel/qplatformintegration.cpp40
-rw-r--r--src/gui/kernel/qplatformintegration.h12
-rw-r--r--src/gui/kernel/qplatformscreen.cpp4
-rw-r--r--src/gui/kernel/qplatformscreen.h4
-rw-r--r--src/gui/kernel/qplatformservices.h2
-rw-r--r--src/gui/kernel/qplatformsessionmanager.h4
-rw-r--r--src/gui/kernel/qplatformsurface.h2
-rw-r--r--src/gui/kernel/qplatformtheme.h4
-rw-r--r--src/gui/kernel/qplatformwindow.cpp4
-rw-r--r--src/gui/kernel/qplatformwindow.h4
-rw-r--r--src/gui/kernel/qscreen.cpp20
-rw-r--r--src/gui/kernel/qsessionmanager_p.h2
-rw-r--r--src/gui/kernel/qshortcutmap.cpp6
-rw-r--r--src/gui/kernel/qsimpledrag_p.h2
-rw-r--r--src/gui/kernel/qstylehints.cpp51
-rw-r--r--src/gui/kernel/qstylehints.h4
-rw-r--r--src/gui/kernel/qt_gui_pch.h31
-rw-r--r--src/gui/kernel/qwindow.cpp36
-rw-r--r--src/gui/kernel/qwindow.h5
-rw-r--r--src/gui/kernel/qwindow_p.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp9
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h2
47 files changed, 213 insertions, 232 deletions
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index a76150d91d..267c079ad9 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -439,7 +439,7 @@ void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode)
\fn QMimeData *QClipboard::mimeData(Mode mode) const
Returns a pointer to a QMimeData representation of the current
- clipboard data (can be NULL if the given \a mode is not
+ clipboard data (can be \nullptr if the given \a mode is not
supported by the platform).
The \a mode argument is used to control which part of the system
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index bb81ca109a..9e4787589f 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -564,8 +564,8 @@ void QCursor::setShape(Qt::CursorShape shape)
}
/*!
- Returns the cursor bitmap, or 0 if it is one of the standard
- cursors.
+ Returns the cursor bitmap, or \nullptr if it is one of the
+ standard cursors.
*/
const QBitmap *QCursor::bitmap() const
{
@@ -575,8 +575,8 @@ const QBitmap *QCursor::bitmap() const
}
/*!
- Returns the cursor bitmap mask, or 0 if it is one of the standard
- cursors.
+ Returns the cursor bitmap mask, or \nullptr if it is one of the
+ standard cursors.
*/
const QBitmap *QCursor::mask() const
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index 5f6db07987..8f8eb03f87 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -110,7 +110,7 @@ private:
QDrag *m_object;
static QDragManager *m_instance;
- Q_DISABLE_COPY(QDragManager)
+ Q_DISABLE_COPY_MOVE(QDragManager)
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index bb0e490aa0..dcd0d13d5c 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -284,6 +284,7 @@ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions, Qt::DropAction defa
return d->executed_action;
}
+#if QT_DEPRECATED_SINCE(5, 13)
/*!
\obsolete
@@ -311,6 +312,7 @@ Qt::DropAction QDrag::start(Qt::DropActions request)
d->executed_action = QDragManager::self()->drag(this);
return d->executed_action;
}
+#endif
/*!
Sets the drag \a cursor for the \a action. This allows you
diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h
index 27b9c2c88f..7acd5088bd 100644
--- a/src/gui/kernel/qdrag.h
+++ b/src/gui/kernel/qdrag.h
@@ -74,7 +74,10 @@ public:
QObject *source() const;
QObject *target() const;
+#if QT_DEPRECATED_SINCE(5, 13)
+ QT_DEPRECATED_X("Use QDrag::exec() instead")
Qt::DropAction start(Qt::DropActions supportedActions = Qt::CopyAction);
+#endif
Qt::DropAction exec(Qt::DropActions supportedActions = Qt::MoveAction);
Qt::DropAction exec(Qt::DropActions supportedActions, Qt::DropAction defaultAction);
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 51cde72fa1..3c85dbe097 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -210,6 +210,8 @@ bool QGuiApplicationPrivate::obey_desktop_settings = true;
QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = 0;
+qreal QGuiApplicationPrivate::m_maxDevicePixelRatio = 0.0;
+
static qreal fontSmoothingGamma = 1.7;
extern void qRegisterGuiVariant();
@@ -1029,7 +1031,7 @@ QList<QScreen *> QGuiApplication::screens()
}
/*!
- Returns the screen at \a point, or \c nullptr if outside of any screen.
+ Returns the screen at \a point, or \nullptr if outside of any screen.
The \a point is in relation to the virtualGeometry() of each set of virtual
siblings. If the point maps to more than one set of virtual siblings the first
@@ -1101,17 +1103,19 @@ QScreen *QGuiApplication::screenAt(const QPoint &point)
*/
qreal QGuiApplication::devicePixelRatio() const
{
- // Cache topDevicePixelRatio, iterate through the screen list once only.
- static qreal topDevicePixelRatio = 0.0;
- if (!qFuzzyIsNull(topDevicePixelRatio)) {
- return topDevicePixelRatio;
- }
+ if (!qFuzzyIsNull(QGuiApplicationPrivate::m_maxDevicePixelRatio))
+ return QGuiApplicationPrivate::m_maxDevicePixelRatio;
- topDevicePixelRatio = 1.0; // make sure we never return 0.
+ QGuiApplicationPrivate::m_maxDevicePixelRatio = 1.0; // make sure we never return 0.
for (QScreen *screen : qAsConst(QGuiApplicationPrivate::screen_list))
- topDevicePixelRatio = qMax(topDevicePixelRatio, screen->devicePixelRatio());
+ QGuiApplicationPrivate::m_maxDevicePixelRatio = qMax(QGuiApplicationPrivate::m_maxDevicePixelRatio, screen->devicePixelRatio());
+
+ return QGuiApplicationPrivate::m_maxDevicePixelRatio;
+}
- return topDevicePixelRatio;
+void QGuiApplicationPrivate::resetCachedDevicePixelRatio()
+{
+ m_maxDevicePixelRatio = 0.0;
}
/*!
@@ -1176,7 +1180,7 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString
QStringList plugins = pluginNamesWithArguments.split(QLatin1Char(';'));
QStringList platformArguments;
QStringList availablePlugins = QPlatformIntegrationFactory::keys(platformPluginPath);
- for (auto pluginArgument : plugins) {
+ for (const auto &pluginArgument : plugins) {
// Split into platform name and arguments
QStringList arguments = pluginArgument.split(QLatin1Char(':'));
const QString name = arguments.takeFirst().toLower();
@@ -2188,8 +2192,6 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
#endif // QT_CONFIG(wheelevent)
}
-// Remember, Qt convention is: keyboard state is state *before*
-
void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e)
{
QWindow *window = e->window.data();
@@ -2428,9 +2430,9 @@ void QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePr
window->d_func()->resizeEventPending = false;
if (actualGeometry.width() != lastReportedGeometry.width())
- window->widthChanged(actualGeometry.width());
+ emit window->widthChanged(actualGeometry.width());
if (actualGeometry.height() != lastReportedGeometry.height())
- window->heightChanged(actualGeometry.height());
+ emit window->heightChanged(actualGeometry.height());
}
if (isMove) {
@@ -2439,9 +2441,9 @@ void QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePr
QGuiApplication::sendSpontaneousEvent(window, &e);
if (actualGeometry.x() != lastReportedGeometry.x())
- window->xChanged(actualGeometry.x());
+ emit window->xChanged(actualGeometry.x());
if (actualGeometry.y() != lastReportedGeometry.y())
- window->yChanged(actualGeometry.y());
+ emit window->yChanged(actualGeometry.y());
}
}
@@ -3009,6 +3011,8 @@ void QGuiApplicationPrivate::processScreenGeometryChange(QWindowSystemInterfaceP
for (QScreen* sibling : siblings)
emit sibling->virtualGeometryChanged(sibling->virtualGeometry());
}
+
+ resetCachedDevicePixelRatio();
}
void QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e)
@@ -3024,6 +3028,8 @@ void QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange(QWindowSystem
s->d_func()->logicalDpi = QDpi(e->dpiX, e->dpiY);
emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch());
+
+ resetCachedDevicePixelRatio();
}
void QGuiApplicationPrivate::processScreenRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e)
@@ -3079,41 +3085,8 @@ void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::E
/*! \internal
- This function updates an internal state to keep the source compatibility. Documentation of
- QGuiApplication::mouseButtons() states - "The current state is updated synchronously as
- the event queue is emptied of events that will spontaneously change the mouse state
- (QEvent::MouseButtonPress and QEvent::MouseButtonRelease events)". But internally we have
- been updating these state variables from various places to keep buttons returned by
- mouseButtons() in sync with the systems state. This is not the documented behavior.
-
- ### Qt6 - Remove QGuiApplication::mouseButtons()/keyboardModifiers() API? And here
- are the reasons:
-
- - It is an easy to misuse API by:
-
- a) Application developers: The only place where the values of this API can be trusted is
- when using within mouse handling callbacks. In these callbacks we work with the state
- that was provided directly by the windowing system. Anywhere else it might not reflect what
- user wrongly expects. We might not always receive a matching mouse release for a press event
- (e.g. When dismissing a popup window on X11. Or when dnd enter Qt application with mouse
- button down, we update mouse_buttons and then dnd leaves Qt application and does a drop
- somewhere else) and hence mouseButtons() will be out-of-sync from users perspective, see
- for example QTBUG-33161. BUT THIS IS NOT HOW THE API IS SUPPOSED TO BE USED. Since the only
- safe place to use this API is from mouse event handlers, we might as well deprecate it and
- pass down the button state if we are not already doing that everywhere where it matters.
-
- b) Qt framework developers:
-
- We see users complaining, we start adding hacks everywhere just to keep buttons in sync ;)
- There are corner cases that can not be solved and adding this kind of hacks is never ending
- task.
-
- - Real mouse events, tablet mouse events, etc: all go through QGuiApplication::processMouseEvent,
- and all share mouse_buttons. What if we want to support multiple mice in future? The API must
- go.
-
- - Motivation why this API is public is not clear. Could the same be achieved by a user by
- installing an event filter?
+ This function updates an internal state to keep the source compatibility.
+ ### Qt 6 - Won't need after QTBUG-73829
*/
static void updateMouseAndModifierButtonState(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
{
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 02dffef0fe..5ea72fa0f6 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -86,7 +86,7 @@ public:
#else
QGuiApplication(int &argc, char **argv, int = ApplicationFlags);
#endif
- virtual ~QGuiApplication();
+ ~QGuiApplication();
static void setApplicationDisplayName(const QString &name);
static QString applicationDisplayName();
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 482d45e5c3..714c72ac08 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -310,6 +310,8 @@ public:
static void setApplicationState(Qt::ApplicationState state, bool forcePropagate = false);
+ static void resetCachedDevicePixelRatio();
+
protected:
virtual void notifyThemeChanged();
virtual void sendApplicationPaletteChange(bool toAllWidgets = false, const char *className = nullptr);
@@ -330,6 +332,10 @@ private:
bool ownGlobalShareContext;
static QInputDeviceManager *m_inputDeviceManager;
+
+ // Cache the maximum device pixel ratio, to iterate through the screen list
+ // only the first time it's required, or when devices are added or removed.
+ static qreal m_maxDevicePixelRatio;
};
Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k);
diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h
index aeec7b7414..8364557020 100644
--- a/src/gui/kernel/qkeymapper_p.h
+++ b/src/gui/kernel/qkeymapper_p.h
@@ -76,7 +76,7 @@ public:
private:
friend QKeyMapperPrivate *qt_keymapper_private();
Q_DECLARE_PRIVATE(QKeyMapper)
- Q_DISABLE_COPY(QKeyMapper)
+ Q_DISABLE_COPY_MOVE(QKeyMapper)
};
struct KeyboardLayoutItem;
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index a428da8ca4..74bf6e6b47 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1221,10 +1221,12 @@ QString QKeySequence::encodeString(int key)
static inline void addKey(QString &str, const QString &theKey, QKeySequence::SequenceFormat format)
{
if (!str.isEmpty()) {
- if (format == QKeySequence::NativeText)
+ if (format == QKeySequence::NativeText) {
+ //: Key separator in shortcut string
str += QCoreApplication::translate("QShortcut", "+");
- else
+ } else {
str += QLatin1Char('+');
+ }
}
str += theKey;
diff --git a/src/gui/kernel/qoffscreensurface.h b/src/gui/kernel/qoffscreensurface.h
index 9d4839cb25..1b9e7c00ca 100644
--- a/src/gui/kernel/qoffscreensurface.h
+++ b/src/gui/kernel/qoffscreensurface.h
@@ -60,7 +60,7 @@ public:
// ### Qt 6: merge overloads
explicit QOffscreenSurface(QScreen *screen, QObject *parent);
explicit QOffscreenSurface(QScreen *screen = nullptr);
- virtual ~QOffscreenSurface();
+ ~QOffscreenSurface();
SurfaceType surfaceType() const override;
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index e8c64bdc01..3d9f1309c9 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -414,15 +414,14 @@ int QOpenGLContextPrivate::maxTextureSize()
/*!
Returns the last context which called makeCurrent in the current thread,
- or 0, if no context is current.
+ or \nullptr, if no context is current.
*/
QOpenGLContext* QOpenGLContext::currentContext()
{
QGuiGLThreadContext *threadContext = qwindow_context_storage()->localData();
- if (threadContext) {
+ if (threadContext)
return threadContext->context;
- }
- return 0;
+ return nullptr;
}
/*!
@@ -788,7 +787,7 @@ QOpenGLExtraFunctions *QOpenGLContext::extraFunctions() const
to the non-template function.
Note that requests for function objects of other versions or profiles can fail and
- in doing so will return a null pointer. Situations in which creation of the functions
+ in doing so will return \nullptr. Situations in which creation of the functions
object can fail are if the request cannot be satisfied due to asking for functions
that are not in the version or profile of this context. For example:
@@ -1233,7 +1232,8 @@ void QOpenGLContext::deleteQGLContext()
Returns the platform-specific handle for the OpenGL implementation that
is currently in use. (for example, a HMODULE on Windows)
- On platforms that do not use dynamic GL switch the return value is null.
+ On platforms that do not use dynamic GL switching, the return value
+ is \nullptr.
The library might be GL-only, meaning that windowing system interface
functions (for example EGL) may live in another, separate library.
@@ -1327,7 +1327,7 @@ bool QOpenGLContext::supportsThreadedOpenGL()
\since 5.5
Returns the application-wide shared OpenGL context, if present.
- Otherwise, returns a null pointer.
+ Otherwise, returns \nullptr.
This is useful if you need to upload OpenGL objects (buffers, textures,
etc.) before creating or showing a QOpenGLWidget or QQuickWidget.
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 4f2f951d61..2849d0c58e 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -97,7 +97,7 @@ private:
friend class QOpenGLContextGroupPrivate;
friend class QOpenGLMultiGroupSharedResource;
- Q_DISABLE_COPY(QOpenGLSharedResource)
+ Q_DISABLE_COPY_MOVE(QOpenGLSharedResource)
};
class Q_GUI_EXPORT QOpenGLSharedResourceGuard : public QOpenGLSharedResource
@@ -219,7 +219,7 @@ public:
requestedFormat = QSurfaceFormat::defaultFormat();
}
- virtual ~QOpenGLContextPrivate()
+ ~QOpenGLContextPrivate()
{
//do not delete the QOpenGLContext handle here as it is deleted in
//QWidgetPrivate::deleteTLSysExtra()
diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp
index 8b052d92ae..022a47c919 100644
--- a/src/gui/kernel/qopenglwindow.cpp
+++ b/src/gui/kernel/qopenglwindow.cpp
@@ -440,7 +440,7 @@ void QOpenGLWindow::makeCurrent()
d->context->makeCurrent(this);
} else {
if (!d->offscreenSurface) {
- d->offscreenSurface.reset(new QOffscreenSurface);
+ d->offscreenSurface.reset(new QOffscreenSurface(screen()));
d->offscreenSurface->setFormat(d->context->format());
d->offscreenSurface->create();
}
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index c6805dd4e6..193fd9590d 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -941,7 +941,8 @@ qint64 QPalette::cacheKey() const
}
/*!
- Returns a new QPalette that has attributes copied from \a other.
+ Returns a new QPalette that is a union of this instance and \a other.
+ Color roles set in this instance take precedence.
*/
QPalette QPalette::resolve(const QPalette &other) const
{
@@ -959,6 +960,7 @@ QPalette QPalette::resolve(const QPalette &other) const
if (!(data.resolve_mask & (1<<role)))
for(int grp = 0; grp < (int)NColorGroups; grp++)
palette.d->br[grp][role] = other.d->br[grp][role];
+ palette.data.resolve_mask |= other.data.resolve_mask;
return palette;
}
@@ -981,7 +983,7 @@ QPalette QPalette::resolve(const QPalette &other) const
#ifndef QT_NO_DATASTREAM
static const int NumOldRoles = 7;
-static const int oldRoles[7] = { QPalette::Foreground, QPalette::Background, QPalette::Light,
+static const int oldRoles[7] = { QPalette::WindowText, QPalette::Window, QPalette::Light,
QPalette::Dark, QPalette::Mid, QPalette::Text, QPalette::Base };
/*!
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index 071eddbc4d..e931e01480 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -98,7 +98,10 @@ public:
ToolTipBase, ToolTipText,
PlaceholderText,
NColorRoles = PlaceholderText + 1,
- Foreground = WindowText, Background = Window
+#if QT_DEPRECATED_SINCE(5, 13)
+ Foreground Q_DECL_ENUMERATOR_DEPRECATED_X("Use QPalette::WindowText instead") = WindowText,
+ Background Q_DECL_ENUMERATOR_DEPRECATED_X("Use QPalette::Window instead") = Window
+#endif
};
Q_ENUM(ColorRole)
@@ -121,7 +124,6 @@ public:
inline const QColor &color(ColorRole cr) const { return color(Current, cr); }
inline const QBrush &brush(ColorRole cr) const { return brush(Current, cr); }
- inline const QBrush &foreground() const { return brush(WindowText); }
inline const QBrush &windowText() const { return brush(WindowText); }
inline const QBrush &button() const { return brush(Button); }
inline const QBrush &light() const { return brush(Light); }
@@ -132,7 +134,6 @@ public:
inline const QBrush &alternateBase() const { return brush(AlternateBase); }
inline const QBrush &toolTipBase() const { return brush(ToolTipBase); }
inline const QBrush &toolTipText() const { return brush(ToolTipText); }
- inline const QBrush &background() const { return brush(Window); }
inline const QBrush &window() const { return brush(Window); }
inline const QBrush &midlight() const { return brush(Midlight); }
inline const QBrush &brightText() const { return brush(BrightText); }
@@ -143,6 +144,12 @@ public:
inline const QBrush &link() const { return brush(Link); }
inline const QBrush &linkVisited() const { return brush(LinkVisited); }
inline const QBrush &placeholderText() const { return brush(PlaceholderText); }
+#if QT_DEPRECATED_SINCE(5, 13)
+ QT_DEPRECATED_X("Use QPalette::windowText() instead")
+ inline const QBrush &foreground() const { return windowText(); }
+ QT_DEPRECATED_X("Use QPalette::window() instead")
+ inline const QBrush &background() const { return window(); }
+#endif
bool operator==(const QPalette &p) const;
inline bool operator!=(const QPalette &p) const { return !(operator==(p)); }
diff --git a/src/gui/kernel/qplatformclipboard.h b/src/gui/kernel/qplatformclipboard.h
index 60733b0a9f..3220201720 100644
--- a/src/gui/kernel/qplatformclipboard.h
+++ b/src/gui/kernel/qplatformclipboard.h
@@ -61,6 +61,9 @@ QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QPlatformClipboard
{
public:
+ Q_DISABLE_COPY_MOVE(QPlatformClipboard)
+
+ QPlatformClipboard() = default;
virtual ~QPlatformClipboard();
virtual QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard);
diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp
index 76e38ab12d..49eff2ad23 100644
--- a/src/gui/kernel/qplatformcursor.cpp
+++ b/src/gui/kernel/qplatformcursor.cpp
@@ -89,7 +89,7 @@ QT_BEGIN_NAMESPACE
set or the system default cursor should take effect.
\a window is a pointer to the window currently displayed at QCursor::pos(). Note
- that this may be 0 if the current position is not occupied by a displayed widget.
+ that this may be \nullptr if the current position is not occupied by a displayed widget.
\sa QCursor::pos()
*/
diff --git a/src/gui/kernel/qplatformcursor.h b/src/gui/kernel/qplatformcursor.h
index 40e8a562f8..f36a73c861 100644
--- a/src/gui/kernel/qplatformcursor.h
+++ b/src/gui/kernel/qplatformcursor.h
@@ -78,6 +78,8 @@ private:
class Q_GUI_EXPORT QPlatformCursor : public QObject {
public:
+ Q_DISABLE_COPY_MOVE(QPlatformCursor)
+
enum Capability {
OverrideCursor = 0x1
};
diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp
index 628ad06478..d14d575056 100644
--- a/src/gui/kernel/qplatformdialoghelper.cpp
+++ b/src/gui/kernel/qplatformdialoghelper.cpp
@@ -41,6 +41,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QVariant>
+#include <QtCore/QRegularExpression>
#include <QtCore/QSharedData>
#if QT_CONFIG(settings)
#include <QtCore/QSettings>
@@ -63,6 +64,18 @@ QT_BEGIN_NAMESPACE
*/
+/*!
+ \enum QPlatformDialogHelper::StyleHint
+
+ This enum type specifies platform-specific style hints.
+
+ \value DialogIsQtWindow Indicates that a platform-specific dialog is implemented
+ as in-process Qt window. It allows to prevent blocking the
+ dialog by an invisible proxy Qt dialog.
+
+ \sa styleHint()
+*/
+
static const int buttonRoleLayouts[2][6][14] =
{
// Qt::Horizontal
@@ -767,18 +780,19 @@ void QPlatformFileDialogHelper::setOptions(const QSharedPointer<QFileDialogOptio
m_options = options;
}
-const char *QPlatformFileDialogHelper::filterRegExp =
+const char QPlatformFileDialogHelper::filterRegExp[] =
"^(.*)\\(([a-zA-Z0-9_.,*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$";
// Makes a list of filters from a normal filter string "Image Files (*.png *.jpg)"
QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter)
{
- QRegExp regexp(QString::fromLatin1(filterRegExp));
+ QRegularExpression regexp(QString::fromLatin1(filterRegExp));
Q_ASSERT(regexp.isValid());
QString f = filter;
- int i = regexp.indexIn(f);
- if (i >= 0)
- f = regexp.cap(2);
+ QRegularExpressionMatch match;
+ filter.indexOf(regexp, 0, &match);
+ if (match.hasMatch())
+ f = match.captured(2);
return f.split(QLatin1Char(' '), QString::SkipEmptyParts);
}
diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h
index bfcb658172..f09bec12da 100644
--- a/src/gui/kernel/qplatformdialoghelper.h
+++ b/src/gui/kernel/qplatformdialoghelper.h
@@ -80,6 +80,7 @@ class Q_GUI_EXPORT QPlatformDialogHelper : public QObject
Q_OBJECT
public:
enum StyleHint {
+ DialogIsQtWindow
};
enum DialogCode { Rejected, Accepted };
@@ -153,7 +154,7 @@ public:
Q_ENUM(ButtonLayout)
QPlatformDialogHelper();
- virtual ~QPlatformDialogHelper();
+ ~QPlatformDialogHelper();
virtual QVariant styleHint(StyleHint hint) const;
@@ -413,7 +414,7 @@ public:
void setOptions(const QSharedPointer<QFileDialogOptions> &options);
static QStringList cleanFilterList(const QString &filter);
- static const char *filterRegExp;
+ static const char filterRegExp[];
Q_SIGNALS:
void fileSelected(const QUrl &file);
diff --git a/src/gui/kernel/qplatformdrag.h b/src/gui/kernel/qplatformdrag.h
index 9d4e352b4b..0c99539357 100644
--- a/src/gui/kernel/qplatformdrag.h
+++ b/src/gui/kernel/qplatformdrag.h
@@ -91,6 +91,8 @@ class Q_GUI_EXPORT QPlatformDrag
{
Q_DECLARE_PRIVATE(QPlatformDrag)
public:
+ Q_DISABLE_COPY_MOVE(QPlatformDrag)
+
QPlatformDrag();
virtual ~QPlatformDrag();
@@ -108,8 +110,6 @@ public:
private:
QPlatformDragPrivate *d_ptr;
-
- Q_DISABLE_COPY(QPlatformDrag)
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformgraphicsbuffer.cpp b/src/gui/kernel/qplatformgraphicsbuffer.cpp
index d361a8fc12..73ec033e19 100644
--- a/src/gui/kernel/qplatformgraphicsbuffer.cpp
+++ b/src/gui/kernel/qplatformgraphicsbuffer.cpp
@@ -184,7 +184,7 @@ void QPlatformGraphicsBuffer::unlock()
\fn QPlatformGraphicsBuffer::doLock(AccessTypes access, const QRect &rect = QRect())
This function should be reimplemented by subclasses. If one of the \a
- access types specified can not be locked, then all should fail and this
+ access types specified cannot be locked, then all should fail and this
function should return false.
\a rect is the subrect which is desired to be locked. This
diff --git a/src/gui/kernel/qplatformgraphicsbuffer.h b/src/gui/kernel/qplatformgraphicsbuffer.h
index 11566e1201..9004116ea4 100644
--- a/src/gui/kernel/qplatformgraphicsbuffer.h
+++ b/src/gui/kernel/qplatformgraphicsbuffer.h
@@ -80,7 +80,7 @@ public:
};
Q_ENUM(Origin);
- virtual ~QPlatformGraphicsBuffer();
+ ~QPlatformGraphicsBuffer();
AccessTypes isLocked() const { return m_lock_access; }
bool lock(AccessTypes access, const QRect &rect = QRect());
diff --git a/src/gui/kernel/qplatforminputcontext.h b/src/gui/kernel/qplatforminputcontext.h
index 26d40cd2c6..ad0e5bcf35 100644
--- a/src/gui/kernel/qplatforminputcontext.h
+++ b/src/gui/kernel/qplatforminputcontext.h
@@ -67,7 +67,7 @@ public:
};
QPlatformInputContext();
- virtual ~QPlatformInputContext();
+ ~QPlatformInputContext();
virtual bool isValid() const;
virtual bool hasCapability(Capability capability) const;
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 258d214c7a..b3d3db0751 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -294,7 +294,7 @@ QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::Pix
platform implementation is responsible for querying the configuriation from the provided
native context.
- Returns a pointer to a QPlatformOpenGLContext instance or \c NULL if the context could
+ Returns a pointer to a QPlatformOpenGLContext instance or \nullptr if the context could
not be created.
\sa QOpenGLContext
@@ -465,42 +465,6 @@ QList<int> QPlatformIntegration::possibleKeys(const QKeyEvent *) const
return QList<int>();
}
-/*!
- \deprecated Use QWindowSystemInterface::handleScreenAdded instead.
-*/
-void QPlatformIntegration::screenAdded(QPlatformScreen *ps, bool isPrimary)
-{
- QWindowSystemInterface::handleScreenAdded(ps, isPrimary);
-}
-
-/*!
- \deprecated Use QWindowSystemInterface::handleScreenRemoved instead.
-*/
-void QPlatformIntegration::removeScreen(QScreen *screen)
-{
- const bool wasPrimary = (!QGuiApplicationPrivate::screen_list.isEmpty() && QGuiApplicationPrivate::screen_list.at(0) == screen);
- QGuiApplicationPrivate::screen_list.removeOne(screen);
-
- if (wasPrimary && qGuiApp && !QGuiApplicationPrivate::screen_list.isEmpty())
- emit qGuiApp->primaryScreenChanged(QGuiApplicationPrivate::screen_list.at(0));
-}
-
-/*!
- \deprecated Use QWindowSystemInterface::handleScreenRemoved instead.
-*/
-void QPlatformIntegration::destroyScreen(QPlatformScreen *platformScreen)
-{
- QWindowSystemInterface::handleScreenRemoved(platformScreen);
-}
-
-/*!
- \deprecated Use QWindowSystemInterface::handlePrimaryScreenChanged instead.
-*/
-void QPlatformIntegration::setPrimaryScreen(QPlatformScreen *newPrimary)
-{
- QWindowSystemInterface::handlePrimaryScreenChanged(newPrimary);
-}
-
QStringList QPlatformIntegration::themeNames() const
{
return QStringList();
@@ -605,7 +569,7 @@ void QPlatformIntegration::setApplicationIcon(const QIcon &icon) const
pointer to the instance for which a platform-specific backend needs to be
created.
- Returns a pointer to a QPlatformOpenGLContext instance or \c NULL if the context could
+ Returns a pointer to a QPlatformOpenGLContext instance or \nullptr if the context could
not be created.
\sa QVulkanInstance
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index 0b999de264..a3594042ce 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -84,6 +84,8 @@ class QVulkanInstance;
class Q_GUI_EXPORT QPlatformIntegration
{
public:
+ Q_DISABLE_COPY_MOVE(QPlatformIntegration)
+
enum Capability {
ThreadedPixmaps = 1,
OpenGL,
@@ -191,10 +193,6 @@ public:
#endif
virtual void setApplicationIcon(const QIcon &icon) const;
-#if QT_DEPRECATED_SINCE(5, 12)
- QT_DEPRECATED_X("Use QWindowSystemInterface::handleScreenRemoved") void removeScreen(QScreen *screen);
-#endif
-
virtual void beep() const;
#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
@@ -202,11 +200,7 @@ public:
#endif
protected:
-#if QT_DEPRECATED_SINCE(5, 12)
- QT_DEPRECATED_X("Use QWindowSystemInterface::handleScreenAdded") void screenAdded(QPlatformScreen *screen, bool isPrimary = false);
- QT_DEPRECATED_X("Use QWindowSystemInterface::handleScreenRemoved") void destroyScreen(QPlatformScreen *screen);
- QT_DEPRECATED_X("Use QWindowSystemInterface::handlePrimaryScreenChanged") void setPrimaryScreen(QPlatformScreen *newPrimary);
-#endif
+ QPlatformIntegration() = default;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp
index 21ae75ba8f..9c5876550a 100644
--- a/src/gui/kernel/qplatformscreen.cpp
+++ b/src/gui/kernel/qplatformscreen.cpp
@@ -62,10 +62,6 @@ QPlatformScreen::~QPlatformScreen()
Q_D(QPlatformScreen);
if (d->screen) {
qWarning("Manually deleting a QPlatformScreen. Call QWindowSystemInterface::handleScreenRemoved instead.");
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- QGuiApplicationPrivate::platformIntegration()->removeScreen(d->screen);
-QT_WARNING_POP
delete d->screen;
}
}
diff --git a/src/gui/kernel/qplatformscreen.h b/src/gui/kernel/qplatformscreen.h
index e9d64c8a29..b9ecc80320 100644
--- a/src/gui/kernel/qplatformscreen.h
+++ b/src/gui/kernel/qplatformscreen.h
@@ -80,6 +80,8 @@ class Q_GUI_EXPORT QPlatformScreen
Q_DECLARE_PRIVATE(QPlatformScreen)
public:
+ Q_DISABLE_COPY_MOVE(QPlatformScreen)
+
enum SubpixelAntialiasingType { // copied from qfontengine_p.h since we can't include private headers
Subpixel_None,
Subpixel_RGB,
@@ -164,8 +166,6 @@ protected:
QScopedPointer<QPlatformScreenPrivate> d_ptr;
private:
- Q_DISABLE_COPY(QPlatformScreen)
-
friend class QScreenPrivate;
};
diff --git a/src/gui/kernel/qplatformservices.h b/src/gui/kernel/qplatformservices.h
index 339bbfde3f..5de96cfa7d 100644
--- a/src/gui/kernel/qplatformservices.h
+++ b/src/gui/kernel/qplatformservices.h
@@ -58,6 +58,8 @@ class QUrl;
class Q_GUI_EXPORT QPlatformServices
{
public:
+ Q_DISABLE_COPY_MOVE(QPlatformServices)
+
QPlatformServices();
virtual ~QPlatformServices() { }
diff --git a/src/gui/kernel/qplatformsessionmanager.h b/src/gui/kernel/qplatformsessionmanager.h
index ca7cab389b..c6c3984816 100644
--- a/src/gui/kernel/qplatformsessionmanager.h
+++ b/src/gui/kernel/qplatformsessionmanager.h
@@ -64,6 +64,8 @@ QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QPlatformSessionManager
{
public:
+ Q_DISABLE_COPY_MOVE(QPlatformSessionManager)
+
explicit QPlatformSessionManager(const QString &id, const QString &key);
virtual ~QPlatformSessionManager();
@@ -101,8 +103,6 @@ private:
QStringList m_restartCommand;
QStringList m_discardCommand;
QSessionManager::RestartHint m_restartHint;
-
- Q_DISABLE_COPY(QPlatformSessionManager)
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformsurface.h b/src/gui/kernel/qplatformsurface.h
index 4d8854fb40..475f3ef330 100644
--- a/src/gui/kernel/qplatformsurface.h
+++ b/src/gui/kernel/qplatformsurface.h
@@ -65,6 +65,8 @@ class QDebug;
class Q_GUI_EXPORT QPlatformSurface
{
public:
+ Q_DISABLE_COPY_MOVE(QPlatformSurface)
+
virtual ~QPlatformSurface();
virtual QSurfaceFormat format() const = 0;
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index 1d6049a98d..54c8c70025 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -76,6 +76,8 @@ class Q_GUI_EXPORT QPlatformTheme
{
Q_DECLARE_PRIVATE(QPlatformTheme)
public:
+ Q_DISABLE_COPY_MOVE(QPlatformTheme)
+
enum ThemeHint {
CursorFlashTime,
KeyboardInputInterval,
@@ -324,8 +326,6 @@ public:
protected:
explicit QPlatformTheme(QPlatformThemePrivate *priv);
QScopedPointer<QPlatformThemePrivate> d_ptr;
-private:
- Q_DISABLE_COPY(QPlatformTheme)
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 835c04a5df..4e95751397 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -90,11 +90,11 @@ QWindow *QPlatformWindow::window() const
}
/*!
- Returns the parent platform window (or 0 if orphan).
+ Returns the parent platform window (or \nullptr if orphan).
*/
QPlatformWindow *QPlatformWindow::parent() const
{
- return window()->parent() ? window()->parent()->handle() : 0;
+ return window()->parent() ? window()->parent()->handle() : nullptr;
}
/*!
diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h
index 075ac0f82b..4d48cc2f13 100644
--- a/src/gui/kernel/qplatformwindow.h
+++ b/src/gui/kernel/qplatformwindow.h
@@ -71,6 +71,8 @@ class Q_GUI_EXPORT QPlatformWindow : public QPlatformSurface
{
Q_DECLARE_PRIVATE(QPlatformWindow)
public:
+ Q_DISABLE_COPY_MOVE(QPlatformWindow)
+
explicit QPlatformWindow(QWindow *window);
~QPlatformWindow() override;
@@ -164,8 +166,6 @@ protected:
static QSize constrainWindowSize(const QSize &size);
QScopedPointer<QPlatformWindowPrivate> d_ptr;
-private:
- Q_DISABLE_COPY(QPlatformWindow)
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index f208eb02be..952023dd1b 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -106,9 +106,18 @@ void QScreenPrivate::setPlatformScreen(QPlatformScreen *screen)
*/
QScreen::~QScreen()
{
- if (!qApp)
+ // Remove screen
+ const bool wasPrimary = QGuiApplication::primaryScreen() == this;
+ QGuiApplicationPrivate::screen_list.removeOne(this);
+ QGuiApplicationPrivate::resetCachedDevicePixelRatio();
+
+ if (!qGuiApp)
return;
+ QScreen *newPrimaryScreen = QGuiApplication::primaryScreen();
+ if (wasPrimary && newPrimaryScreen)
+ emit qGuiApp->primaryScreenChanged(newPrimaryScreen);
+
// Allow clients to manage windows that are affected by the screen going
// away, before we fall back to moving them to the primary screen.
emit qApp->screenRemoved(this);
@@ -116,11 +125,8 @@ QScreen::~QScreen()
if (QGuiApplication::closingDown())
return;
- QScreen *primaryScreen = QGuiApplication::primaryScreen();
- if (this == primaryScreen)
- return;
-
- bool movingFromVirtualSibling = primaryScreen && primaryScreen->handle()->virtualSiblings().contains(handle());
+ bool movingFromVirtualSibling = newPrimaryScreen
+ && newPrimaryScreen->handle()->virtualSiblings().contains(handle());
// Move any leftover windows to the primary screen
const auto allWindows = QGuiApplication::allWindows();
@@ -129,7 +135,7 @@ QScreen::~QScreen()
continue;
const bool wasVisible = window->isVisible();
- window->setScreen(primaryScreen);
+ window->setScreen(newPrimaryScreen);
// Re-show window if moved from a virtual sibling screen. Otherwise
// leave it up to the application developer to show the window.
diff --git a/src/gui/kernel/qsessionmanager_p.h b/src/gui/kernel/qsessionmanager_p.h
index 954443430e..d07d9b5eb8 100644
--- a/src/gui/kernel/qsessionmanager_p.h
+++ b/src/gui/kernel/qsessionmanager_p.h
@@ -69,7 +69,7 @@ public:
QSessionManagerPrivate(const QString &id,
const QString &key);
- virtual ~QSessionManagerPrivate();
+ ~QSessionManagerPrivate();
QPlatformSessionManager *platformSessionManager;
};
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index 3bb42c1c0b..0395c1db38 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -175,7 +175,7 @@ int QShortcutMap::addShortcut(QObject *owner, const QKeySequence &key, Qt::Short
/*! \internal
Removes a shortcut from the global map.
- If \a owner is 0, all entries in the map with the key sequence specified
+ If \a owner is \nullptr, all entries in the map with the key sequence specified
is removed. If \a key is null, all sequences for \a owner is removed from
the map. If \a id is 0, any identical \a key sequences owned by \a owner
are removed.
@@ -222,7 +222,7 @@ int QShortcutMap::removeShortcut(int id, QObject *owner, const QKeySequence &key
/*! \internal
Changes the enable state of a shortcut to \a enable.
- If \a owner is 0, all entries in the map with the key sequence specified
+ If \a owner is \nullptr, all entries in the map with the key sequence specified
is removed. If \a key is null, all sequences for \a owner is removed from
the map. If \a id is 0, any identical \a key sequences owned by \a owner
are changed.
@@ -260,7 +260,7 @@ int QShortcutMap::setShortcutEnabled(bool enable, int id, QObject *owner, const
/*! \internal
Changes the auto repeat state of a shortcut to \a enable.
- If \a owner is 0, all entries in the map with the key sequence specified
+ If \a owner is \nullptr, all entries in the map with the key sequence specified
is removed. If \a key is null, all sequences for \a owner is removed from
the map. If \a id is 0, any identical \a key sequences owned by \a owner
are changed.
diff --git a/src/gui/kernel/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h
index f9e8a83a39..8638b05155 100644
--- a/src/gui/kernel/qsimpledrag_p.h
+++ b/src/gui/kernel/qsimpledrag_p.h
@@ -71,7 +71,7 @@ class QScreen;
class Q_GUI_EXPORT QBasicDrag : public QPlatformDrag, public QObject
{
public:
- virtual ~QBasicDrag();
+ ~QBasicDrag();
virtual Qt::DropAction drag(QDrag *drag) override;
void cancelDrag() override;
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index 48060a2c37..9b5b7a6f1e 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -69,29 +69,17 @@ class QStyleHintsPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QStyleHints)
public:
- inline QStyleHintsPrivate()
- : m_mouseDoubleClickInterval(-1)
- , m_mousePressAndHoldInterval(-1)
- , m_startDragDistance(-1)
- , m_startDragTime(-1)
- , m_keyboardInputInterval(-1)
- , m_cursorFlashTime(-1)
- , m_tabFocusBehavior(-1)
- , m_uiEffects(-1)
- , m_wheelScrollLines(-1)
- , m_mouseQuickSelectionThreshold(-1)
- {}
-
- int m_mouseDoubleClickInterval;
- int m_mousePressAndHoldInterval;
- int m_startDragDistance;
- int m_startDragTime;
- int m_keyboardInputInterval;
- int m_cursorFlashTime;
- int m_tabFocusBehavior;
- int m_uiEffects;
- int m_wheelScrollLines;
- int m_mouseQuickSelectionThreshold;
+ int m_mouseDoubleClickInterval = -1;
+ int m_mousePressAndHoldInterval = -1;
+ int m_startDragDistance = -1;
+ int m_startDragTime = -1;
+ int m_keyboardInputInterval = -1;
+ int m_cursorFlashTime = -1;
+ int m_tabFocusBehavior = -1;
+ int m_uiEffects = -1;
+ int m_showShortcutsInContextMenus = -1;
+ int m_wheelScrollLines = -1;
+ int m_mouseQuickSelectionThreshold = -1;
};
/*!
@@ -371,10 +359,25 @@ bool QStyleHints::showIsMaximized() const
\since 5.10
\brief \c true if the platform normally shows shortcut key sequences in
context menus, otherwise \c false.
+
+ Since Qt 5.13, the setShowShortcutsInContextMenus() function can be used to
+ override the platform default.
*/
bool QStyleHints::showShortcutsInContextMenus() const
{
- return themeableHint(QPlatformTheme::ShowShortcutsInContextMenus, QPlatformIntegration::ShowShortcutsInContextMenus).toBool();
+ Q_D(const QStyleHints);
+ return d->m_showShortcutsInContextMenus >= 0
+ ? d->m_showShortcutsInContextMenus != 0
+ : themeableHint(QPlatformTheme::ShowShortcutsInContextMenus, QPlatformIntegration::ShowShortcutsInContextMenus).toBool();
+}
+
+void QStyleHints::setShowShortcutsInContextMenus(bool s)
+{
+ Q_D(QStyleHints);
+ if (s != showShortcutsInContextMenus()) {
+ d->m_showShortcutsInContextMenus = s ? 1 : 0;
+ emit showShortcutsInContextMenusChanged(s);
+ }
}
/*!
diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h
index 7b0683e9b1..9091db9624 100644
--- a/src/gui/kernel/qstylehints.h
+++ b/src/gui/kernel/qstylehints.h
@@ -64,7 +64,7 @@ class Q_GUI_EXPORT QStyleHints : public QObject
Q_PROPERTY(bool setFocusOnTouchRelease READ setFocusOnTouchRelease STORED false CONSTANT FINAL)
Q_PROPERTY(bool showIsFullScreen READ showIsFullScreen STORED false CONSTANT FINAL)
Q_PROPERTY(bool showIsMaximized READ showIsMaximized STORED false CONSTANT FINAL)
- Q_PROPERTY(bool showShortcutsInContextMenus READ showShortcutsInContextMenus STORED false CONSTANT FINAL)
+ Q_PROPERTY(bool showShortcutsInContextMenus READ showShortcutsInContextMenus WRITE setShowShortcutsInContextMenus NOTIFY showShortcutsInContextMenusChanged FINAL)
Q_PROPERTY(int startDragDistance READ startDragDistance NOTIFY startDragDistanceChanged FINAL)
Q_PROPERTY(int startDragTime READ startDragTime NOTIFY startDragTimeChanged FINAL)
Q_PROPERTY(int startDragVelocity READ startDragVelocity STORED false CONSTANT FINAL)
@@ -93,6 +93,7 @@ public:
bool showIsFullScreen() const;
bool showIsMaximized() const;
bool showShortcutsInContextMenus() const;
+ void setShowShortcutsInContextMenus(bool showShortcutsInContextMenus);
int passwordMaskDelay() const;
QChar passwordMaskCharacter() const;
qreal fontSmoothingGamma() const;
@@ -117,6 +118,7 @@ Q_SIGNALS:
void startDragTimeChanged(int startDragTime);
void tabFocusBehaviorChanged(Qt::TabFocusBehavior tabFocusBehavior);
void useHoverEffectsChanged(bool useHoverEffects);
+ void showShortcutsInContextMenusChanged(bool);
void wheelScrollLinesChanged(int scrollLines);
void mouseQuickSelectionThresholdChanged(int threshold);
diff --git a/src/gui/kernel/qt_gui_pch.h b/src/gui/kernel/qt_gui_pch.h
index aa5d3f0572..5e07fa45e7 100644
--- a/src/gui/kernel/qt_gui_pch.h
+++ b/src/gui/kernel/qt_gui_pch.h
@@ -45,37 +45,20 @@
* UNSUPPORTED.
*/
-// from corelib/global/qt_pch.h
+#include "../../corelib/global/qt_pch.h"
+
#if defined __cplusplus
#include <qtguiglobal.h>
-
-
-#ifdef Q_OS_WIN
-# define _POSIX_
-# include <limits.h>
-# undef _POSIX_
-#endif
-
-#include <qcoreapplication.h>
-#include <qlist.h>
-#include <qvariant.h> // All moc genereated code has this include
-#include <qobject.h>
-#include <qregexp.h>
-#include <qstring.h>
-#include <qstringlist.h>
-#if QT_CONFIG(textcodec)
-#include <qtextcodec.h>
-#endif
-
#include <qguiapplication.h>
#include <qbitmap.h>
+#include <qclipboard.h>
#include <qcursor.h>
#include <qevent.h>
+#include <qfont.h>
#include <qimage.h>
#include <qpainter.h>
#include <qpixmap.h>
-#include <qtimer.h>
-
-#include <stdlib.h>
-
+#include <qscreen.h>
+#include <qsurface.h>
+#include <qwindow.h>
#endif
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index a19df4da0f..ed516c0eed 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -166,7 +166,7 @@ QWindow::QWindow(QScreen *targetScreen)
static QWindow *nonDesktopParent(QWindow *parent)
{
if (parent && parent->type() == Qt::Desktop) {
- qWarning("QWindows can not be reparented into desktop windows");
+ qWarning("QWindows cannot be reparented into desktop windows");
return nullptr;
}
@@ -694,7 +694,8 @@ QWindow *QWindow::parent() const
Sets the \a parent Window. This will lead to the windowing system managing
the clip of the window, so it will be clipped to the \a parent window.
- Setting \a parent to be 0 will make the window become a top level window.
+ Setting \a parent to be \nullptr will make the window become a top level
+ window.
If \a parent is a window created by fromWinId(), then the current window
will be embedded inside \a parent, if the platform supports it.
@@ -1336,16 +1337,18 @@ Qt::WindowStates QWindow::windowStates() const
*/
/*!
- Sets the transient \a parent
+ \property QWindow::transientParent
+ \brief the window for which this window is a transient pop-up
+ \since 5.13
This is a hint to the window manager that this window is a dialog or pop-up
- on behalf of the given window.
+ on behalf of the transient parent.
In order to cause the window to be centered above its transient parent by
default, depending on the window manager, it may also be necessary to call
setFlags() with a suitable \l Qt::WindowType (such as \c Qt::Dialog).
- \sa transientParent(), parent()
+ \sa parent()
*/
void QWindow::setTransientParent(QWindow *parent)
{
@@ -1355,26 +1358,35 @@ void QWindow::setTransientParent(QWindow *parent)
return;
}
if (parent == this) {
- qWarning() << "transient parent" << parent << "can not be same as window";
+ qWarning() << "transient parent" << parent << "cannot be same as window";
return;
}
d->transientParent = parent;
QGuiApplicationPrivate::updateBlockedStatus(this);
+ emit transientParentChanged(parent);
}
-/*!
- Returns the transient parent of the window.
-
- \sa setTransientParent(), parent()
-*/
QWindow *QWindow::transientParent() const
{
Q_D(const QWindow);
return d->transientParent.data();
}
+/*
+ The setter for the QWindow::transientParent property.
+ The only reason this exists is to set the transientParentPropertySet flag
+ so that Qt Quick knows whether it was set programmatically (because of
+ Window declaration context) or because the user set the property.
+*/
+void QWindowPrivate::setTransientParent(QWindow *parent)
+{
+ Q_Q(QWindow);
+ q->setTransientParent(parent);
+ transientParentPropertySet = true;
+}
+
/*!
\enum QWindow::AncestorMode
@@ -2864,7 +2876,7 @@ void QWindow::setVulkanInstance(QVulkanInstance *instance)
}
/*!
- \return the associated Vulkan instance or \c null if there is none.
+ \return the associated Vulkan instance if any was set, otherwise \nullptr.
*/
QVulkanInstance *QWindow::vulkanInstance() const
{
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 439e62d0bd..1be3c845fe 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -123,6 +123,7 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged REVISION 1)
Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged)
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged REVISION 1)
+ Q_PRIVATE_PROPERTY(QWindow::d_func(), QWindow* transientParent MEMBER transientParent WRITE setTransientParent NOTIFY transientParentChanged REVISION 13)
public:
enum Visibility {
@@ -143,7 +144,7 @@ public:
explicit QWindow(QScreen *screen = nullptr);
explicit QWindow(QWindow *parent);
- virtual ~QWindow();
+ ~QWindow();
void setSurfaceType(SurfaceType surfaceType);
SurfaceType surfaceType() const override;
@@ -336,6 +337,8 @@ Q_SIGNALS:
Q_REVISION(1) void opacityChanged(qreal opacity);
+ Q_REVISION(13) void transientParentChanged(QWindow *transientParent);
+
protected:
virtual void exposeEvent(QExposeEvent *);
virtual void resizeEvent(QResizeEvent *);
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 745890f63f..5367d93e84 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -149,6 +149,7 @@ public:
void disconnectFromScreen();
void emitScreenChangedRecursion(QScreen *newScreen);
QScreen *screenForGeometry(const QRect &rect) const;
+ void setTransientParent(QWindow *parent);
virtual void clearFocusObject();
virtual QRectF closestAcceptableGeometry(const QRectF &rect) const;
@@ -199,6 +200,7 @@ public:
bool blockedByModalWindow;
bool updateRequestPending;
+ bool transientParentPropertySet = false;
QPointer<QWindow> transientParent;
QPointer<QScreen> topLevelScreen;
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index b0f2869128..759671fbd7 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -800,6 +800,8 @@ void QWindowSystemInterface::handleScreenAdded(QPlatformScreen *ps, bool isPrima
else
QGuiApplicationPrivate::screen_list.append(screen);
+ QGuiApplicationPrivate::resetCachedDevicePixelRatio();
+
emit qGuiApp->screenAdded(screen);
if (isPrimary)
@@ -816,11 +818,6 @@ void QWindowSystemInterface::handleScreenAdded(QPlatformScreen *ps, bool isPrima
*/
void QWindowSystemInterface::handleScreenRemoved(QPlatformScreen *platformScreen)
{
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- QGuiApplicationPrivate::platformIntegration()->removeScreen(platformScreen->screen());
-QT_WARNING_POP
-
// Important to keep this order since the QSceen doesn't own the platform screen
delete platformScreen->screen();
delete platformScreen;
@@ -840,7 +837,7 @@ void QWindowSystemInterface::handlePrimaryScreenChanged(QPlatformScreen *newPrim
if (indexOfScreen == 0)
return;
- QGuiApplicationPrivate::screen_list.swap(0, indexOfScreen);
+ QGuiApplicationPrivate::screen_list.swapItemsAt(0, indexOfScreen);
emit qGuiApp->primaryScreenChanged(newPrimaryScreen);
}
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index cea02fb8b7..6c818a9030 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -508,7 +508,7 @@ public:
}
}
private:
- Q_DISABLE_COPY(WindowSystemEventList)
+ Q_DISABLE_COPY_MOVE(WindowSystemEventList)
};
static WindowSystemEventList windowSystemEventQueue;