summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorSergio Ahumada <sergio.ahumada@digia.com>2013-10-09 15:50:11 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-09 15:50:11 +0200
commitda0cb32b8ee7cc4a991a59420a411898e63a660e (patch)
tree9ed8e190a6543518f9b082afc5a380f659da0220 /src/gui/kernel
parent7f3e3c1099f42cff46bbd267c70587bcf72024fc (diff)
parentd8fc0da235b2bd566b2b6f1e21218afdf2f34eb3 (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qcursor.cpp8
-rw-r--r--src/gui/kernel/qguiapplication.cpp30
-rw-r--r--src/gui/kernel/qguiapplication_p.h3
-rw-r--r--src/gui/kernel/qkeysequence.cpp8
-rw-r--r--src/gui/kernel/qpalette.cpp8
-rw-r--r--src/gui/kernel/qplatformintegration.cpp22
-rw-r--r--src/gui/kernel/qplatformintegration.h2
-rw-r--r--src/gui/kernel/qsessionmanager.cpp50
-rw-r--r--src/gui/kernel/qstylehints.cpp2
9 files changed, 81 insertions, 52 deletions
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index d6287aef5c..a33b264704 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -154,6 +154,14 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \fn QCursor &QCursor::operator=(QCursor &&other)
+
+ Move-assigns \a other to this QCursor instance.
+
+ \since 5.2
+*/
+
+/*!
\fn QPoint QCursor::pos(const QScreen *screen)
Returns the position of the cursor (hot spot) of the \a screen
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 07ee8e9a64..eeeb5aaf90 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1029,27 +1029,23 @@ void QGuiApplicationPrivate::createPlatformIntegration()
}
+/*!
+ Called from QCoreApplication::init()
+
+ Responsible for creating an event dispatcher when QCoreApplication
+ decides that it needs one (because a custom one has not been set).
+*/
void QGuiApplicationPrivate::createEventDispatcher()
{
+ Q_ASSERT(!eventDispatcher);
+
if (platform_integration == 0)
createPlatformIntegration();
- if (!eventDispatcher) {
- QAbstractEventDispatcher *eventDispatcher = platform_integration->guiThreadEventDispatcher();
- setEventDispatcher(eventDispatcher);
- }
-}
-
-void QGuiApplicationPrivate::setEventDispatcher(QAbstractEventDispatcher *eventDispatcher)
-{
- Q_Q(QGuiApplication);
-
- if (!QCoreApplicationPrivate::eventDispatcher) {
- QCoreApplicationPrivate::eventDispatcher = eventDispatcher;
- QCoreApplicationPrivate::eventDispatcher->setParent(q);
- threadData->eventDispatcher = eventDispatcher;
- }
+ // The platform integration should not mess with the event dispatcher
+ Q_ASSERT(!eventDispatcher);
+ eventDispatcher = platform_integration->createEventDispatcher();
}
#if defined(QT_DEBUG) && defined(Q_OS_LINUX)
@@ -2942,7 +2938,7 @@ static inline void applyWindowCursor(const QList<QWindow *> &l)
restoreOverrideCursor(), otherwise the stack will never be emptied.
Example:
- \snippet code/src_gui_kernel_qapplication_x11.cpp 0
+ \snippet code/src_gui_kernel_qguiapplication_x11.cpp 0
\sa overrideCursor(), restoreOverrideCursor(), changeOverrideCursor(),
QWidget::setCursor()
@@ -3002,7 +2998,7 @@ QStyleHints *QGuiApplication::styleHints()
This function must be called before creating the QGuiApplication object, like
this:
- \snippet code/src_gui_kernel_qapplication.cpp 6
+ \snippet code/src_gui_kernel_qguiapplication.cpp 0
\sa desktopSettingsAware()
*/
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index b1d20c9ead..d49ebbab64 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -83,8 +83,7 @@ public:
~QGuiApplicationPrivate();
void createPlatformIntegration();
- void createEventDispatcher();
- void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher);
+ void createEventDispatcher() Q_DECL_OVERRIDE;
virtual void notifyLayoutDirectionChange();
virtual void notifyActiveWindowChange(QWindow *previous);
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 16324b3659..1fcf1026d2 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -733,6 +733,14 @@ static const struct {
*/
/*!
+ \fn QKeySequence &QKeySequence::operator=(QKeySequence &&other)
+
+ Move-assigns \a other to this QKeySequence instance.
+
+ \since 5.2
+*/
+
+/*!
\since 4.2
Constructs a QKeySequence object for the given \a key.
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index b266d31c5c..00ab74e4e4 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -90,6 +90,14 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
}
/*!
+ \fn QPalette &QPalette::operator=(QPalette &&other)
+
+ Move-assigns \a other to this QPalette instance.
+
+ \since 5.2
+*/
+
+/*!
\fn const QColor &QPalette::color(ColorRole role) const
\overload
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index dc775bcb61..3f93856349 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -231,17 +231,23 @@ QPlatformServices *QPlatformIntegration::services() const
are never repositioned by the window manager. The default implementation returns true.
*/
-
/*!
- \fn QAbstractEventDispatcher *QPlatformIntegration::guiThreadEventDispatcher() const = 0
+ \fn QAbstractEventDispatcher *QPlatformIntegration::createEventDispatcher() const = 0
+
+ Factory function for the GUI event dispatcher. The platform plugin should create
+ and return a QAbstractEventDispatcher subclass when this function is called.
+
+ If the platform plugin for some reason creates the event dispatcher outside of
+ this function (for example in the constructor), it needs to handle the case
+ where this function is never called, ensuring that the event dispatcher is
+ still deleted at some point (typically in the destructor).
+
+ Note that the platform plugin should never explicitly set the event dispatcher
+ itself, using QCoreApplication::setEventDispatcher(), but let QCoreApplication
+ decide when and which event dispatcher to create.
- Accessor function for the event dispatcher. The platform plugin should create
- an instance of the QAbstractEventDispatcher in its constructor and set it
- on the application using QGuiApplicationPrivate::instance()->setEventDispatcher().
- The event dispatcher is owned by QGuiApplication, the accessor should return
- a flat pointer.
- \sa QGuiApplicationPrivate
+ \since 5.2
*/
bool QPlatformIntegration::hasCapability(Capability cap) const
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index 0204181ca6..0af74370b5 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -111,7 +111,7 @@ public:
virtual QPaintEngine *createImagePaintEngine(QPaintDevice *paintDevice) const;
// Event dispatcher:
- virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const = 0;
+ virtual QAbstractEventDispatcher *createEventDispatcher() const = 0;
//Deeper window system integrations
virtual QPlatformFontDatabase *fontDatabase() const;
diff --git a/src/gui/kernel/qsessionmanager.cpp b/src/gui/kernel/qsessionmanager.cpp
index 8cc8d3d961..c46dd5f55a 100644
--- a/src/gui/kernel/qsessionmanager.cpp
+++ b/src/gui/kernel/qsessionmanager.cpp
@@ -74,10 +74,11 @@ QT_BEGIN_NAMESPACE
QSessionManager provides an interface between the application and the
session manager so that the program can work well with the session manager.
In Qt, session management requests for action are handled by the two
- virtual functions QApplication::commitData() and QApplication::saveState().
- Both provide a reference to a session manager object as argument, to allow
- the application to communicate with the session manager. The session
- manager can only be accessed through these functions.
+ signals QGuiApplication::commitDataRequest() and
+ QGuiApplication::saveStateRequest(). Both provide a reference to a session
+ manager object as argument, to allow the application to communicate with
+ the session manager. The session manager can only be accessed through these
+ functions.
No user interaction is possible \e unless the application gets explicit
permission from the session manager. You ask for permission by calling
@@ -94,7 +95,7 @@ QT_BEGIN_NAMESPACE
setRestartHint(), setProperty(), requestPhase2(). See the respective
function descriptions for further details.
- \sa QApplication, {Session Management}
+ \sa QGuiApplication, {Session Management}
*/
@@ -151,7 +152,7 @@ QSessionManager::~QSessionManager()
If the application has been restored from an earlier session, this
identifier is the same as it was in the earlier session.
- \sa sessionKey(), QApplication::sessionId()
+ \sa sessionKey(), QGuiApplication::sessionId()
*/
QString QSessionManager::sessionId() const
{
@@ -169,7 +170,7 @@ QString QSessionManager::sessionId() const
The session key changes with every call of commitData() or saveState().
- \sa sessionId(), QApplication::sessionKey()
+ \sa sessionId(), QGuiApplication::sessionKey()
*/
QString QSessionManager::sessionKey() const
{
@@ -197,15 +198,15 @@ QString QSessionManager::sessionKey() const
phase, you must tell the session manager that this has happened by calling
cancel().
- Here's an example of how an application's QApplication::commitData() might
- be implemented:
+ Here's an example of how an application's QGuiApplication::commitDataRequest()
+ might be implemented:
- \snippet code/src_gui_kernel_qapplication.cpp 8
+ \snippet code/src_gui_kernel_qguiapplication.cpp 8
If an error occurred within the application while saving its data, you may
want to try allowsErrorInteraction() instead.
- \sa QApplication::commitData(), release(), cancel()
+ \sa QGuiApplication::commitDataRequest(), release(), cancel()
*/
bool QSessionManager::allowsInteraction()
{
@@ -261,8 +262,9 @@ void QSessionManager::cancel()
\note These flags are only hints, a session manager may or may not respect
them.
- We recommend setting the restart hint in QApplication::saveState() because
- most session managers perform a checkpoint shortly after an application's
+ We recommend setting the restart hint in QGuiApplication::saveStateRequest()
+ because most session managers perform a checkpoint shortly after an
+ application's
startup.
\sa restartHint()
@@ -291,12 +293,13 @@ QSessionManager::RestartHint QSessionManager::restartHint() const
If the session manager is capable of restoring sessions it will execute
\a command in order to restore the application. The command defaults to
- \snippet code/src_gui_kernel_qapplication.cpp 9
+ \snippet code/src_gui_kernel_qguiapplication.cpp 9
- The \c -session option is mandatory; otherwise QApplication cannot tell
- whether it has been restored or what the current session identifier is.
- See QApplication::isSessionRestored() and QApplication::sessionId() for
- details.
+ The \c -session option is mandatory; otherwise QGuiApplication cannot
+ tell whether it has been restored or what the current session identifier
+ is.
+ See QGuiApplication::isSessionRestored() and
+ QGuiApplication::sessionId() for details.
If your application is very simple, it may be possible to store the entire
application state in additional command line options. This is usually a
@@ -318,7 +321,7 @@ void QSessionManager::setRestartCommand(const QStringList &command)
To iterate over the list, you can use the \l foreach pseudo-keyword:
- \snippet code/src_gui_kernel_qapplication.cpp 10
+ \snippet code/src_gui_kernel_qguiapplication.cpp 10
\sa setRestartCommand(), restartHint()
*/
@@ -344,7 +347,7 @@ void QSessionManager::setDiscardCommand(const QStringList &command)
To iterate over the list, you can use the \l foreach pseudo-keyword:
- \snippet code/src_gui_kernel_qapplication.cpp 11
+ \snippet code/src_gui_kernel_qguiapplication.cpp 11
\sa setDiscardCommand(), restartCommand(), setRestartCommand()
*/
@@ -396,9 +399,10 @@ bool QSessionManager::isPhase2() const
/*!
Requests a second session management phase for the application. The
- application may then return immediately from the QApplication::commitData()
- or QApplication::saveState() function, and they will be called again once
- most or all other applications have finished their session management.
+ application may then return immediately from the
+ QGuiApplication::commitDataRequest() or QApplication::saveStateRequest()
+ function, and they will be called again once most or all other
+ applications have finished their session management.
The two phases are useful for applications such as the X11 window manager
that need to store information about another application's windows and
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index a302f2186c..04ea9c27d5 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -106,7 +106,7 @@ int QStyleHints::mouseDoubleClickInterval() const
and the current position (e.g. in the mouse move event) is \c currentPos,
you can find out if a drag should be started with code like this:
- \snippet code/src_gui_kernel_qapplication.cpp 7
+ \snippet code/src_gui_kernel_qguiapplication.cpp 6
\sa startDragTime(), QPoint::manhattanLength(), {Drag and Drop}
*/