diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/accessible/linux/qspiaccessiblebridge.cpp | 6 | ||||
-rw-r--r-- | src/gui/accessible/qaccessible.cpp | 1 | ||||
-rw-r--r-- | src/gui/accessible/qaccessible_base.h | 1 | ||||
-rw-r--r-- | src/gui/accessible/qaccessibleobject.cpp | 4 | ||||
-rw-r--r-- | src/gui/doc/images/plaintext-layout.png | bin | 46384 -> 0 bytes | |||
-rw-r--r-- | src/gui/doc/images/plaintext-layout.webp | bin | 0 -> 7714 bytes | |||
-rw-r--r-- | src/gui/doc/src/qtgui.qdoc | 5 | ||||
-rw-r--r-- | src/gui/doc/src/richtext.qdoc | 2 | ||||
-rw-r--r-- | src/gui/image/qiconloader.cpp | 13 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qplatformwindow_p.h | 12 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 33 | ||||
-rw-r--r-- | src/gui/painting/qpainter_p.h | 3 | ||||
-rw-r--r-- | src/gui/text/qtextdocumentfragment.cpp | 12 | ||||
-rw-r--r-- | src/gui/text/qtextformat.cpp | 4 | ||||
-rw-r--r-- | src/gui/util/qundostack.cpp | 12 | ||||
-rw-r--r-- | src/gui/util/qundostack_p.h | 15 |
17 files changed, 87 insertions, 41 deletions
diff --git a/src/gui/accessible/linux/qspiaccessiblebridge.cpp b/src/gui/accessible/linux/qspiaccessiblebridge.cpp index 1ee1a435ca5..11b3bc57471 100644 --- a/src/gui/accessible/linux/qspiaccessiblebridge.cpp +++ b/src/gui/accessible/linux/qspiaccessiblebridge.cpp @@ -184,6 +184,12 @@ static RoleMapping map[] = { //: Role of an accessible object { QAccessible::CheckBox, ATSPI_ROLE_CHECK_BOX, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "check box") }, //: Role of an accessible object +#if ATSPI_ROLE_COUNT >= 132 + { QAccessible::Switch, ATSPI_ROLE_SWITCH, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "switch") }, +#else + { QAccessible::Switch, ATSPI_ROLE_CHECK_BOX, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "check box") }, +#endif + //: Role of an accessible object { QAccessible::RadioButton, ATSPI_ROLE_RADIO_BUTTON, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "radio button") }, //: Role of an accessible object { QAccessible::ComboBox, ATSPI_ROLE_COMBO_BOX, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "combo box") }, diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 97f7eb94e2a..eeb06c535b8 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -342,6 +342,7 @@ Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core"); \value Splitter A splitter distributing available space between its child widgets. \value StaticText Static text, such as labels for other widgets. \value StatusBar A status bar. + \value [since 6.11] Switch A switch that can be toggled on or off. \value Table A table representing data in a grid of rows and columns. \value Terminal A terminal or command line interface. \value TitleBar The title bar caption of a window. diff --git a/src/gui/accessible/qaccessible_base.h b/src/gui/accessible/qaccessible_base.h index 0a1a305b76d..31b97880ffc 100644 --- a/src/gui/accessible/qaccessible_base.h +++ b/src/gui/accessible/qaccessible_base.h @@ -267,6 +267,7 @@ public: WebDocument = 0x00000084, Section = 0x00000085, Notification = 0x00000086, + Switch = 0x00000087, // IAccessible2 roles // IA2_ROLE_CANVAS = 0x401, // An object that can be drawn into and to manage events from the objects drawn into it diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp index 5c723cdb289..9edb0dff4fd 100644 --- a/src/gui/accessible/qaccessibleobject.cpp +++ b/src/gui/accessible/qaccessibleobject.cpp @@ -119,14 +119,14 @@ QWindow *QAccessibleApplication::window() const return nullptr; } -// all toplevel windows except popups and the desktop +// all toplevel windows except popups static QObjectList topLevelObjects() { QObjectList list; const QWindowList tlw(QGuiApplication::topLevelWindows()); for (int i = 0; i < tlw.size(); ++i) { QWindow *w = tlw.at(i); - if (w->type() != Qt::Popup && w->type()) { + if (w->type() != Qt::Popup) { if (QAccessibleInterface *root = w->accessibleRoot()) { if (root->object()) list.append(root->object()); diff --git a/src/gui/doc/images/plaintext-layout.png b/src/gui/doc/images/plaintext-layout.png Binary files differdeleted file mode 100644 index 9172d7a044d..00000000000 --- a/src/gui/doc/images/plaintext-layout.png +++ /dev/null diff --git a/src/gui/doc/images/plaintext-layout.webp b/src/gui/doc/images/plaintext-layout.webp Binary files differnew file mode 100644 index 00000000000..b8266ec5a8c --- /dev/null +++ b/src/gui/doc/images/plaintext-layout.webp diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc index dca2f10bf26..f5d60699deb 100644 --- a/src/gui/doc/src/qtgui.qdoc +++ b/src/gui/doc/src/qtgui.qdoc @@ -17,8 +17,7 @@ /*! \module QtGuiPrivate \title Qt GUI Private C++ Classes - \qtcmakepackage Gui - \qtcmaketargetitem GuiPrivate + \qtcmakepackage GuiPrivate \qtvariable gui-private \brief Provides access to private GUI functionality. @@ -27,7 +26,7 @@ private Qt GUI APIs: \badcode - find_package(Qt6 REQUIRED COMPONENTS Gui) + find_package(Qt6 REQUIRED COMPONENTS GuiPrivate) target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate) \endcode */ diff --git a/src/gui/doc/src/richtext.qdoc b/src/gui/doc/src/richtext.qdoc index 429233ec8f1..2fa49a31e03 100644 --- a/src/gui/doc/src/richtext.qdoc +++ b/src/gui/doc/src/richtext.qdoc @@ -650,7 +650,7 @@ the QTextLayout class, to help developers perform word-wrapping and layout tasks without the need to create a document first. - \image plaintext-layout.png {Screenshot of a text that flows around a + \image plaintext-layout.webp {Screenshot of a text that flows around a circle.} Formatting and drawing a paragraph of plain text is straightforward. diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 8e21c92f9b3..8f29fb503b0 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -352,8 +352,8 @@ QIconTheme::QIconTheme(const QString &themeName) QFile themeIndex; const QStringList iconDirs = QIcon::themeSearchPaths(); - for ( int i = 0 ; i < iconDirs.size() ; ++i) { - QDir iconDir(iconDirs[i]); + for (const auto &dirName : iconDirs) { + QDir iconDir(dirName); QString themeDir = iconDir.path() + u'/' + themeName; QFileInfo themeDirInfo(themeDir); @@ -479,7 +479,7 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName, const QString pngIconName = iconNameFallback + ".png"_L1; // Add all relevant files - for (int i = 0; i < contentDirs.size(); ++i) { + for (qsizetype i = 0; i < contentDirs.size(); ++i) { QList<QIconDirInfo> subDirs = theme.keyList(); // Try to reduce the amount of subDirs by looking in the GTK+ cache in order to save @@ -504,8 +504,7 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName, } QString contentDir = contentDirs.at(i) + u'/'; - for (int j = 0; j < subDirs.size() ; ++j) { - const QIconDirInfo &dirInfo = subDirs.at(j); + for (const auto &dirInfo : std::as_const(subDirs)) { if (searchingGenericFallback && (dirInfo.context == QIconDirInfo::Applications || dirInfo.context == QIconDirInfo::MimeTypes)) @@ -544,9 +543,9 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName, << "skipping visited" << visited; // Search recursively through inherited themes - for (int i = 0 ; i < parents.size() ; ++i) { + for (const auto &parent : parents) { - const QString parentTheme = parents.at(i).trimmed(); + const QString parentTheme = parent.trimmed(); if (!visited.contains(parentTheme)) // guard against recursion info = findIconHelper(parentTheme, iconName, visited, QIconLoader::NoFallBack); diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index c7b6e4ebff3..bb71f8fb6fc 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1298,7 +1298,10 @@ QString QKeySequencePrivate::keyName(Qt::Key key, QKeySequence::SequenceFormat f bool nativeText = (format == QKeySequence::NativeText); QString p; - if (key && key < Qt::Key_Escape && key != Qt::Key_Space) { + if (nativeText && (key > 0x00 && key <= 0x1f)) { + // Map C0 control codes to the corresponding Control Pictures + p = QChar::fromUcs2(0x2400 + key); + } else if (key && key < Qt::Key_Escape && key != Qt::Key_Space) { if (!QChar::requiresSurrogates(key)) { p = QChar::fromUcs2(key).toUpper(); } else { diff --git a/src/gui/kernel/qplatformwindow_p.h b/src/gui/kernel/qplatformwindow_p.h index c446ac760c0..24c0fd7c431 100644 --- a/src/gui/kernel/qplatformwindow_p.h +++ b/src/gui/kernel/qplatformwindow_p.h @@ -125,6 +125,14 @@ struct Q_GUI_EXPORT QWaylandWindow : public QObject public: QT_DECLARE_NATIVE_INTERFACE(QWaylandWindow, 1, QWindow) + enum WindowType { + Default, + ToolTip, + ComboBox, + Menu, + SubMenu, + }; + virtual wl_surface *surface() const = 0; virtual void setCustomMargins(const QMargins &margins) = 0; virtual void requestXdgActivationToken(uint serial) = 0; @@ -136,6 +144,10 @@ public: return role ? *role : nullptr; } virtual void setSessionRestoreId(const QString &role) = 0; + + virtual void setExtendedWindowType(WindowType windowType) = 0; + virtual void setParentControlGeometry(const QRect &parentAnchor) = 0; + Q_SIGNALS: void surfaceCreated(); void surfaceDestroyed(); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 3b64a8ecf73..a3f9f069b69 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1527,14 +1527,14 @@ void QPainterPrivate::initFrom(const QPaintDevice *device) Q_Q(QPainter); device->initPainter(q); +} - if (extended) { - extended->penChanged(); - } else if (engine) { - engine->setDirty(QPaintEngine::DirtyPen); - engine->setDirty(QPaintEngine::DirtyBrush); - engine->setDirty(QPaintEngine::DirtyFont); - } +void QPainterPrivate::setEngineDirtyFlags(QSpan<const QPaintEngine::DirtyFlags> flags) +{ + if (!engine) + return; + for (const QPaintEngine::DirtyFlags f : flags) + engine->setDirty(f); } /*! @@ -1801,14 +1801,16 @@ bool QPainter::begin(QPaintDevice *pd) d->engine->setActive(begun); } - // Copy painter properties from original paint device, - // required for QPixmap::grabWidget() - if (d->original_device->devType() == QInternal::Widget) { + switch (d->original_device->devType()) { + case QInternal::Widget: d->initFrom(d->original_device); - } else { + break; + + default: d->state->layoutDirection = Qt::LayoutDirectionAuto; // make sure we have a font compatible with the paintdevice d->state->deviceFont = d->state->font = QFont(d->state->deviceFont, device()); + break; } QRect systemRect = d->engine->systemRect(); @@ -1834,6 +1836,15 @@ bool QPainter::begin(QPaintDevice *pd) d->state->emulationSpecifier = 0; + switch (d->original_device->devType()) { + case QInternal::Widget: + // for widgets we've aleady initialized the painter above + break; + default: + d->initFrom(d->original_device); + break; + } + return true; } diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h index dd4653a5788..a6f93134ca0 100644 --- a/src/gui/painting/qpainter_p.h +++ b/src/gui/painting/qpainter_p.h @@ -15,6 +15,7 @@ // We mean it. // +#include <QtCore/qspan.h> #include <QtCore/qvarlengtharray.h> #include <QtGui/private/qtguiglobal_p.h> #include "QtGui/qbrush.h" @@ -242,6 +243,8 @@ public: std::unique_ptr<QEmulationPaintEngine> emulationEngine; QPaintEngineEx *extended = nullptr; QBrush colorBrush; // for fill with solid color + + Q_GUI_EXPORT void setEngineDirtyFlags(QSpan<const QPaintEngine::DirtyFlags>); }; Q_GUI_EXPORT void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivate::DrawOperation operation); diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp index 1b6e76c2017..5797d1a68b4 100644 --- a/src/gui/text/qtextdocumentfragment.cpp +++ b/src/gui/text/qtextdocumentfragment.cpp @@ -16,6 +16,7 @@ #include <qbytearray.h> #include <qdatastream.h> #include <qdatetime.h> +#include <QtCore/private/qstringiterator_p.h> QT_BEGIN_NAMESPACE @@ -582,8 +583,11 @@ bool QTextHtmlImporter::appendNodeText() QString textToInsert; textToInsert.reserve(text.size()); - for (QChar ch : text) { - if (ch.isSpace() + QStringIterator it(text); + while (it.hasNext()) { + char32_t ch = it.next(); + + if (QChar::isSpace(ch) && ch != QChar::Nbsp && ch != QChar::ParagraphSeparator) { @@ -646,12 +650,12 @@ bool QTextHtmlImporter::appendNodeText() format.setAnchor(true); format.setAnchorNames(namedAnchors); - cursor.insertText(ch, format); + cursor.insertText(QString::fromUcs4(&ch, 1), format); namedAnchors.clear(); format.clearProperty(QTextFormat::IsAnchor); format.clearProperty(QTextFormat::AnchorName); } else { - textToInsert += ch; + textToInsert += QChar::fromUcs4(ch); } } } diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 53a984306c6..d722bceb289 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -657,8 +657,8 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextTableCellFormat & \value FontStyleName \value FontPointSize \value FontPixelSize - \value FontSizeAdjustment Specifies the change in size given to the fontsize already set using - FontPointSize or FontPixelSize. + \value FontSizeAdjustment Specifies an integer adjustment added to the base font size set using + \c FontPointSize or \c FontPixelSize. \value FontFixedPitch \omitvalue FontSizeIncrement \value FontWeight diff --git a/src/gui/util/qundostack.cpp b/src/gui/util/qundostack.cpp index 3d1d8a2b788..27b131cd733 100644 --- a/src/gui/util/qundostack.cpp +++ b/src/gui/util/qundostack.cpp @@ -425,16 +425,16 @@ void QUndoStackPrivate::setIndex(int idx, bool clean) emit q->indexChanged(index); } - const ActionState newUndoState{q->canUndo(), q->undoText()}; - if (indexChanged || newUndoState != undoActionState) { - undoActionState = newUndoState; + if (ActionState newUndoState{q->canUndo(), q->undoText()}; + indexChanged || newUndoState != undoActionState) { + undoActionState = std::move(newUndoState); emit q->canUndoChanged(undoActionState.enabled); emit q->undoTextChanged(undoActionState.text); } - const ActionState newRedoState{q->canRedo(), q->redoText()}; - if (indexChanged || newRedoState != redoActionState) { - redoActionState = newRedoState; + if (ActionState newRedoState{q->canRedo(), q->redoText()}; + indexChanged || newRedoState != redoActionState) { + redoActionState = std::move(newRedoState); emit q->canRedoChanged(redoActionState.enabled); emit q->redoTextChanged(redoActionState.text); } diff --git a/src/gui/util/qundostack_p.h b/src/gui/util/qundostack_p.h index fea201ce62d..6bdcf5fb20b 100644 --- a/src/gui/util/qundostack_p.h +++ b/src/gui/util/qundostack_p.h @@ -59,10 +59,17 @@ public: bool enabled = false; QString text; - bool operator!=(const ActionState &other) const noexcept - { - return enabled != other.enabled || text != other.text; - } + friend bool operator==(const ActionState &lhs, const ActionState &rhs) noexcept +#ifdef __cpp_impl_three_way_comparison + = default; +#else + { return lhs.enabled == rhs.enabled && lhs.text == rhs.text; } + friend bool operator!=(const ActionState &lhs, const ActionState &rhs) noexcept + { return !(lhs == rhs); } +#endif + // some compiler's reject seed = 0) = delete, overload instead: + friend void qHash(const ActionState &key, size_t seed) = delete; + friend void qHash(const ActionState &key) = delete; }; QList<QUndoCommand*> command_list; |