diff options
Diffstat (limited to 'src/gui')
49 files changed, 200 insertions, 93 deletions
diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in index f385fa0f6e..f1bc441009 100644 --- a/src/gui/Qt5GuiConfigExtras.cmake.in +++ b/src/gui/Qt5GuiConfigExtras.cmake.in @@ -7,22 +7,27 @@ set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAK set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR\") !!ENDIF +_qt5_Gui_check_file_exists(${Qt5Gui_EGL_INCLUDE_DIRS}) + set(Qt5Gui_OPENGL_INCLUDE_DIRS ${Qt5Gui_EGL_INCLUDE_DIRS}) macro(_populate_qt5gui_gl_target_properties TargetName Configuration LIB_LOCATION IMPLIB_LOCATION) set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration}) - set_target_properties(Qt5::${TargetName} PROPERTIES !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) - \"IMPORTED_LOCATION_${Configuration}\" \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${LIB_LOCATION}\" + set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${LIB_LOCATION}\") !!ELSE - \"IMPORTED_LOCATION_${Configuration}\" \"$${CMAKE_LIB_DIR}${LIB_LOCATION}\" + set(imported_location \"$${CMAKE_LIB_DIR}${LIB_LOCATION}\") !!ENDIF !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) - \"IMPORTED_IMPLIB_${Configuration}\" \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\" + set(imported_implib \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\") !!ELSE - \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\" + set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\") !!ENDIF + + set_target_properties(Qt5::${TargetName} PROPERTIES + \"IMPORTED_LOCATION_${Configuration}\" ${imported_location} + \"IMPORTED_IMPLIB_${Configuration}\" ${imported_implib} ) endmacro() @@ -53,6 +58,8 @@ if (NOT _qt5gui_OPENGL_INCLUDE_DIR) message(FATAL_ERROR \"Failed to find \\\"$$CMAKE_GL_HEADER_NAME\\\" in \\\"$$CMAKE_GL_INCDIRS\\\", using the CMAKE_FIND_ROOT_PATH \\\"${CMAKE_FIND_ROOT_PATH}\\\".\") endif() +_qt5_Gui_check_file_exists(${_qt5gui_OPENGL_INCLUDE_DIR}) + list(APPEND Qt5Gui_INCLUDE_DIRS ${_qt5gui_OPENGL_INCLUDE_DIR}) set_property(TARGET Qt5::Gui APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5gui_OPENGL_INCLUDE_DIR}) @@ -62,7 +69,7 @@ unset(_qt5gui_OPENGL_INCLUDE_DIR CACHE) macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs) set(Qt5Gui_${Name}_LIBRARIES) - set(Qt5Gui_EGL_INCLUDE_DIRS ${IncDirs}) + set(Qt5Gui_${Name}_INCLUDE_DIRS ${IncDirs}) foreach(_lib ${Libs}) string(REGEX REPLACE "[^_A-Za-z0-9]" "_" _cmake_lib_name ${_lib}) if (NOT TARGET Qt5::Gui_${_cmake_lib_name}) @@ -75,13 +82,19 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs) set(Qt5Gui_${_cmake_lib_name}_LIBRARY "${Qt5Gui_${_cmake_lib_name}_LIBRARY}/${_lib}") !!ENDIF if (NOT Qt5Gui_${_cmake_lib_name}_LIBRARY) - message(FATAL_ERROR \"Failed to find \\\"${_lib}\\\" in \\\"${LibDir}\\\", using the CMAKE_FIND_ROOT_PATH \\\"${CMAKE_FIND_ROOT_PATH}\\\".\") + if (\"${ARGN}\" STREQUAL \"OPTIONAL\") + break() + else() + message(FATAL_ERROR \"Failed to find \\\"${_lib}\\\" in \\\"${LibDir}\\\", using the CMAKE_FIND_ROOT_PATH \\\"${CMAKE_FIND_ROOT_PATH}\\\".\") + endif() endif() add_library(Qt5::Gui_${_cmake_lib_name} SHARED IMPORTED) set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${IncDirs}) set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + _qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\") set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\") + !!IF !isEmpty(CMAKE_WINDOWS_BUILD) set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\") !!ENDIF @@ -91,6 +104,7 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs) PATHS \"${LibDir}\" NO_DEFAULT_PATH) if (Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG) set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + _qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\") set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\") !!IF !isEmpty(CMAKE_WINDOWS_BUILD) set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\") @@ -100,11 +114,14 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs) endif() list(APPEND Qt5Gui_${Name}_LIBRARIES Qt5::Gui_${_cmake_lib_name}) endforeach() + foreach(_dir ${IncDirs}) + _qt5_Gui_check_file_exists(${_dir}) + endforeach() endmacro() !!IF !isEmpty(CMAKE_EGL_LIBS) -_qt5gui_find_extra_libs(EGL \"$$CMAKE_EGL_LIBS\" \"$$CMAKE_EGL_LIBDIR\" \"$$CMAKE_EGL_INCDIRS\") +_qt5gui_find_extra_libs(EGL \"$$CMAKE_EGL_LIBS\" \"$$CMAKE_EGL_LIBDIR\" \"$$CMAKE_EGL_INCDIRS\" OPTIONAL) !!ENDIF !!IF !isEmpty(CMAKE_OPENGL_LIBS) diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf index 74596d8a50..5073dd7f0f 100644 --- a/src/gui/doc/qtgui.qdocconf +++ b/src/gui/doc/qtgui.qdocconf @@ -46,4 +46,5 @@ exampledirs += ../../../examples/gui \ snippets imagedirs += images \ - ../../../examples/gui/doc/images + ../../../examples/gui/doc/images \ + ../../../doc/src/images \ diff --git a/src/gui/gui.pro b/src/gui/gui.pro index b44f563b3e..e2dd5efcde 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -56,8 +56,10 @@ contains(QT_CONFIG, angle) { CMAKE_QT_OPENGL_IMPLEMENTATION = GLESv2 } else { - CMAKE_EGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_EGL) - !isEmpty(QMAKE_LIBDIR_EGL): CMAKE_EGL_LIBDIR += $$cmakeTargetPath($$QMAKE_LIBDIR_EGL) + contains(QT_CONFIG, egl) { + CMAKE_EGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_EGL) + !isEmpty(QMAKE_LIBDIR_EGL): CMAKE_EGL_LIBDIR += $$cmakeTargetPath($$QMAKE_LIBDIR_EGL) + } contains(QT_CONFIG, opengles1) { !isEmpty(QMAKE_INCDIR_OPENGL_ES1): CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL_ES1) @@ -84,6 +86,6 @@ contains(QT_CONFIG, angle) { } } -CMAKE_EGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_EGL) +contains(QT_CONFIG, egl): CMAKE_EGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_EGL) QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 85f0dc2d92..04f0da1a83 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1310,9 +1310,7 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) file, optionally manipulating the image data, before the QImage object is converted into a QPixmap to be shown on screen. Alternatively, if no manipulation is desired, the image - file can be loaded directly into a QPixmap. On Windows, the - QPixmap class also supports conversion between \c HBITMAP and - QPixmap. + file can be loaded directly into a QPixmap. QPixmap provides a collection of functions that can be used to obtain a variety of information about the pixmap. In addition, @@ -1410,14 +1408,9 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) QPixmap using the fromImage(). If this is too expensive an operation, you can use QBitmap::fromImage() instead. - In addition, on Windows, the QPixmap class supports conversion to - and from HBITMAP: the toWinHBITMAP() function creates a HBITMAP - equivalent to the QPixmap, based on the given HBitmapFormat, and - returns the HBITMAP handle. The fromWinHBITMAP() function returns - a QPixmap that is equivalent to the given bitmap which has the - specified format. The QPixmap class also supports conversion to - and from HICON: the toWinHICON() function creates a HICON equivalent - to the QPixmap, and returns the HICON handle. The fromWinHICON() + The QPixmap class also supports conversion to and from HICON: + the toWinHICON() function creates a HICON equivalent to the + QPixmap, and returns the HICON handle. The fromWinHICON() function returns a QPixmap that is equivalent to the given icon. \section1 Pixmap Transformations diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 3c79e62e75..2a1d7e3bcc 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1285,6 +1285,9 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv case QWindowSystemInterfacePrivate::WindowStateChanged: QGuiApplicationPrivate::processWindowStateChangedEvent(static_cast<QWindowSystemInterfacePrivate::WindowStateChangedEvent *>(e)); break; + case QWindowSystemInterfacePrivate::WindowScreenChanged: + QGuiApplicationPrivate::processWindowScreenChangedEvent(static_cast<QWindowSystemInterfacePrivate::WindowScreenChangedEvent *>(e)); + break; case QWindowSystemInterfacePrivate::ApplicationStateChanged: QGuiApplicationPrivate::processApplicationStateChangedEvent(static_cast<QWindowSystemInterfacePrivate::ApplicationStateChangedEvent *>(e)); break; @@ -1655,6 +1658,16 @@ void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfa } } +void QGuiApplicationPrivate::processWindowScreenChangedEvent(QWindowSystemInterfacePrivate::WindowScreenChangedEvent *wse) +{ + if (QWindow *window = wse->window.data()) { + if (QScreen *screen = wse->screen.data()) + window->d_func()->setScreen(screen, false /* recreate */); + else // Fall back to default behavior, and try to find some appropriate screen + window->setScreen(0); + } +} + void QGuiApplicationPrivate::processApplicationStateChangedEvent(QWindowSystemInterfacePrivate::ApplicationStateChangedEvent *e) { if (e->newState == applicationState) diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 376890ef47..cd8dfff103 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -126,6 +126,7 @@ public: static void processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e); static void processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *e); + static void processWindowScreenChangedEvent(QWindowSystemInterfacePrivate::WindowScreenChangedEvent *e); static void processApplicationStateChangedEvent(QWindowSystemInterfacePrivate::ApplicationStateChangedEvent *e); diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index a0255f610a..af3a46c675 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -55,14 +55,14 @@ #endif #include "qvariant.h" -#if defined(Q_OS_MAC) && !defined(Q_OS_IOS) +#if defined(Q_OS_MACX) #include <QtCore/private/qcore_mac_p.h> #include <Carbon/Carbon.h> #endif QT_BEGIN_NAMESPACE -#if defined(Q_OS_MAC) && !defined(Q_OS_IOS) +#if defined(Q_OS_MACX) static bool qt_sequence_no_mnemonics = true; struct MacSpecialKey { int key; @@ -975,7 +975,7 @@ QKeySequence::QKeySequence(const QKeySequence& keysequence) d->ref.ref(); } -#if defined(Q_OS_MAC) && !defined(Q_OS_IOS) +#if defined(Q_OS_MACX) static inline int maybeSwapShortcut(int shortcut) { if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) { @@ -1007,7 +1007,7 @@ QList<QKeySequence> QKeySequence::keyBindings(StandardKey key) QKeyBinding keyBinding = QKeySequencePrivate::keyBindings[i]; if (keyBinding.standardKey == key && (keyBinding.platform & platform)) { uint shortcut = -#if defined(Q_OS_MAC) && !defined(Q_OS_IOS) +#if defined(Q_OS_MACX) maybeSwapShortcut(QKeySequencePrivate::keyBindings[i].shortcut); #else QKeySequencePrivate::keyBindings[i].shortcut; @@ -1209,7 +1209,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence if (nativeText) { gmodifs = globalModifs(); if (gmodifs->isEmpty()) { -#if defined(Q_OS_MAC) && !defined(Q_OS_IOS) +#if defined(Q_OS_MACX) const bool dontSwap = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta); if (dontSwap) *gmodifs << QModifKeyName(Qt::META, QChar(kCommandUnicode)); @@ -1226,7 +1226,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence << QModifKeyName(Qt::SHIFT, QLatin1String("shift+")) << QModifKeyName(Qt::ALT, QLatin1String("alt+")) << QModifKeyName(Qt::META, QLatin1String("meta+")) - << QModifKeyName(Qt::KeypadModifier, QLatin1String("numpad+")); + << QModifKeyName(Qt::KeypadModifier, QLatin1String("num+")); } } else { gmodifs = globalPortableModifs(); @@ -1235,7 +1235,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence << QModifKeyName(Qt::SHIFT, QLatin1String("shift+")) << QModifKeyName(Qt::ALT, QLatin1String("alt+")) << QModifKeyName(Qt::META, QLatin1String("meta+")) - << QModifKeyName(Qt::KeypadModifier, QLatin1String("numpad+")); + << QModifKeyName(Qt::KeypadModifier, QLatin1String("num+")); } } if (!gmodifs) return ret; @@ -1247,12 +1247,12 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence << QModifKeyName(Qt::SHIFT, QCoreApplication::translate("QShortcut", "Shift").toLower().append(QLatin1Char('+'))) << QModifKeyName(Qt::ALT, QCoreApplication::translate("QShortcut", "Alt").toLower().append(QLatin1Char('+'))) << QModifKeyName(Qt::META, QCoreApplication::translate("QShortcut", "Meta").toLower().append(QLatin1Char('+'))) - << QModifKeyName(Qt::KeypadModifier, QCoreApplication::translate("QShortcut", "Numpad").toLower().append(QLatin1Char('+'))); + << QModifKeyName(Qt::KeypadModifier, QCoreApplication::translate("QShortcut", "Num").toLower().append(QLatin1Char('+'))); } modifs += *gmodifs; // Test non-translated ones last QString sl = accel; -#if defined(Q_OS_MAC) && !defined(Q_OS_IOS) +#if defined(Q_OS_MACX) for (int i = 0; i < modifs.size(); ++i) { const QModifKeyName &mkf = modifs.at(i); if (sl.contains(mkf.name)) { @@ -1304,7 +1304,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence int fnum = 0; if (accel.length() == 1) { -#if defined(Q_OS_MAC) && !defined(Q_OS_IOS) +#if defined(Q_OS_MACX) int qtKey = qtkeyForMacSymbol(accel[0]); if (qtKey != -1) { ret |= qtKey; @@ -1383,7 +1383,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat if (key == -1 || key == Qt::Key_unknown) return s; -#if defined(Q_OS_MAC) && !defined(Q_OS_IOS) +#if defined(Q_OS_MACX) if (nativeText) { // On Mac OS X the order (by default) is Meta, Alt, Shift, Control. // If the AA_MacDontSwapCtrlAndMeta is enabled, then the order @@ -1421,9 +1421,9 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Alt") : QString::fromLatin1("Alt"), format); if ((key & Qt::SHIFT) == Qt::SHIFT) addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Shift") : QString::fromLatin1("Shift"), format); - if ((key & Qt::KeypadModifier) == Qt::KeypadModifier) - addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Numpad") : QString::fromLatin1("Numpad"), format); } + if ((key & Qt::KeypadModifier) == Qt::KeypadModifier) + addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Num") : QString::fromLatin1("Num"), format); key &= ~(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier); @@ -1441,7 +1441,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat : QString::fromLatin1("F%1").arg(key - Qt::Key_F1 + 1); } else if (key) { int i=0; -#if defined(Q_OS_MAC) && !defined(Q_OS_IOS) +#if defined(Q_OS_MACX) if (nativeText) { QChar ch = qt_macSymbolForQtKey(key); if (!ch.isNull()) @@ -1451,7 +1451,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat } else #endif { -#if defined(Q_OS_MAC) && !defined(Q_OS_IOS) +#if defined(Q_OS_MACX) NonSymbol: #endif while (keyname[i].name) { @@ -1477,7 +1477,7 @@ NonSymbol: } } -#if defined(Q_OS_MAC) && !defined(Q_OS_IOS) +#if defined(Q_OS_MACX) if (nativeText) s += p; else diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index df3d4dfef0..b266d31c5c 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -1120,12 +1120,14 @@ Q_GUI_EXPORT QPalette qt_fusionPalette() fusionPalette.setBrush(QPalette::HighlightedText, hightlightedText); fusionPalette.setBrush(QPalette::Disabled, QPalette::Text, disabledText); + fusionPalette.setBrush(QPalette::Disabled, QPalette::WindowText, disabledText); + fusionPalette.setBrush(QPalette::Disabled, QPalette::ButtonText, disabledText); fusionPalette.setBrush(QPalette::Disabled, QPalette::Base, disabledBase); fusionPalette.setBrush(QPalette::Disabled, QPalette::Dark, darkDisabled); fusionPalette.setBrush(QPalette::Disabled, QPalette::Shadow, disabledShadow); fusionPalette.setBrush(QPalette::Active, QPalette::Highlight, QColor(48, 140, 198)); - fusionPalette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(145, 141, 126)); + fusionPalette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(48, 140, 198)); fusionPalette.setBrush(QPalette::Disabled, QPalette::Highlight, QColor(145, 141, 126)); return fusionPalette; } diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index 1e8ac60cca..d23cfde172 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -425,8 +425,7 @@ bool QPlatformWindow::startSystemResize(const QPoint &pos, Qt::Corner corner) void QPlatformWindow::setFrameStrutEventsEnabled(bool enabled) { - if (enabled) - qWarning("This plugin does not support frame strut events."); + Q_UNUSED(enabled) // Do not warn as widgets enable it by default causing warnings with XCB. } /*! diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 0dd85f2d56..eff057c4cb 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -345,6 +345,25 @@ void QWindowPrivate::updateVisibility() emit q->visibilityChanged(visibility); } +void QWindowPrivate::setScreen(QScreen *newScreen, bool recreate) +{ + Q_Q(QWindow); + if (newScreen != q->screen()) { + const bool shouldRecreate = recreate && platformWindow != 0; + if (shouldRecreate) + q->destroy(); + if (screen) + q->disconnect(screen, SIGNAL(destroyed(QObject*)), q, SLOT(screenDestroyed(QObject*))); + screen = newScreen; + if (newScreen) { + q->connect(screen, SIGNAL(destroyed(QObject*)), q, SLOT(screenDestroyed(QObject*))); + if (shouldRecreate) + q->create(); + } + emit q->screenChanged(newScreen); + } +} + /*! Sets the \a surfaceType of the window. @@ -1384,6 +1403,7 @@ void QWindow::setFramePosition(const QPoint &point) if (d->platformWindow) { d->platformWindow->setGeometry(QRect(point, size())); } else { + d->positionAutomatic = false; d->geometry.moveTopLeft(point); } } @@ -1568,20 +1588,7 @@ void QWindow::setScreen(QScreen *newScreen) Q_D(QWindow); if (!newScreen) newScreen = QGuiApplication::primaryScreen(); - if (newScreen != screen()) { - const bool wasCreated = d->platformWindow != 0; - if (wasCreated) - destroy(); - if (d->screen) - disconnect(d->screen, SIGNAL(destroyed(QObject*)), this, SLOT(screenDestroyed(QObject*))); - d->screen = newScreen; - if (newScreen) { - connect(d->screen, SIGNAL(destroyed(QObject*)), this, SLOT(screenDestroyed(QObject*))); - if (wasCreated) - create(); - } - emit screenChanged(newScreen); - } + d->setScreen(newScreen, true /* recreate */); } void QWindow::screenDestroyed(QObject *object) @@ -1896,9 +1903,11 @@ bool QWindow::event(QEvent *ev) case QEvent::Close: { Q_D(QWindow); bool wasVisible = isVisible(); - destroy(); - if (wasVisible) - d->maybeQuitOnLastWindowClosed(); + if (ev->isAccepted()) { + destroy(); + if (wasVisible) + d->maybeQuitOnLastWindowClosed(); + } break; } case QEvent::Expose: diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 79f90f2c62..efdfd497a6 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -330,6 +330,7 @@ protected: virtual void showEvent(QShowEvent *); virtual void hideEvent(QHideEvent *); + // TODO Qt 6 - add closeEvent virtual handler virtual bool event(QEvent *); virtual void keyPressEvent(QKeyEvent *); diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index ea2cb722ab..f43c1ea8ec 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -127,6 +127,8 @@ public: void updateVisibility(); void _q_clearAlert(); + void setScreen(QScreen *newScreen, bool recreate); + QWindow::SurfaceType surfaceType; Qt::WindowFlags windowFlags; QWindow *parentWindow; diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 7dc1e7f7e5..6fc63fe96c 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -126,6 +126,13 @@ void QWindowSystemInterface::handleWindowStateChanged(QWindow *tlw, Qt::WindowSt QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } +void QWindowSystemInterface::handleWindowScreenChanged(QWindow *tlw, QScreen *screen) +{ + QWindowSystemInterfacePrivate::WindowScreenChangedEvent *e = + new QWindowSystemInterfacePrivate::WindowScreenChangedEvent(tlw, screen); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); +} + void QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState newState) { Q_ASSERT(QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState)); diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 521c2a4941..b0327701bb 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -138,6 +138,7 @@ public: static void handleWindowActivated(QWindow *w, Qt::FocusReason r = Qt::OtherFocusReason); static void handleWindowStateChanged(QWindow *w, Qt::WindowState newState); + static void handleWindowScreenChanged(QWindow *w, QScreen *newScreen); static void handleApplicationStateChanged(Qt::ApplicationState newState); diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index a6ea15c5f2..c4968f8ca6 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -91,7 +91,8 @@ public: PlatformPanel = UserInputEvent | 0x17, ContextMenu = UserInputEvent | 0x18, ApplicationStateChanged = 0x19, - FlushEvents = 0x20 + FlushEvents = 0x20, + WindowScreenChanged = 0x21 }; class WindowSystemEvent { @@ -158,6 +159,16 @@ public: Qt::WindowState newState; }; + class WindowScreenChangedEvent : public WindowSystemEvent { + public: + WindowScreenChangedEvent(QWindow *w, QScreen *s) + : WindowSystemEvent(WindowScreenChanged), window(w), screen(s) + { } + + QPointer<QWindow> window; + QPointer<QScreen> screen; + }; + class ApplicationStateChangedEvent : public WindowSystemEvent { public: ApplicationStateChangedEvent(Qt::ApplicationState newState) diff --git a/src/gui/opengl/qopenglfunctions_1_0.cpp b/src/gui/opengl/qopenglfunctions_1_0.cpp index 84db0f2d65..b618dcb5cf 100644 --- a/src/gui/opengl/qopenglfunctions_1_0.cpp +++ b/src/gui/opengl/qopenglfunctions_1_0.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_1_0 \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_1_0 class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_1_1.cpp b/src/gui/opengl/qopenglfunctions_1_1.cpp index b4860bcec7..bf032b5cf9 100644 --- a/src/gui/opengl/qopenglfunctions_1_1.cpp +++ b/src/gui/opengl/qopenglfunctions_1_1.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_1_1 \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_1_1 class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_1_2.cpp b/src/gui/opengl/qopenglfunctions_1_2.cpp index 064980bebe..2b14900680 100644 --- a/src/gui/opengl/qopenglfunctions_1_2.cpp +++ b/src/gui/opengl/qopenglfunctions_1_2.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_1_2 \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_1_2 class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_1_3.cpp b/src/gui/opengl/qopenglfunctions_1_3.cpp index ace7507e35..94605f8638 100644 --- a/src/gui/opengl/qopenglfunctions_1_3.cpp +++ b/src/gui/opengl/qopenglfunctions_1_3.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_1_3 \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_1_3 class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_1_4.cpp b/src/gui/opengl/qopenglfunctions_1_4.cpp index a27b81d6d8..e3035eeb55 100644 --- a/src/gui/opengl/qopenglfunctions_1_4.cpp +++ b/src/gui/opengl/qopenglfunctions_1_4.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_1_4 \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_1_4 class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_1_5.cpp b/src/gui/opengl/qopenglfunctions_1_5.cpp index ceb004b02c..581ed14aac 100644 --- a/src/gui/opengl/qopenglfunctions_1_5.cpp +++ b/src/gui/opengl/qopenglfunctions_1_5.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_1_5 \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_1_5 class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_2_0.cpp b/src/gui/opengl/qopenglfunctions_2_0.cpp index 15c042177d..2736d4a030 100644 --- a/src/gui/opengl/qopenglfunctions_2_0.cpp +++ b/src/gui/opengl/qopenglfunctions_2_0.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_2_0 \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_2_0 class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_2_1.cpp b/src/gui/opengl/qopenglfunctions_2_1.cpp index 143ac206ed..ed94131e33 100644 --- a/src/gui/opengl/qopenglfunctions_2_1.cpp +++ b/src/gui/opengl/qopenglfunctions_2_1.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_2_1 \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_2_1 class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_3_0.cpp b/src/gui/opengl/qopenglfunctions_3_0.cpp index e13122e683..e80235b957 100644 --- a/src/gui/opengl/qopenglfunctions_3_0.cpp +++ b/src/gui/opengl/qopenglfunctions_3_0.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_3_0 \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_3_0 class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_3_1.cpp b/src/gui/opengl/qopenglfunctions_3_1.cpp index 104029177c..ab48658bfc 100644 --- a/src/gui/opengl/qopenglfunctions_3_1.cpp +++ b/src/gui/opengl/qopenglfunctions_3_1.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_3_1 \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_3_1 class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp index f808f2e6dd..171b7454f4 100644 --- a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_3_2_Compatibility \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_3_2_Compatibility class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_3_2_core.cpp b/src/gui/opengl/qopenglfunctions_3_2_core.cpp index 0e1af4c28b..48dec29962 100644 --- a/src/gui/opengl/qopenglfunctions_3_2_core.cpp +++ b/src/gui/opengl/qopenglfunctions_3_2_core.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_3_2_Core \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_3_2_Core class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp index aa53b7d03b..8bebc7d0bc 100644 --- a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_3_3_Compatibility \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_3_3_Compatibility class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_3_3_core.cpp b/src/gui/opengl/qopenglfunctions_3_3_core.cpp index d355a466c1..941f9c38b6 100644 --- a/src/gui/opengl/qopenglfunctions_3_3_core.cpp +++ b/src/gui/opengl/qopenglfunctions_3_3_core.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_3_3_Core \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_3_3_Core class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp index af5d3eccc1..7ab0688084 100644 --- a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_4_0_Compatibility \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_4_0_Compatibility class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_4_0_core.cpp b/src/gui/opengl/qopenglfunctions_4_0_core.cpp index b018531b37..a4bf66a44b 100644 --- a/src/gui/opengl/qopenglfunctions_4_0_core.cpp +++ b/src/gui/opengl/qopenglfunctions_4_0_core.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_4_0_Core \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_4_0_Core class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp index 27c90adc5a..a0ea4a052a 100644 --- a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_4_1_Compatibility \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_4_1_Compatibility class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp index a415b24f33..6d19fff92b 100644 --- a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_4_2_Compatibility \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_4_2_Compatibility class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_4_2_core.cpp b/src/gui/opengl/qopenglfunctions_4_2_core.cpp index 3600c20a41..51ba3e8097 100644 --- a/src/gui/opengl/qopenglfunctions_4_2_core.cpp +++ b/src/gui/opengl/qopenglfunctions_4_2_core.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_4_2_Core \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_4_2_Core class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp index 75bcef1562..de6cc185c6 100644 --- a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp +++ b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_4_3_Compatibility \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_4_3_Compatibility class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_4_3_core.cpp b/src/gui/opengl/qopenglfunctions_4_3_core.cpp index bfe1bcc9c4..29fc8368aa 100644 --- a/src/gui/opengl/qopenglfunctions_4_3_core.cpp +++ b/src/gui/opengl/qopenglfunctions_4_3_core.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_4_3_Core \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_4_3_Core class provides all functions for this version and profile of OpenGL. \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglfunctions_es2.cpp b/src/gui/opengl/qopenglfunctions_es2.cpp index afac017d53..20a4b50994 100644 --- a/src/gui/opengl/qopenglfunctions_es2.cpp +++ b/src/gui/opengl/qopenglfunctions_es2.cpp @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLFunctions_ES2 \inmodule QtGui \since 5.1 + \wrapper \brief The QOpenGLFunctions_ES2 class provides all functions for OpenGL ES 2 \sa QAbstractOpenGLFunctions diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp index 555c47f265..0782e42531 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -226,9 +226,17 @@ void QOpenGL2PaintEngineExPrivate::updateBrushTexture() if (currentBrushPixmap.width() > max_texture_size || currentBrushPixmap.height() > max_texture_size) currentBrushPixmap = currentBrushPixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); +#if defined(QT_OPENGL_ES_2) + // OpenGL ES does not support GL_REPEAT wrap modes for NPOT textures. So instead, + // we emulate GL_REPEAT by only taking the fractional part of the texture coords + // in the qopenglslTextureBrushSrcFragmentShader program. + GLuint wrapMode = GL_CLAMP_TO_EDGE; +#else + GLuint wrapMode = GL_REPEAT; +#endif funcs.glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, currentBrushPixmap); - updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); + updateTextureFilter(GL_TEXTURE_2D, wrapMode, q->state()->renderHints & QPainter::SmoothPixmapTransform); textureInvertedY = false; } brushTextureDirty = false; diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 651949192b..3084c8c4c9 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6034,6 +6034,7 @@ void qInitDrawhelperAsm() const uint features = qCpuFeatures(); if (false) { + Q_UNUSED(features); #ifdef QT_COMPILER_SUPPORTS_AVX } else if (features & AVX) { qt_memfill32 = qt_memfill32_avx; diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index ac4589df40..aa175c2d65 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -374,7 +374,7 @@ void QPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDraw \value CoreGraphics Mac OS X's Quartz2D (CoreGraphics) \value QuickDraw Mac OS X's QuickDraw \value QWindowSystem Qt for Embedded Linux - \value PostScript + \value PostScript (No longer supported) \value OpenGL \value Picture QPicture format \value SVG Scalable Vector Graphics XML format diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h index b3e3762cc8..b4dec2929d 100644 --- a/src/gui/painting/qpaintengine.h +++ b/src/gui/painting/qpaintengine.h @@ -196,7 +196,7 @@ public: Windows, QuickDraw, CoreGraphics, MacPrinter, QWindowSystem, - PostScript, + PostScript, // ### Qt 6: Remove, update documentation OpenGL, Picture, SVG, @@ -253,7 +253,6 @@ private: #ifndef QT_NO_QWS_QPF2 friend class QFontEngineQPF; #endif - friend class QPSPrintEngine; friend class QMacPrintEngine; friend class QMacPrintEnginePrivate; friend class QFontEngineQPA; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index a123c147a2..66a4a43cba 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3078,7 +3078,8 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); drawCachedGlyphs(glyphs.size(), glyphs.constData(), positions.constData(), ti.fontEngine); - } else if (matrix.type() < QTransform::TxProject) { + } else if (matrix.type() < QTransform::TxProject + && ti.fontEngine->supportsTransformation(matrix)) { bool invertible; QTransform invMat = matrix.inverted(&invertible); if (!invertible) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index e42b70427c..d950c4e45f 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5727,17 +5727,20 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText staticText_d->needsRelayout = true; } - // If we don't have an extended paint engine, or if the painter is projected, - // we go through standard code path - if (d->extended == 0 || !d->state->matrix.isAffine()) { - staticText_d->paintText(topLeftPosition, this); - return; - } - QFontEngine *fe = staticText_d->font.d->engineForScript(QChar::Script_Common); if (fe->type() == QFontEngine::Multi) fe = static_cast<QFontEngineMulti *>(fe)->engine(0); + // If we don't have an extended paint engine, if the painter is projected, + // or if the font engine does not support the matrix, we go through standard + // code path + if (d->extended == 0 + || !d->state->matrix.isAffine() + || !fe->supportsTransformation(d->state->matrix)) { + staticText_d->paintText(topLeftPosition, this); + return; + } + bool engineRequiresPretransform = d->extended->requiresPretransformedGlyphPositions(fe, d->state->matrix); if (staticText_d->untransformedCoordinates && engineRequiresPretransform) { // The coordinates are untransformed, and the engine can't deal with that diff --git a/src/gui/painting/qrgb.h b/src/gui/painting/qrgb.h index d7a01840e8..3c2bc5b97a 100644 --- a/src/gui/painting/qrgb.h +++ b/src/gui/painting/qrgb.h @@ -52,31 +52,31 @@ typedef unsigned int QRgb; // RGB triplet // non-namespaced Qt global variable const Q_DECL_UNUSED QRgb RGB_MASK = 0x00ffffff; // masks RGB values -inline int qRed(QRgb rgb) // get red part of RGB +inline Q_DECL_CONSTEXPR int qRed(QRgb rgb) // get red part of RGB { return ((rgb >> 16) & 0xff); } -inline int qGreen(QRgb rgb) // get green part of RGB +inline Q_DECL_CONSTEXPR int qGreen(QRgb rgb) // get green part of RGB { return ((rgb >> 8) & 0xff); } -inline int qBlue(QRgb rgb) // get blue part of RGB +inline Q_DECL_CONSTEXPR int qBlue(QRgb rgb) // get blue part of RGB { return (rgb & 0xff); } -inline int qAlpha(QRgb rgb) // get alpha part of RGBA +inline Q_DECL_CONSTEXPR int qAlpha(QRgb rgb) // get alpha part of RGBA { return rgb >> 24; } -inline QRgb qRgb(int r, int g, int b)// set RGB value +inline Q_DECL_CONSTEXPR QRgb qRgb(int r, int g, int b)// set RGB value { return (0xffu << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); } -inline QRgb qRgba(int r, int g, int b, int a)// set RGBA value +inline Q_DECL_CONSTEXPR QRgb qRgba(int r, int g, int b, int a)// set RGBA value { return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); } -inline int qGray(int r, int g, int b)// convert R,G,B to gray 0..255 +inline Q_DECL_CONSTEXPR int qGray(int r, int g, int b)// convert R,G,B to gray 0..255 { return (r*11+g*16+b*5)/32; } -inline int qGray(QRgb rgb) // convert RGB to gray 0..255 +inline Q_DECL_CONSTEXPR int qGray(QRgb rgb) // convert RGB to gray 0..255 { return qGray(qRed(rgb), qGreen(rgb), qBlue(rgb)); } -inline bool qIsGray(QRgb rgb) +inline Q_DECL_CONSTEXPR bool qIsGray(QRgb rgb) { return qRed(rgb) == qGreen(rgb) && qRed(rgb) == qBlue(rgb); } QT_END_NAMESPACE diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 24a1c4c7c3..6d36f7839b 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -285,7 +285,6 @@ private: friend class QFontInfo; friend class QPainter; friend class QPainterPrivate; - friend class QPSPrintEngineFont; friend class QApplication; friend class QWidget; friend class QWidgetPrivate; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index f0f8713f74..855f0099ff 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -411,8 +411,6 @@ public: virtual void setFallbackFamiliesList(const QStringList &) {} protected: - friend class QPSPrintEnginePrivate; - friend class QPSPrintEngineFontMulti; friend class QRawFont; virtual void loadEngine(int at) = 0; virtual void ensureFallbackFamiliesQueried() {} diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index ad3d2bb813..160d66c96c 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -858,11 +858,11 @@ QRect QFontMetrics::tightBoundingRect(const QString &text) const The \a flags argument is optional and currently only supports Qt::TextShowMnemonic as value. - The elide mark will follow the \l{Qt::LayoutDirection}{layout - direction}; it will be on the right side of the text for - right-to-left layouts, and on the left side for right-to-left - layouts. Note that this behavior is independent of the text - language. + The elide mark follows the \l{Qt::LayoutDirection}{layoutdirection}. + For example, it will be on the right side of the text for right-to-left + layouts if the \a mode is \c{Qt::ElideLeft}, and on the left side of the + text if the \a mode is \c{Qt::ElideRight}. + */ QString QFontMetrics::elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags) const { @@ -1643,13 +1643,18 @@ QRectF QFontMetricsF::tightBoundingRect(const QString &text) const Otherwise, returns the original string. The \a mode parameter specifies whether the text is elided on the - left (e.g., "...tech"), in the middle (e.g., "Tr...ch"), or on - the right (e.g., "Trol..."). + left (for example, "...tech"), in the middle (for example, "Tr...ch"), or + on the right (for example, "Trol..."). The \a width is specified in pixels, not characters. The \a flags argument is optional and currently only supports Qt::TextShowMnemonic as value. + + The elide mark follows the \l{Qt::LayoutDirection}{layoutdirection}. + For example, it will be on the right side of the text for right-to-left + layouts if the \a mode is \c{Qt::ElideLeft}, and on the left side of the + text if the \a mode is \c{Qt::ElideRight}. */ QString QFontMetricsF::elidedText(const QString &text, Qt::TextElideMode mode, qreal width, int flags) const { diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 4902a42cd7..6156f56ae1 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -1425,7 +1425,20 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p qreal xoff = fontMetrics.width(QLatin1Char(' ')); if (dir == Qt::LeftToRight) xoff = -xoff - size.width(); - r.translate( xoff, (fontMetrics.height() / 2 - size.height() / 2)); + r.translate( xoff, (fontMetrics.height() / 2) - (size.height() / 2)); + + // Prevent clipping the left side of the list decorator (on left to + // right layouts) and clipping the right side of the list + // decorator (on right to left layouts). + if ((r.left() < 0) && (dir == Qt::LeftToRight)) { + int horizontalOffset = -r.left(); + r.translate(horizontalOffset, 0); + layout->setPosition(layout->position() + QPointF(horizontalOffset, 0)); + } else if ((r.right() > document->pageSize().width()) && (dir == Qt::RightToLeft)) { + int horizontalOffset = r.right() - document->pageSize().width(); + r.translate(-horizontalOffset, 0); + layout->setPosition(layout->position() - QPointF(horizontalOffset, 0)); + } painter->save(); diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h index 8a26fed924..cbe42c3844 100644 --- a/src/gui/text/qtextlayout.h +++ b/src/gui/text/qtextlayout.h @@ -188,7 +188,6 @@ private: Q_DISABLE_COPY(QTextLayout) friend class QPainter; - friend class QPSPrinter; friend class QGraphicsSimpleTextItemPrivate; friend class QGraphicsSimpleTextItem; friend void qt_format_text(const QFont &font, const QRectF &_r, int tf, const QTextOption *, const QString& str, |