diff options
Diffstat (limited to 'src/gui')
| -rw-r--r-- | src/gui/doc/src/qtgui.qdoc | 3 | ||||
| -rw-r--r-- | src/gui/image/qplatformpixmap.cpp | 1 | ||||
| -rw-r--r-- | src/gui/image/qplatformpixmap.h | 5 | ||||
| -rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 9 | ||||
| -rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 5 | ||||
| -rw-r--r-- | src/gui/kernel/qwindow.cpp | 6 | ||||
| -rw-r--r-- | src/gui/painting/qdrawhelper_avx2.cpp | 2 | ||||
| -rw-r--r-- | src/gui/painting/qpainterpath.cpp | 11 | ||||
| -rw-r--r-- | src/gui/painting/qstroker.cpp | 6 | ||||
| -rw-r--r-- | src/gui/platform/darwin/qappleiconengine.mm | 188 | ||||
| -rw-r--r-- | src/gui/platform/darwin/qapplekeymapper.mm | 153 | ||||
| -rw-r--r-- | src/gui/rhi/qrhivulkan.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 | ||||
| -rw-r--r-- | src/gui/vulkan/qvulkanwindow.cpp | 13 |
16 files changed, 238 insertions, 207 deletions
diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc index a89872e70f6..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. diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp index a2977360951..d1eab7f6ed3 100644 --- a/src/gui/image/qplatformpixmap.cpp +++ b/src/gui/image/qplatformpixmap.cpp @@ -36,7 +36,6 @@ QPlatformPixmap::QPlatformPixmap(PixelType pixelType, int objectId) h(0), d(0), is_null(true), - ref(0), detach_no(0), type(pixelType), id(objectId), diff --git a/src/gui/image/qplatformpixmap.h b/src/gui/image/qplatformpixmap.h index be86bf8850f..5621afa4da5 100644 --- a/src/gui/image/qplatformpixmap.h +++ b/src/gui/image/qplatformpixmap.h @@ -22,7 +22,7 @@ QT_BEGIN_NAMESPACE class QImageReader; -class Q_GUI_EXPORT QPlatformPixmap +class Q_GUI_EXPORT QPlatformPixmap : public QSharedData { public: enum PixelType { @@ -113,10 +113,7 @@ private: friend class QPixmap; friend class QX11PlatformPixmap; friend class QImagePixmapCleanupHooks; // Needs to set is_cached - friend class QOpenGLTextureCache; //Needs to check the reference count - friend class QExplicitlySharedDataPointer<QPlatformPixmap>; - QAtomicInt ref; int detach_no; PixelType type; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 098d0331327..518843ffcbd 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3407,6 +3407,15 @@ void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::E return; QWindowPrivate *p = qt_window_private(window); + if (e->isExposed) { + // If the window has been automatically positioned or resized by the + // window manager, we now assume those have taken effect, even for + // asynchronous window managers. From this point on we want the window + // to keep its geometry, even when recreated. + p->positionAutomatic = false; + p->resizeAutomatic = false; + } + if (!p->receivedExpose) { if (p->resizeEventPending) { // as a convenience for plugins, send a resize event before the first expose event if they haven't done so 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/qwindow.cpp b/src/gui/kernel/qwindow.cpp index c23be8eb3ad..bad5932c457 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -582,12 +582,6 @@ void QWindowPrivate::create(bool recursive) platformWindow->initialize(); - // Now that the window is created and initialized the platform has had - // a chance to position and size it automatically. From this point on - // we want the window to keep its geometry, even when recreated. - positionAutomatic = false; - resizeAutomatic = false; - QObjectList childObjects = q->children(); for (int i = 0; i < childObjects.size(); i ++) { QObject *object = childObjects.at(i); diff --git a/src/gui/painting/qdrawhelper_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp index 72853be6e97..d7496845197 100644 --- a/src/gui/painting/qdrawhelper_avx2.cpp +++ b/src/gui/painting/qdrawhelper_avx2.cpp @@ -1525,7 +1525,7 @@ void QT_FASTCALL storeRGBA16FFromARGB32PM_avx2(uchar *dest, const uint *src, int const __m128 vsa = _mm_permute_ps(vsf, _MM_SHUFFLE(3, 3, 3, 3)); __m128 vsr = _mm_rcp_ps(vsa); vsr = _mm_sub_ps(_mm_add_ps(vsr, vsr), _mm_mul_ps(vsr, _mm_mul_ps(vsr, vsa))); - vsr = _mm_insert_ps(vsr, _mm_set_ss(1.0f), 0x30); + vsr = _mm_insert_ps(vsr, vf, 0x30); vsf = _mm_mul_ps(vsf, vsr); } _mm_storel_epi64((__m128i *)(d + i), _mm_cvtps_ph(vsf, 0)); diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 5763696266a..38c4a9ea87f 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -2937,6 +2937,8 @@ qreal QPainterPath::percentAtLength(qreal len) const if (len > totalLength) return 1; + Q_ASSERT(totalLength != 0); + if (d->cacheEnabled) { const int ei = qMax(d->elementAtT(len / totalLength), 1); // Skip initial MoveTo qreal res = 0; @@ -3117,6 +3119,7 @@ QPointF QPainterPath::pointAtPercent(qreal t) const qreal curLen = 0; qreal bezierLen = 0; QBezier b = d_ptr->bezierAtT(*this, t, &curLen, &bezierLen); + Q_ASSERT(bezierLen != 0); qreal realT = (totalLength * t - curLen) / bezierLen; return b.pointAt(qBound(qreal(0), realT, qreal(1))); @@ -3141,10 +3144,14 @@ qreal QPainterPath::angleAtPercent(qreal t) const return 0; } + if (isEmpty()) + return 0; + qreal totalLength = length(); qreal curLen = 0; qreal bezierLen = 0; QBezier bez = d_ptr->bezierAtT(*this, t, &curLen, &bezierLen); + Q_ASSERT(bezierLen != 0); qreal realT = (totalLength * t - curLen) / bezierLen; qreal m1 = slopeAt(realT, bez.x1, bez.x2, bez.x3, bez.x4); @@ -3170,10 +3177,14 @@ qreal QPainterPath::slopeAtPercent(qreal t) const return 0; } + if (isEmpty()) + return 0; + qreal totalLength = length(); qreal curLen = 0; qreal bezierLen = 0; QBezier bez = d_ptr->bezierAtT(*this, t, &curLen, &bezierLen); + Q_ASSERT(bezierLen != 0); qreal realT = (totalLength * t - curLen) / bezierLen; qreal m1 = slopeAt(realT, bez.x1, bez.x2, bez.x3, bez.x4); diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp index 79799ca2ece..0d435c95048 100644 --- a/src/gui/painting/qstroker.cpp +++ b/src/gui/painting/qstroker.cpp @@ -1154,7 +1154,8 @@ void QDashStroker::processCurrentSubpath() elen -= std::floor(elen * invSumLength) * sumLength; // Update dash offset. while (!done) { - qreal dpos = pos + dashes[idash] - doffset - estart; + // parentheses to avoid float rounding issues: qreal(4) + 0.1 - 0.1 - 4 < 0 + qreal dpos = (pos + dashes[idash]) - (doffset + estart); Q_ASSERT(dpos >= 0); @@ -1189,7 +1190,8 @@ void QDashStroker::processCurrentSubpath() bool has_offset = doffset > 0; bool evenDash = (idash & 1) == 0; - qreal dpos = pos + dashes[idash] - doffset - estart; + // parentheses to avoid float rounding issues: qreal(4) + 0.1 - 0.1 - 4 < 0 + qreal dpos = (pos + dashes[idash]) - (doffset + estart); Q_ASSERT(dpos >= 0); diff --git a/src/gui/platform/darwin/qappleiconengine.mm b/src/gui/platform/darwin/qappleiconengine.mm index 20d50b0d8a8..3228b97fdb0 100644 --- a/src/gui/platform/darwin/qappleiconengine.mm +++ b/src/gui/platform/darwin/qappleiconengine.mm @@ -30,27 +30,28 @@ auto *loadImage(const QString &iconName) {"call-start"_L1, @"phone.arrow.up.right"}, {"call-stop"_L1, @"phone.down"}, {"contact-new"_L1, @"person.crop.circle.badge.plus"}, - {"document-new"_L1, @"doc.badge.plus"}, - {"document-open"_L1, @"folder"}, - {"document-open-recent"_L1, @"doc.badge.clock"}, - {"document-page-setup"_L1, @"doc.badge.gearshape"}, + {"document-new"_L1, @"plus"}, + {"document-open"_L1, @"arrow.up.forward"}, + {"document-open-recent"_L1, @"clock"}, + {"document-page-setup"_L1, @"text.page"}, {"document-print"_L1, @"printer"}, - //{"document-print-preview"_L1, @""}, - {"document-properties"_L1, @"doc.badge.ellipsis"}, - //{"document-revert"_L1, @""}, + {"document-print-preview"_L1, @"richtext.page"}, + {"document-properties"_L1, @"info.circle.text.page"}, + {"document-revert"_L1, @"arrow.counterclockwise"}, {"document-save"_L1, @"square.and.arrow.down"}, - //{"document-save-as"_L1, @""}, + {"document-save-as"_L1, @"square.and.arrow.down.on.square"}, {"document-send"_L1, @"paperplane"}, + {"document-export"_L1, @"square.and.arrow.up"}, {"edit-clear"_L1, @"xmark.circle"}, {"edit-copy"_L1, @"doc.on.doc"}, {"edit-cut"_L1, @"scissors"}, - {"edit-delete"_L1, @"delete.left"}, - {"edit-find"_L1, @"magnifyingglass"}, + {"edit-delete"_L1, @"trash"}, + {"edit-find"_L1, @"text.page.badge.magnifyingglass"}, //{"edit-find-replace"_L1, @"arrow.up.left.and.down.right.magnifyingglass"}, - {"edit-paste"_L1, @"clipboard"}, - {"edit-redo"_L1, @"arrowshape.turn.up.right"}, - //{"edit-select-all"_L1, @""}, - {"edit-undo"_L1, @"arrowshape.turn.up.left"}, + {"edit-paste"_L1, @"document.on.clipboard"}, + {"edit-redo"_L1, @"arrow.uturn.forward"}, + {"edit-select-all"_L1, @"character.textbox"}, + {"edit-undo"_L1, @"arrow.uturn.backward"}, {"folder-new"_L1, @"folder.badge.plus"}, {"format-indent-less"_L1, @"decrease.indent"}, {"format-indent-more"_L1, @"increase.indent"}, @@ -65,35 +66,36 @@ auto *loadImage(const QString &iconName) {"format-text-underline"_L1, @"underline"}, {"format-text-strikethrough"_L1, @"strikethrough"}, //{"go-bottom"_L1, @""}, - {"go-down"_L1, @"arrowshape.down"}, - {"go-first"_L1, @"increase.indent"}, + {"go-down"_L1, @"chevron.down"}, + //{"go-first"_L1, @""}, {"go-home"_L1, @"house"}, //{"go-jump"_L1, @""}, //{"go-last"_L1, @""}, - {"go-next"_L1, @"arrowshape.right"}, - {"go-previous"_L1, @"arrowshape.left"}, + {"go-next"_L1, @"chevron.right"}, + {"go-previous"_L1, @"chevron.left"}, //{"go-top"_L1, @""}, - {"go-up"_L1, @"arrowshape.up"}, + {"go-up"_L1, @"chevron.up"}, {"help-about"_L1, @"info.circle"}, //{"help-contents"_L1, @""}, {"help-faq"_L1, @"questionmark.app"}, {"insert-image"_L1, @"photo.badge.plus"}, {"insert-link"_L1, @"link.badge.plus"}, - //{"insert-object"_L1, @""}, - {"insert-text"_L1, @"textformat"}, + {"insert-object"_L1, @"widget.small.badge.plus"}, + {"insert-text"_L1, @"text.badge.plus"}, {"list-add"_L1, @"plus.circle"}, {"list-remove"_L1, @"minus.circle"}, {"mail-forward"_L1, @"arrowshape.turn.up.right"}, {"mail-mark-important"_L1, @"star"}, {"mail-mark-junk"_L1, @"xmark.bin"}, - {"mail-mark-notjunk"_L1, @"trash.slash"}, + {"mail-mark-notjunk"_L1, @"arrow.up.bin"}, {"mail-mark-read"_L1, @"envelope.open"}, - {"mail-mark-unread"_L1, @"envelope.fill"}, + {"mail-mark-unread"_L1, @"envelope.badge"}, {"mail-message-new"_L1, @"square.and.pencil"}, {"mail-reply-all"_L1, @"arrowshape.turn.up.left.2"}, {"mail-reply-sender"_L1, @"arrowshape.turn.up.left"}, - {"mail-send"_L1, @"paperplane"}, - {"mail-send-receive"_L1, @"envelope.arrow.triangle.branch"}, + {"mail-send"_L1, @"arrow.up.circle.fill"}, + {"mail-send-receive"_L1, @"arrow.trianglehead.2.clockwise.rotate.90"}, + {"mail-replied"_L1, @"envelope.and.arrow.trianglehead.branch"}, {"media-eject"_L1, @"eject"}, {"media-playback-pause"_L1, @"pause"}, {"media-playback-start"_L1, @"play"}, @@ -108,61 +110,61 @@ auto *loadImage(const QString &iconName) {"object-rotate-left"_L1, @"rotate.left"}, {"object-rotate-right"_L1, @"rotate.right"}, {"process-stop"_L1, @"stop.circle"}, - {"system-lock-screen"_L1, @"lock.display"}, - {"system-log-out"_L1, @"door.left.hand.open"}, + {"system-lock-screen"_L1, @"lock"}, + {"system-log-out"_L1, @"person.crop.circle"}, //{"system-run"_L1, @""}, {"system-search"_L1, @"magnifyingglass"}, - //{"system-reboot"_L1, @""}, + {"system-reboot"_L1, @"restart"}, {"system-shutdown"_L1, @"power"}, - //{"tools-check-spelling"_L1, @""}, + {"tools-check-spelling"_L1, @"textformat.characters.dottedunderline"}, {"view-fullscreen"_L1, @"arrow.up.left.and.arrow.down.right"}, {"view-refresh"_L1, @"arrow.clockwise"}, {"view-restore"_L1, @"arrow.down.right.and.arrow.up.left"}, - //{"view-sort-ascending"_L1, @""}, - //{"view-sort-descending"_L1, @""}, + {"view-sort-ascending"_L1, @"arrow.up"}, + {"view-sort-descending"_L1, @"arrow.down"}, {"window-close"_L1, @"xmark.circle"}, {"window-new"_L1, @"macwindow.badge.plus"}, {"zoom-fit-best"_L1, @"square.arrowtriangle.4.outward"}, {"zoom-in"_L1, @"plus.magnifyingglass"}, - //{"zoom-original"_L1, @""}, + {"zoom-original"_L1, @"1.magnifyingglass"}, {"zoom-out"_L1, @"minus.magnifyingglass"}, {"process-working"_L1, @"circle.dotted"}, - //{"accessories-calculator"_L1, @""}, - //{"accessories-character-map"_L1, @""}, + {"accessories-calculator"_L1, @"plus.forwardslash.minus"}, + {"accessories-character-map"_L1, @"keyboard.macwindow"}, {"accessories-dictionary"_L1, @"character.book.closed"}, {"accessories-text-editor"_L1, @"textformat"}, {"help-browser"_L1, @"folder.badge.questionmark"}, {"multimedia-volume-control"_L1, @"speaker.wave.3"}, {"preferences-desktop-accessibility"_L1, @"accessibility"}, - //{"preferences-desktop-font"_L1, @""}, - {"preferences-desktop-keyboard"_L1, @"keyboard.badge.ellipsis"}, - //{"preferences-desktop-locale"_L1, @""}, - //{"preferences-desktop-multimedia"_L1, @""}, - //{"preferences-desktop-screensaver"_L1, @""}, - //{"preferences-desktop-theme"_L1, @""}, - //{"preferences-desktop-wallpaper"_L1, @""}, + {"preferences-desktop-font"_L1, @"textformat.characters"}, + {"preferences-desktop-keyboard"_L1, @"keyboard"}, + {"preferences-desktop-locale"_L1, @"mappin.and.ellipse"}, + {"preferences-desktop-multimedia"_L1, @"music.note.tv"}, + {"preferences-desktop-screensaver"_L1, @"display"}, + {"preferences-desktop-theme"_L1, @"paintpalette"}, + {"preferences-desktop-wallpaper"_L1, @"photo.tv"}, {"system-file-manager"_L1, @"folder.badge.gearshape"}, - //{"system-software-install"_L1, @""}, - //{"system-software-update"_L1, @""}, d - //{"utilities-system-monitor"_L1, @""}, + {"system-software-install"_L1, @"laptopcomputer.and.arrow.down"}, + {"system-software-update"_L1, @"laptopcomputer.badge.checkmark"}, + {"utilities-system-monitor"_L1, @"chart.bar.xaxis"}, {"utilities-terminal"_L1, @"apple.terminal"}, - //{"applications-accessories"_L1, @""}, - //{"applications-development"_L1, @""}, - //{"applications-engineering"_L1, @""}, - {"applications-games"_L1, @"gamecontroller"}, - //{"applications-graphics"_L1, @""}, + {"applications-accessories"_L1, @"scanner"}, + {"applications-development"_L1, @"hammer"}, + {"applications-engineering"_L1, @"wrench.and.screwdriver"}, + {"applications-games"_L1, @"gamecontroller.circle"}, + {"applications-graphics"_L1, @"theatermask.and.paintbrush"}, {"applications-internet"_L1, @"network"}, {"applications-multimedia"_L1, @"tv.and.mediabox"}, - //{"applications-office"_L1, @""}, - //{"applications-other"_L1, @""}, + {"applications-office"_L1, @"square.and.pencil.circle"}, + {"applications-other"_L1, @"app.grid"}, {"applications-science"_L1, @"atom"}, - //{"applications-system"_L1, @""}, - //{"applications-utilities"_L1, @""}, + {"applications-system"_L1, @"gear"}, + {"applications-utilities"_L1, @"wrench.and.screwdriver"}, {"preferences-desktop"_L1, @"menubar.dock.rectangle"}, - //{"preferences-desktop-peripherals"_L1, @""}, - //{"preferences-desktop-personal"_L1, @""}, - //{"preferences-other"_L1, @""}, - //{"preferences-system"_L1, @""}, + {"preferences-desktop-peripherals"_L1, @"iphone.and.ipod"}, + {"preferences-desktop-personal"_L1, @"person.badge.key"}, + {"preferences-other"_L1, @"gear"}, + {"preferences-system"_L1, @"gear"}, {"preferences-system-network"_L1, @"network"}, {"system-help"_L1, @"questionmark.diamond"}, {"audio-card"_L1, @"waveform.circle"}, @@ -175,40 +177,40 @@ auto *loadImage(const QString &iconName) {"drive-harddisk"_L1, @"internaldrive"}, {"drive-optical"_L1, @"opticaldiscdrive"}, {"drive-removable-media"_L1, @"externaldrive"}, - {"input-gaming"_L1, @"gamecontroller"}, // "games" also using this one + {"input-gaming"_L1, @"gamecontroller"}, {"input-keyboard"_L1, @"keyboard"}, {"input-mouse"_L1, @"computermouse"}, {"input-tablet"_L1, @"ipad"}, {"media-flash"_L1, @"mediastick"}, //{"media-floppy"_L1, @""}, - //{"media-optical"_L1, @""}, + {"media-optical"_L1, @"opticaldisc"}, {"media-tape"_L1, @"recordingtape"}, - //{"modem"_L1, @""}, - {"multimedia-player"_L1, @"play.rectangle"}, + {"modem"_L1, @"phone.connection"}, + {"multimedia-player"_L1, @"ipod"}, {"network-wired"_L1, @"app.connected.to.app.below.fill"}, {"network-wireless"_L1, @"wifi"}, {"network-workgroup"_L1, @"network"}, - //{"pda"_L1, @""}, + {"pda"_L1, @"flipphone"}, {"phone"_L1, @"iphone"}, {"printer"_L1, @"printer"}, {"scanner"_L1, @"scanner"}, {"video-display"_L1, @"play.display"}, - //{"emblem-default"_L1, @""}, + {"emblem-default"_L1, @"circle"}, {"emblem-documents"_L1, @"doc.circle"}, {"emblem-downloads"_L1, @"arrow.down.circle"}, - {"emblem-favorite"_L1, @"star"}, - {"emblem-important"_L1, @"exclamationmark.bubble.circle"}, - {"emblem-mail"_L1, @"envelope"}, - {"emblem-photos"_L1, @"photo.stack"}, - //{"emblem-readonly"_L1, @""}, - {"emblem-shared"_L1, @"folder.badge.person.crop"}, + {"emblem-favorite"_L1, @"star.circle"}, + {"emblem-important"_L1, @"exclamationmark.circle"}, + {"emblem-mail"_L1, @"envelope.circle"}, + {"emblem-photos"_L1, @"photo.circle"}, + {"emblem-readonly"_L1, @"eye.circle"}, + {"emblem-shared"_L1, @"person.2.circle"}, {"emblem-symbolic-link"_L1, @"link.circle"}, {"emblem-synchronized"_L1, @"arrow.triangle.2.circlepath.circle"}, - {"emblem-system"_L1, @"gear"}, - //{"emblem-unreadable"_L1, @""}, + {"emblem-system"_L1, @"gear.circle"}, + {"emblem-unreadable"_L1, @"eye.slash.circle"}, {"text-x-generic"_L1, @"doc"}, // until iOS 18/macOS 15; @"document" after that {"folder"_L1, @"folder"}, - //{"folder-remote"_L1, @""}, + {"folder-remote"_L1, @"icloud"}, {"network-server"_L1, @"server.rack"}, //{"start-here"_L1, @""}, {"user-bookmarks"_L1, @"bookmark.circle"}, @@ -229,28 +231,28 @@ auto *loadImage(const QString &iconName) {"dialog-question"_L1, @"questionmark.circle"}, {"dialog-warning"_L1, @"exclamationmark.octagon"}, {"folder-drag-accept"_L1, @"plus.rectangle.on.folder"}, - //{"folder-open"_L1, @""}, + {"folder-open"_L1, @"arrow.forward.folder"}, {"folder-visiting"_L1, @"folder.circle"}, - {"image-loading"_L1, @"photo.circle"}, - {"image-missing"_L1, @"photo"}, + {"image-loading"_L1, @"photo.badge.arrow.down"}, + {"image-missing"_L1, @"photo.badge.exclamationmark"}, {"mail-attachment"_L1, @"paperclip"}, {"mail-unread"_L1, @"envelope.badge"}, {"mail-read"_L1, @"envelope.open"}, - {"mail-replied"_L1, @"arrowshape.turn.up.left"}, + //{"mail-replied"_L1, @""}, //{"mail-signed"_L1, @""}, - //{"mail-signed-verified"_L1, @""}, - {"media-playlist-repeat"_L1, @"repet"}, + {"mail-signed-verified"_L1, @"envelope.badge.shield.half.filled"}, + {"media-playlist-repeat"_L1, @"repeat"}, {"media-playlist-shuffle"_L1, @"shuffle"}, - //{"network-error"_L1, @""}, - //{"network-idle"_L1, @""}, - {"network-offline"_L1, @"network.slash"}, - //{"network-receive"_L1, @""}, - //{"network-transmit"_L1, @""}, - //{"network-transmit-receive"_L1, @""}, + {"network-error"_L1, @"xmark.icloud"}, + {"network-idle"_L1, @"icloud"}, + {"network-offline"_L1, @"icloud.slash"}, + {"network-receive"_L1, @"icloud.and.arrow.down"}, + {"network-transmit"_L1, @"icloud.and.arrow.up"}, + {"network-transmit-receive"_L1, @"arrow.trianglehead.2.clockwise.rotate.90.icloud"}, //{"printer-error"_L1, @""}, - {"printer-printing"_L1, @"printer.dotmatrix.filled.and.paper"}, // not sure - {"security-high"_L1, @"lock.shield"}, - //{"security-medium"_L1, @""}, + {"printer-printing"_L1, @"printer.dotmatrix"}, + {"security-high"_L1, @"lock.badge.checkmark"}, + {"security-medium"_L1, @"lock"}, {"security-low"_L1, @"lock.trianglebadge.exclamationmark"}, {"software-update-available"_L1, @"arrowshape.up.circle"}, {"software-update-urgent"_L1, @"exclamationmark.transmission"}, @@ -258,9 +260,9 @@ auto *loadImage(const QString &iconName) {"sync-synchronizing"_L1, @"arrow.triangle.2.circlepath"}, {"task-due"_L1, @"clock.badge.exclamationmark"}, {"task-past-due"_L1, @"clock.badge.xmark"}, - {"user-available"_L1, @"person.crop.circle.badge.checkmark"}, - {"user-away"_L1, @"person.crop.circle.badge.clock"}, - //{"user-idle"_L1, @""}, + {"user-available"_L1, @"person.crop.circle.badge"}, + {"user-away"_L1, @"person.crop.circle.badge.moon"}, + {"user-idle"_L1, @"person.crop.circle.badge.clock"}, {"user-offline"_L1, @"person.crop.circle.badge.xmark"}, //{"user-trash-full"_L1, @""}, {"weather-clear"_L1, @"sun.max"}, @@ -269,9 +271,9 @@ auto *loadImage(const QString &iconName) {"weather-few-clouds-night"_L1, @"cloud.moon"}, {"weather-fog"_L1, @"cloud.fog"}, {"weather-overcast"_L1, @"cloud"}, - //{"weather-severe-alert"_L1, @""}, - {"weather-showers"_L1, @"cloud.rain"}, - //{"weather-showers-scattered"_L1, @""}, + {"weather-severe-alert"_L1, @"cloud.bolt.rain"}, + {"weather-showers"_L1, @"cloud.heavyrain"}, + {"weather-showers-scattered"_L1, @"cloud.drizzle"}, {"weather-snow"_L1, @"cloud.snow"}, {"weather-storm"_L1, @"tropicalstorm"}, }; diff --git a/src/gui/platform/darwin/qapplekeymapper.mm b/src/gui/platform/darwin/qapplekeymapper.mm index 214865864ff..49f7a8ff0cb 100644 --- a/src/gui/platform/darwin/qapplekeymapper.mm +++ b/src/gui/platform/darwin/qapplekeymapper.mm @@ -94,60 +94,10 @@ static CarbonModifiers toCarbonModifiers(Qt::KeyboardModifiers qtModifiers) return carbonModifiers; } -// Keyboard keys (non-modifiers) -static QHash<char16_t, Qt::Key> standardKeys = { - { kHomeCharCode, Qt::Key_Home }, - { kEnterCharCode, Qt::Key_Enter }, - { kEndCharCode, Qt::Key_End }, - { kBackspaceCharCode, Qt::Key_Backspace }, - { kTabCharCode, Qt::Key_Tab }, - { kPageUpCharCode, Qt::Key_PageUp }, - { kPageDownCharCode, Qt::Key_PageDown }, - { kReturnCharCode, Qt::Key_Return }, - { kEscapeCharCode, Qt::Key_Escape }, - { kLeftArrowCharCode, Qt::Key_Left }, - { kRightArrowCharCode, Qt::Key_Right }, - { kUpArrowCharCode, Qt::Key_Up }, - { kDownArrowCharCode, Qt::Key_Down }, - { kHelpCharCode, Qt::Key_Help }, - { kDeleteCharCode, Qt::Key_Delete }, - // ASCII maps, for debugging - { ':', Qt::Key_Colon }, - { ';', Qt::Key_Semicolon }, - { '<', Qt::Key_Less }, - { '=', Qt::Key_Equal }, - { '>', Qt::Key_Greater }, - { '?', Qt::Key_Question }, - { '@', Qt::Key_At }, - { ' ', Qt::Key_Space }, - { '!', Qt::Key_Exclam }, - { '"', Qt::Key_QuoteDbl }, - { '#', Qt::Key_NumberSign }, - { '$', Qt::Key_Dollar }, - { '%', Qt::Key_Percent }, - { '&', Qt::Key_Ampersand }, - { '\'', Qt::Key_Apostrophe }, - { '(', Qt::Key_ParenLeft }, - { ')', Qt::Key_ParenRight }, - { '*', Qt::Key_Asterisk }, - { '+', Qt::Key_Plus }, - { ',', Qt::Key_Comma }, - { '-', Qt::Key_Minus }, - { '.', Qt::Key_Period }, - { '/', Qt::Key_Slash }, - { '[', Qt::Key_BracketLeft }, - { ']', Qt::Key_BracketRight }, - { '\\', Qt::Key_Backslash }, - { '_', Qt::Key_Underscore }, - { '`', Qt::Key_QuoteLeft }, - { '{', Qt::Key_BraceLeft }, - { '}', Qt::Key_BraceRight }, - { '|', Qt::Key_Bar }, - { '~', Qt::Key_AsciiTilde }, - { '^', Qt::Key_AsciiCircum } -}; - -static QHash<char16_t, Qt::Key> virtualKeys = { +// NSEvent.keyCode codes for keys that are independent of keyboard layout. +// Some of these are technically possible to add custom key maps for, but +// doing so would be unexpected. +static QHash<char16_t, Qt::Key> layoutIndependentKeyCodes = { { kVK_F1, Qt::Key_F1 }, { kVK_F2, Qt::Key_F2 }, { kVK_F3, Qt::Key_F3 }, @@ -164,16 +114,57 @@ static QHash<char16_t, Qt::Key> virtualKeys = { { kVK_F14, Qt::Key_F14 }, { kVK_F15, Qt::Key_F15 }, { kVK_F16, Qt::Key_F16 }, + { kVK_F17, Qt::Key_F17 }, + { kVK_F18, Qt::Key_F18 }, + { kVK_F19, Qt::Key_F19 }, + { kVK_F20, Qt::Key_F20 }, + { kVK_Return, Qt::Key_Return }, { kVK_Tab, Qt::Key_Tab }, + { kVK_Space, Qt::Key_Space }, { kVK_Escape, Qt::Key_Escape }, - { kVK_Help, Qt::Key_Help }, + { kVK_Delete, Qt::Key_Backspace }, + { kVK_ForwardDelete, Qt::Key_Delete }, + + { kVK_Home, Qt::Key_Home }, + { kVK_End, Qt::Key_End }, + { kVK_PageUp, Qt::Key_PageUp }, + { kVK_PageDown, Qt::Key_PageDown }, + { kVK_UpArrow, Qt::Key_Up }, { kVK_DownArrow, Qt::Key_Down }, { kVK_LeftArrow, Qt::Key_Left }, { kVK_RightArrow, Qt::Key_Right }, - { kVK_PageUp, Qt::Key_PageUp }, - { kVK_PageDown, Qt::Key_PageDown } + + { kVK_CapsLock, Qt::Key_CapsLock }, + { kVK_Shift, Qt::Key_Shift }, + { kVK_RightShift, Qt::Key_Shift }, + +#if 0 + // FIXME: Map these here instead of relying on + // custom logic in [QNSView flagsChanged:] + + { kVK_Command, Qt::Key_unknown }, + { kVK_RightCommand, Qt::Key_unknown }, + { kVK_Option, Qt::Key_unknown }, + { kVK_RightOption, Qt::Key_unknown }, + { kVK_Control, Qt::Key_unknown }, + { kVK_RightControl, Qt::Key_unknown }, + { kVK_Function, Qt::Key_unknown }, +#endif + + { kVK_VolumeUp, Qt::Key_VolumeUp }, + { kVK_VolumeDown, Qt::Key_VolumeDown }, + { kVK_Mute, Qt::Key_VolumeMute }, + +#if 0 + // FIXME: Figure out which Qt::Key this maps to + { kVK_ContextualMenu, Qt::Key_unknown }, +#endif + { kVK_Help, Qt::Key_Help }, + + { kVK_ANSI_KeypadClear, Qt::Key_Clear }, + { kVK_ANSI_KeypadEnter, Qt::Key_Enter }, }; static QHash<char16_t, Qt::Key> functionKeys = { @@ -211,41 +202,19 @@ static int toKeyCode(const QChar &key, int virtualKey, int modifiers) qCDebug(lcQpaKeyMapperKeys, "Mapping key: %d (0x%04x) / vk %d (0x%04x)", key.unicode(), key.unicode(), virtualKey, virtualKey); - if (key == char16_t(kClearCharCode) && virtualKey == 0x47) - return Qt::Key_Clear; - - if (key.isDigit()) { - qCDebug(lcQpaKeyMapperKeys, "Got digit key: %d", key.digitValue()); - return key.digitValue() + Qt::Key_0; - } - - if (key.isLetter()) { - qCDebug(lcQpaKeyMapperKeys, "Got letter key: %d", (key.toUpper().unicode() - 'A')); - return (key.toUpper().unicode() - 'A') + Qt::Key_A; - } - if (key.isSymbol()) { - qCDebug(lcQpaKeyMapperKeys, "Got symbol key: %d", (key.unicode())); - return key.unicode(); - } - - if (auto qtKey = standardKeys.value(key.unicode())) { + // Check first if we have a virtual key that should be treated as layout + // independent. If so, we want to return early without inspecting the key. + if (auto qtKey = layoutIndependentKeyCodes.value(virtualKey)) { + qCDebug(lcQpaKeyMapperKeys) << "Got" << qtKey << "based on layout independent virtual key"; // To work like Qt for X11 we issue Backtab when Shift + Tab are pressed if (qtKey == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) { - qCDebug(lcQpaKeyMapperKeys, "Got key: Qt::Key_Backtab"); + qCDebug(lcQpaKeyMapperKeys, "Transformed into Qt::Key_Backtab"); return Qt::Key_Backtab; } - - qCDebug(lcQpaKeyMapperKeys) << "Got" << qtKey; - return qtKey; - } - - // Last ditch try to match the scan code - if (auto qtKey = virtualKeys.value(virtualKey)) { - qCDebug(lcQpaKeyMapperKeys) << "Got scancode" << qtKey; return qtKey; } - // Check if they belong to key codes in private unicode range + // Then check if the key is one of the functions keys in the private Unicode range if (key >= char16_t(NSUpArrowFunctionKey) && key <= char16_t(NSModeSwitchFunctionKey)) { if (auto qtKey = functionKeys.value(key.unicode())) { qCDebug(lcQpaKeyMapperKeys) << "Got" << qtKey; @@ -257,6 +226,20 @@ static int toKeyCode(const QChar &key, int virtualKey, int modifiers) } } + if (key.isDigit()) { + qCDebug(lcQpaKeyMapperKeys, "Got digit key: %d", key.digitValue()); + return key.digitValue() + Qt::Key_0; + } + + if (key.isLetter()) { + qCDebug(lcQpaKeyMapperKeys, "Got letter key: %d", (key.toUpper().unicode() - 'A')); + return (key.toUpper().unicode() - 'A') + Qt::Key_A; + } + if (key.isSymbol()) { + qCDebug(lcQpaKeyMapperKeys, "Got symbol key: %d", (key.unicode())); + return key.unicode(); + } + qCDebug(lcQpaKeyMapperKeys, "Unknown case.. %d[%d] %d", key.unicode(), key.toLatin1(), virtualKey); return Qt::Key_unknown; } diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index b946f8777b6..c5167a6e7de 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -8824,6 +8824,18 @@ bool QVkSwapChain::ensureSurface() if (ok) { colorFormat = formats[i].format; colorSpace = formats[i].colorSpace; +#if QT_CONFIG(wayland) + // On Wayland, only one color management surface can be created at a time without + // triggering a protocol error, and we create one ourselves in some situations. + // To avoid this problem, use VK_COLOR_SPACE_PASS_THROUGH_EXT when supported, + // so that the driver doesn't create a color management surface as well. + const bool hasPassThrough = std::any_of(formats.begin(), formats.end(), [this](const VkSurfaceFormatKHR &fmt) { + return fmt.format == colorFormat && fmt.colorSpace == VK_COLOR_SPACE_PASS_THROUGH_EXT; + }); + if (hasPassThrough) { + colorSpace = VK_COLOR_SPACE_PASS_THROUGH_EXT; + } +#endif break; } } 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; diff --git a/src/gui/vulkan/qvulkanwindow.cpp b/src/gui/vulkan/qvulkanwindow.cpp index a1457006888..1e52e460d38 100644 --- a/src/gui/vulkan/qvulkanwindow.cpp +++ b/src/gui/vulkan/qvulkanwindow.cpp @@ -871,6 +871,19 @@ void QVulkanWindowPrivate::init() } } +#if QT_CONFIG(wayland) + // On Wayland, only one color management surface can be created at a time without + // triggering a protocol error, and we create one ourselves in some situations. + // To avoid this problem, use VK_COLOR_SPACE_PASS_THROUGH_EXT when supported, + // so that the driver doesn't create a color management surface as well. + const bool hasPassthrough = std::any_of(formats.cbegin(), formats.cend(), [this](const VkSurfaceFormatKHR &format) { + return format.format == colorFormat && format.colorSpace == VK_COLOR_SPACE_PASS_THROUGH_EXT; + }); + if (hasPassthrough) { + colorSpace = VK_COLOR_SPACE_PASS_THROUGH_EXT; + } +#endif + const VkFormat dsFormatCandidates[] = { VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, |
