diff options
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 7 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qplatformcursor.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qplatformdialoghelper.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qplatformnativeinterface.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qplatformnativeinterface.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qplatformwindow.cpp | 35 | ||||
-rw-r--r-- | src/gui/kernel/qplatformwindow.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qshortcutmap.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 193 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.h | 82 | ||||
-rw-r--r-- | src/gui/kernel/qwindow_p.h | 4 |
13 files changed, 127 insertions, 215 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index fb14490a24..72e95c996c 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -60,6 +60,7 @@ #include <QtCore/private/qthread_p.h> #include <QtCore/qdir.h> #include <QtDebug> +#include "qaccessible.h" #include <qpalette.h> #include <qscreen.h> #include "qsessionmanager.h" @@ -1065,7 +1066,8 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate() QPixmapCache::clear(); - delete platform_theme; + delete platform_theme; + platform_theme = 0; delete platform_integration; platform_integration = 0; delete m_gammaTables.load(); @@ -1183,6 +1185,9 @@ QPlatformNativeInterface *QGuiApplication::platformNativeInterface() */ int QGuiApplication::exec() { +#ifndef QT_NO_ACCESSIBILITY + QAccessible::setRootObject(qApp); +#endif return QCoreApplication::exec(); } diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 66baa3db95..83e7b30a52 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -349,7 +349,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni \section1 GNU Emacs Style Key Sequences - Key sequences similar to those used in \l{GNU Emacs}, allowing up to four + Key sequences similar to those used in \l{http://www.gnu.org/software/emacs/}{GNU Emacs}, allowing up to four key codes, can be created by using the multiple argument constructor, or by passing a human-readable string of comma-separated key sequences. diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index d2de6aa125..f16f29718d 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -121,7 +121,7 @@ QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex; \l{OpenGL documentation}. For an example of how to use QOpenGLContext see the - \l{gui/openglwindow}{OpenGL Window} example. + \l{OpenGL Window Example}{OpenGL Window} example. \section1 Thread affinity diff --git a/src/gui/kernel/qplatformcursor.h b/src/gui/kernel/qplatformcursor.h index 138c5fdb58..babb91d9fd 100644 --- a/src/gui/kernel/qplatformcursor.h +++ b/src/gui/kernel/qplatformcursor.h @@ -92,7 +92,9 @@ public: // input methods virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); } +#ifndef QT_NO_CURSOR virtual void changeCursor(QCursor * windowCursor, QWindow * window) = 0; +#endif virtual QPoint pos() const; virtual void setPos(const QPoint &pos); diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index 79f1bd1b49..0ef08227a4 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -205,7 +205,7 @@ QColorDialogStaticData::QColorDialogStaticData() : customSet(false) void QColorDialogStaticData::readSettings() { #ifndef QT_NO_SETTINGS - const QSettings settings(QSettings::UserScope, QStringLiteral("Trolltech")); + const QSettings settings(QSettings::UserScope, QStringLiteral("QtProject")); for (int i = 0; i < int(CustomColorCount); ++i) { const QVariant v = settings.value(QStringLiteral("Qt/customColors/") + QString::number(i)); if (v.isValid()) @@ -218,7 +218,7 @@ void QColorDialogStaticData::writeSettings() const { #ifndef QT_NO_SETTINGS if (!customSet) { - QSettings settings(QSettings::UserScope, QStringLiteral("Trolltech")); + QSettings settings(QSettings::UserScope, QStringLiteral("QtProject")); for (int i = 0; i < int(CustomColorCount); ++i) settings.setValue(QStringLiteral("Qt/customColors/") + QString::number(i), customRgb[i]); } diff --git a/src/gui/kernel/qplatformnativeinterface.cpp b/src/gui/kernel/qplatformnativeinterface.cpp index 925b2ad3de..cf487b2235 100644 --- a/src/gui/kernel/qplatformnativeinterface.cpp +++ b/src/gui/kernel/qplatformnativeinterface.cpp @@ -100,6 +100,12 @@ QPlatformNativeInterface::NativeResourceForContextFunction QPlatformNativeInterf return 0; } +QPlatformNativeInterface::NativeResourceForScreenFunction QPlatformNativeInterface::nativeResourceFunctionForScreen(const QByteArray &resource) +{ + Q_UNUSED(resource); + return 0; +} + QPlatformNativeInterface::NativeResourceForWindowFunction QPlatformNativeInterface::nativeResourceFunctionForWindow(const QByteArray &resource) { Q_UNUSED(resource); diff --git a/src/gui/kernel/qplatformnativeinterface.h b/src/gui/kernel/qplatformnativeinterface.h index cbf997bec4..8dd661f67e 100644 --- a/src/gui/kernel/qplatformnativeinterface.h +++ b/src/gui/kernel/qplatformnativeinterface.h @@ -78,10 +78,12 @@ public: typedef void * (*NativeResourceForIntegrationFunction)(); typedef void * (*NativeResourceForContextFunction)(QOpenGLContext *context); + typedef void * (*NativeResourceForScreenFunction)(QScreen *screen); typedef void * (*NativeResourceForWindowFunction)(QWindow *window); typedef void * (*NativeResourceForBackingStoreFunction)(QBackingStore *backingStore); virtual NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource); virtual NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource); + virtual NativeResourceForScreenFunction nativeResourceFunctionForScreen(const QByteArray &resource); virtual NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource); virtual NativeResourceForBackingStoreFunction nativeResourceFunctionForBackingStore(const QByteArray &resource); diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index 25b863c9a3..82547b04ec 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -247,7 +247,12 @@ void QPlatformWindow::setParent(const QPlatformWindow *parent) } /*! - Reimplement to set the window title to \a title + Reimplement to set the window title to \a title. + + The implementation might want to append the application display name to + the window title, like Windows and Linux do. + + \sa QGuiApplication::applicationDisplayName() */ void QPlatformWindow::setWindowTitle(const QString &title) { Q_UNUSED(title); } @@ -331,31 +336,6 @@ void QPlatformWindow::handleContentOrientationChange(Qt::ScreenOrientation orien } /*! - Request a different orientation of the platform window. - - This tells the window manager how the window wants to be rotated in order - to be displayed, and how input events should be translated. - - As an example, a portrait compositor might rotate the window by 90 degrees, - if the window is in landscape. It will also rotate input coordinates from - portrait to landscape such that top right in portrait gets mapped to top - left in landscape. - - If the implementation doesn't support the requested orientation it should - signal this by returning an actual supported orientation. - - If the implementation doesn't support rotating the window at all it should - return Qt::PrimaryOrientation, this is also the default value. - - \sa QWindow::requestWindowOrientation() -*/ -Qt::ScreenOrientation QPlatformWindow::requestWindowOrientation(Qt::ScreenOrientation orientation) -{ - Q_UNUSED(orientation); - return Qt::PrimaryOrientation; -} - -/*! Reimplement this function in subclass to return the device pixel ratio for the window. This is the ratio between physical pixels and device-independent pixels. @@ -469,9 +449,6 @@ bool QPlatformWindow::frameStrutEventsEnabled() const QPlatformWindow is also the way QPA defines how native child windows should be supported through the setParent function. - The only way to retrieve a QPlatformOpenGLContext in QPA is by calling the glContext() function - on QPlatformWindow. - \section1 Implementation Aspects \list 1 diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h index 607c8e4035..5d7323ae2b 100644 --- a/src/gui/kernel/qplatformwindow.h +++ b/src/gui/kernel/qplatformwindow.h @@ -115,7 +115,6 @@ public: virtual void requestActivateWindow(); virtual void handleContentOrientationChange(Qt::ScreenOrientation orientation); - virtual Qt::ScreenOrientation requestWindowOrientation(Qt::ScreenOrientation orientation); virtual qreal devicePixelRatio() const; diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp index 43f37a900f..839cbf37e7 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/gui/kernel/qshortcutmap.cpp @@ -679,7 +679,7 @@ void QShortcutMap::dispatchEvent(QKeyEvent *e) #if defined(DEBUG_QSHORTCUTMAP) qDebug().nospace() << "QShortcutMap::dispatchEvent(): Sending QShortcutEvent(\"" - << (QString)next->keyseq << "\", " << next->id << ", " + << next->keyseq.toString() << "\", " << next->id << ", " << (bool)(enabledShortcuts>1) << ") to object(" << next->owner << ')'; #endif QShortcutEvent se(next->keyseq, next->id, enabledShortcuts>1); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index aaf2b25ad4..b6d592e050 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -89,23 +89,16 @@ QT_BEGIN_NAMESPACE buffers to support double and triple buffering, as well as depth and stencil buffers. To release a window's memory resources, call the destroy() function. - \section1 Window and content orientation - - QWindow has reportContentOrientationChange() and - requestWindowOrientation() that can be used to specify the - layout of the window contents in relation to the screen. The - window orientation determines the actual buffer layout of the - window, and the windowing system uses this value to rotate the - window before it ends up on the display, and to ensure that input - coordinates are in the correct coordinate space relative to the - application. - - On the other hand, the content orientation is simply a hint to the - windowing system about which orientation the window contents are in. - It's useful when you wish to keep the same buffer layout, but rotate - the contents instead, especially when doing rotation animations - between different orientations. The windowing system might use this - value to determine the layout of system popups or dialogs. + \section1 Content orientation + + QWindow has reportContentOrientationChange() that can be used to specify + the layout of the window contents in relation to the screen. The content + orientation is simply a hint to the windowing system about which + orientation the window contents are in. It's useful when you wish to keep + the same window size, but rotate the contents instead, especially when + doing rotation animations between different orientations. The windowing + system might use this value to determine the layout of system popups or + dialogs. \section1 Visibility and Windowing system exposure. @@ -661,9 +654,11 @@ void QWindow::lower() void QWindow::setOpacity(qreal level) { Q_D(QWindow); - if (d->platformWindow) { + if (level == d->opacity) // #fixme: Add property for 5.1 + return; + d->opacity = level; + if (d->platformWindow) d->platformWindow->setOpacity(level); - } } /*! @@ -743,8 +738,6 @@ bool QWindow::isActive() const to compute the necessary transform. The default value is Qt::PrimaryOrientation - - \sa requestOrientation(), QScreen::orientation() */ void QWindow::reportContentOrientationChange(Qt::ScreenOrientation orientation) { @@ -766,46 +759,6 @@ Qt::ScreenOrientation QWindow::contentOrientation() const } /*! - Requests the given window \a orientation. - - The window \a orientation specifies how the window should be rotated - by the window manager in order to be displayed. Input events will - be correctly mapped to the given \a orientation. - - The return value is false if the system doesn't support the given - \a orientation (for example when requesting a portrait orientation - on a device that only handles landscape buffers, typically a desktop - system). - - If the return value is false, call \l orientation() to get the actual - supported orientation. - - \sa orientation(), reportContentOrientationChange(), QScreen::orientation() -*/ -bool QWindow::requestOrientation(Qt::ScreenOrientation orientation) -{ - Q_D(QWindow); - if (!d->platformWindow) - create(); - Q_ASSERT(d->platformWindow); - d->windowOrientation = d->platformWindow->requestWindowOrientation(orientation); - return d->windowOrientation == orientation; -} - -/*! - Returns the actual window orientation. - - The default value is Qt::PrimaryOrientation. - - \sa requestOrientation() -*/ -Qt::ScreenOrientation QWindow::orientation() const -{ - Q_D(const QWindow); - return d->windowOrientation; -} - -/*! Returns the ratio between physical pixels and device-independent pixels for the window. This value is dependent on the screen the window is on, and may change when the window is moved. @@ -983,11 +936,59 @@ void QWindow::setMinimumSize(const QSize &size) emit minimumHeightChanged(d->minimumSize.height()); } +/*! + \property QWindow::x + \brief the x position of the window's geometry +*/ +void QWindow::setX(int arg) +{ + if (x() != arg) + setGeometry(QRect(arg, y(), width(), height())); +} + +/*! + \property QWindow::y + \brief the y position of the window's geometry +*/ +void QWindow::setY(int arg) +{ + if (y() != arg) + setGeometry(QRect(x(), arg, width(), height())); +} + +/*! + \property QWindow::width + \brief the width of the window's geometry +*/ +void QWindow::setWidth(int arg) +{ + if (width() != arg) + setGeometry(QRect(x(), y(), arg, height())); +} + +/*! + \property QWindow::height + \brief the height of the window's geometry +*/ +void QWindow::setHeight(int arg) +{ + if (height() != arg) + setGeometry(QRect(x(), y(), width(), arg)); +} + +/*! + \property QWindow::minimumWidth + \brief the minimum width of the window's geometry +*/ void QWindow::setMinimumWidth(int w) { setMinimumSize(QSize(w, minimumHeight())); } +/*! + \property QWindow::minimumHeight + \brief the minimum height of the window's geometry +*/ void QWindow::setMinimumHeight(int h) { setMinimumSize(QSize(minimumWidth(), h)); @@ -1016,11 +1017,19 @@ void QWindow::setMaximumSize(const QSize &size) emit maximumHeightChanged(d->maximumSize.height()); } +/*! + \property QWindow::maximumWidth + \brief the maximum width of the window's geometry +*/ void QWindow::setMaximumWidth(int w) { setMaximumSize(QSize(w, maximumHeight())); } +/*! + \property QWindow::maximumHeight + \brief the maximum height of the window's geometry +*/ void QWindow::setMaximumHeight(int h) { setMaximumSize(QSize(maximumWidth(), h)); @@ -1069,13 +1078,15 @@ void QWindow::setSizeIncrement(const QSize &size) } /*! - \fn void QWindow::setGeometry(int posx, int posy, int w, int h) - Sets the geometry of the window, excluding its window frame, to a rectangle constructed from \a posx, \a posy, \a w and \a h. \sa geometry() */ +void QWindow::setGeometry(int posx, int posy, int w, int h) +{ + setGeometry(QRect(posx, posy, w, h)); +} /*! \brief Sets the geometry of the window, excluding its window frame, to \a rect. @@ -1107,46 +1118,6 @@ void QWindow::setGeometry(const QRect &rect) } /*! - \property QWindow::x - \brief the x position of the window's geometry -*/ - -/*! - \property QWindow::y - \brief the y position of the window's geometry -*/ - -/*! - \property QWindow::width - \brief the width of the window's geometry -*/ - -/*! - \property QWindow::height - \brief the height of the window's geometry -*/ - -/*! - \property QWindow::minimumWidth - \brief the minimum width of the window's geometry -*/ - -/*! - \property QWindow::minimumHeight - \brief the minimum height of the window's geometry -*/ - -/*! - \property QWindow::maximumWidth - \brief the maximum width of the window's geometry -*/ - -/*! - \property QWindow::maximumHeight - \brief the maximum height of the window's geometry -*/ - -/*! Returns the geometry of the window, excluding its window frame. \sa frameMargins(), frameGeometry() @@ -1221,18 +1192,24 @@ void QWindow::setFramePosition(const QPoint &point) } /*! - \fn void QWindow::setPosition(const QPoint &pt) \brief set the position of the window on the desktop to \a pt \sa position() */ +void QWindow::setPosition(const QPoint &pt) +{ + setGeometry(QRect(pt, size())); +} /*! - \fn void QWindow::setPosition(int posx, int posy) \brief set the position of the window on the desktop to \a posx, \a posy \sa position() */ +void QWindow::setPosition(int posx, int posy) +{ + setPosition(QPoint(posx, posy)); +} /*! \fn QPoint QWindow::position() const @@ -1249,13 +1226,15 @@ void QWindow::setFramePosition(const QPoint &point) */ /*! - \fn void QWindow::resize(int w, int h) - set the size of the window, excluding any window frame, to a QSize constructed from width \a w and height \a h \sa size(), geometry() */ +void QWindow::resize(int w, int h) +{ + resize(QSize(w, h)); +} /*! \brief set the size of the window, excluding any window frame, to \a newSize diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 229275d7c7..c1a8e7971a 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -113,35 +113,6 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged) - // ------------------------------------------------------------------------ - // Temporary backwards-compatibility properties to be removed ASAP - Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) - Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath) - Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon) - Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality NOTIFY windowModalityChanged) - -public: - - Qt::WindowModality windowModality() const { return modality(); } - void setWindowModality(Qt::WindowModality wm) { setModality(wm); } - void setWindowFlags(Qt::WindowFlags f) { setFlags(f); } - Qt::WindowFlags windowFlags() const { return flags(); } - Qt::WindowType windowType() const { return type(); } - QString windowTitle() const { return title(); } - void requestActivateWindow() { requestActivate(); } - bool requestWindowOrientation(Qt::ScreenOrientation o) { return requestOrientation(o); } - Qt::ScreenOrientation windowOrientation() const { return orientation(); } - void setWindowFilePath(const QString &fp) { setFilePath(fp); } - QString windowFilePath() const { return filePath(); } - void setWindowIcon(const QIcon &i) { setIcon(i); } - QIcon windowIcon() const { return icon(); } - void setWindowTitle(const QString &t) { setTitle(t); } - -Q_SIGNALS: - void windowModalityChanged(Qt::WindowModality windowModality); - // End of temporary backwards-compatibility properties - // ------------------------------------------------------------------------ - public: explicit QWindow(QScreen *screen = 0); @@ -186,9 +157,6 @@ public: qreal devicePixelRatio() const; - bool requestOrientation(Qt::ScreenOrientation orientation); - Qt::ScreenOrientation orientation() const; - Qt::WindowState windowState() const; void setWindowState(Qt::WindowState state); @@ -204,10 +172,10 @@ public: bool isExposed() const; - int minimumWidth() const { return minimumSize().width(); } - int minimumHeight() const { return minimumSize().height(); } - int maximumWidth() const { return maximumSize().width(); } - int maximumHeight() const { return maximumSize().height(); } + inline int minimumWidth() const { return minimumSize().width(); } + inline int minimumHeight() const { return minimumSize().height(); } + inline int maximumWidth() const { return maximumSize().width(); } + inline int maximumHeight() const { return maximumSize().height(); } QSize minimumSize() const; QSize maximumSize() const; @@ -219,7 +187,7 @@ public: void setBaseSize(const QSize &size); void setSizeIncrement(const QSize &size); - void setGeometry(int posx, int posy, int w, int h) { setGeometry(QRect(posx, posy, w, h)); } + void setGeometry(int posx, int posy, int w, int h); void setGeometry(const QRect &rect); QRect geometry() const; @@ -237,18 +205,11 @@ public: inline QSize size() const { return geometry().size(); } inline QPoint position() const { return geometry().topLeft(); } - inline void setPosition(const QPoint &pt) { setGeometry(QRect(pt, size())); } - inline void setPosition(int posx, int posy) { setPosition(QPoint(posx, posy)); } - -// Temporary backwards-compatible accessors for the benefit of Declarative -// to be removed ASAP - inline void setFramePos(const QPoint &pt) { setFramePosition(pt); } - inline void setPos(const QPoint &pt) { setPosition(pt); } - inline void setPos(int posx, int posy) { setPosition(posx, posy); } -// end of temporary accessors + void setPosition(const QPoint &pt); + void setPosition(int posx, int posy); void resize(const QSize &newSize); - inline void resize(int w, int h) { resize(QSize(w, h)); } + void resize(int w, int h); void setFilePath(const QString &filePath); QString filePath() const; @@ -295,29 +256,10 @@ public Q_SLOTS: void setTitle(const QString &); - void setX(int arg) - { - if (x() != arg) - setGeometry(QRect(arg, y(), width(), height())); - } - - void setY(int arg) - { - if (y() != arg) - setGeometry(QRect(x(), arg, width(), height())); - } - - void setWidth(int arg) - { - if (width() != arg) - setGeometry(QRect(x(), y(), arg, height())); - } - - void setHeight(int arg) - { - if (height() != arg) - setGeometry(QRect(x(), y(), width(), arg)); - } + void setX(int arg); + void setY(int arg); + void setWidth(int arg); + void setHeight(int arg); void setMinimumWidth(int w); void setMinimumHeight(int h); diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index fcc5540185..305888d02c 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -89,7 +89,7 @@ public: , receivedExpose(false) , positionPolicy(WindowFrameExclusive) , contentOrientation(Qt::PrimaryOrientation) - , windowOrientation(Qt::PrimaryOrientation) + , opacity(qreal(1.0)) , minimumSize(0, 0) , maximumSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX) , modality(Qt::NonModal) @@ -136,7 +136,7 @@ public: bool receivedExpose; PositionPolicy positionPolicy; Qt::ScreenOrientation contentOrientation; - Qt::ScreenOrientation windowOrientation; + qreal opacity; QSize minimumSize; QSize maximumSize; |