summaryrefslogtreecommitdiff
path: root/src/gui/kernel
Commit message (Collapse)AuthorAgeFilesLines
* Clarify documentation about QGuiApplication::setDesktopFileName formatDavid Edmundson2023-05-161-3/+3
| | | | | | | | | | | Whislt the documentation says "base name" there are lots of examples in the wild of clients using the wrong name here. Writing it explicitly might help. Task-number: QTBUG-75521 Pick-to: 6.5 Change-Id: Ic17ca161cf58449e85e25d9b6b8ace44fe14f18a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* qoffscreensurface.h: Add module to Q_MOC_INCLUDEFabian Kosmale2023-05-161-1/+1
| | | | | | | | | | | Depending on the build configuration, just using <QScreen> will not find the header. Pick-to: 6.5 Fixes: QTBUG-113619 Change-Id: Iaaf6f75ce82f8e32a1b1835614accd898b45824e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* wasm: Add DOM accessors functions through NativeInterfacePiotr Wierciński2023-05-052-0/+13
| | | | | | | | | | | Expose document and clientArea emscripten objects through NativeInterface. This is required by WebView implementation for wasm platform. Task-number: QTBUG-75183 Change-Id: I6f2f084a9dbceb80d2186c7395c008f268a91e39 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
* QGuiApplication: Propagate wheel event accepted stateMorten Sørvig2023-05-021-0/+1
| | | | | | | | | | | | Propagate the accepted state from the QtGui event to the QWindowsSystemInterface event. This makes it possible for the platform plugins to propagate rejected wheel events to the native OS. Pick-to: 6.5 Task-number: QTBUG-107441 Change-Id: Ifa90ed2430e56120a1a04b6a5872a153d26aa6bc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Allow disable native messagebox dialogThorbjørn Lund Martsum2023-05-022-0/+34
| | | | | | | | | | | | | | | | | | | | | | The native style may not match the program style and it makes sense to give an option rather than forcing native style. Before it could only be done with setting AA_DontUseNativeDialogs on the app, but it is reasonable to use native file dialogs and Qt styled messageboxes - and it is extremely cumbersome - especially since messageboxes often can start save dialogs. It can look a bit strange that these introduced options has just one option (DontUseNativeDialog) and four functions, but this way it works similar to QColorDialog, QFileDialog and QFontDialog. [ChangeLog][QWidgets][QMessageBox] Added options functionality to QMessagebox. The currently only option available is DontUseNativeDialog. Change-Id: I70282fcfaa66f245f7e679b8897c607bcaff333f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Don't leak QEventDispatcherUNIX during event dispatcher creationTor Arne Vestbø2023-04-291-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During QCoreApplication initialization, we create the main thread's event dispatcher, which for a GUI app happens via QGuiApplicationPrivate's createEventDispatcher() override. This in turn relies on the platform integration to create the event dispatcher, but to do that it needs to create the platform integration first. And this might result in calling APIs that themselves initialize the main thread event dispatcher, such as QEventLoop, which non-lazily creates an event dispatcher for the thread. We already had a check to catch the platform integration setting the QCoreApplictionPrivate::eventDispatcher member, but not anything for checking the current thread data. On macOS this resulted in a leak of QEventDispatcherUNIX because QCocoaDrag contained a QEventLoop member. We now track the event loop temproarily via a pointer instead, like we do in other places. An alternative fix would be to defer the initialization of QCocoaDrag until QCocoaIntegration::drag() is called, but that would run the risk of something calling the function during platform initialization and we'd be back to the same problem. It's unclear why QEventLoop is not lazily ensuring the event dispatcher, and this might be a wider fix for similar issues. Pick-to: 6.5 Change-Id: I643010ddb09945936ce9b0b94de0df96f6fe218f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Doc: add darkmode=0 explicitlyTasuku Suzuki2023-04-281-1/+3
| | | | | | | Task-number: QTBUG-72028 Pick-to: 6.5 Change-Id: Ia73dbd4f203ce654e5221f69a65b8c82c2af7d79 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add more shortcutmap categorized logging outputMitch Curtis2023-04-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Show more detail about the checks made against each entry to show why a shortcut might not get delivered. Specifically, it's useful to know if the contextMatcher returned true. In the case of Qt Quick Controls, it can return false if the Shortcut is blocked by a modal popup, or a popup with a CloseOnEscape policy. With this patch, combining qt.gui.shortcutmap with qt.quick.controls.shortcutcontext.matcher makes it possible to see which popup blocks a shortcut. With only the former enabled, it's already quite useful: qt.gui.shortcutmap: Possible shortcut key sequences: QList(QKeySequence("Ctrl+N")) qt.gui.shortcutmap: - checking entry 0 QKeySequence("Ctrl+N") qt.gui.shortcutmap: - matches returned 2 for QKeySequence("Ctrl+N") QKeySequence("Ctrl+N") - correctContext()? false qt.gui.shortcutmap: - matches returned 0 for QKeySequence("Ctrl+N") QKeySequence("Ctrl+O") - correctContext()? false qt.gui.shortcutmap: Found better match ( QList(QKeySequence("Ctrl+N")) ), clearing key sequence list qt.gui.shortcutmap: Added ok key sequence QList(QKeySequence("Ctrl+N")) qt.gui.shortcutmap: Returning shortcut match == 0 qt.gui.shortcutmap: QShortcutMap::nextState(QKeyEvent(ShortcutOverride, Key_N, ControlModifier, text="N")) = 0 Change-Id: I6e96c94a8b62823553837eda3ef2764ca21775c4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QEvent: fix a narrowing conversion warningAhmad Samir2023-04-251-8/+15
| | | | | | | | By using an iterator-based for loop. Change-Id: I9ae12f16bc2a5c2d74c8557a0324438102fec5b1 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Misc.: Fix some narrowing integral conversion warningsAhmad Samir2023-04-258-22/+22
| | | | | | | Drive-by change: use QByteArrayView instead of allocating a QByteArray. Change-Id: Iaf7acbbdb4efbb101b73b30061ce38dd1fa99ca3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change to darkmode is prevented at runtine in VistastyleWladimir Leuschner2023-04-241-2/+1
| | | | | | | | | Task-number: QTBUG-112965 Task-number: QTBUG-113036 Pick-to: 6.5 Change-Id: I0049e68bbd8e83025f9f576dcd712d03206859d0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Update QWindow DPR on screen DPI changeMorten Sørvig2023-04-111-0/+4
| | | | | | | | | | The window device pixel ratio may change when the DPI changes. Call the DPR update function, which will poll for the current value and update the cached value and send DevicePixelRatioChanged events if needed. Change-Id: I5d5ac5d24a693d06eb9b1f005a91677e703f8a58 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QWindow: Cache the devicePixelRatio valueMorten Sørvig2023-04-113-21/+28
| | | | | | | | | | | | | | Make each QWindow instance cache the current DPR value. This will make calling QWindow::devicePixelRatio() less costly, since it now does not have to compute the DPR value on each call. The cache is invalidated when the DevicePixelRatioChange event is sent. The common logic for handling this is implemented in QWindowPrivate::updateDevicePixelRatio(). Change-Id: I97231a230347358d8e565d2fd62e8a398adaedfc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Cache null icons and remove them upon system icon theme changeAxel Spoerl2023-04-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | Since Qt 6, qIconCache does not store null icons. In case an icon name lookup is unsuccessful, the (expensive) lookup is repeated each time. This patch reverts 9e7c5670509ac81efdf78b691e70e5ce3d408a09, which removes a null icon from the cache once it has been found in the cache. In fact, that could no longer happen due to 4dc7102c8410f5699af93b6c55ba1c7df7755bc2, which prevented null icons from being cached at all. Therefore, it is also reverted by this patch. The cache will be cleared when - the system icon theme name changes or - QGuiApplicationPrivate::processThemeChanged is called (e.g. due to a change of the system's color scheme) Fixes: QTBUG-112257 Pick-to: 6.5 Change-Id: I80cd21fa39dc31c4bae60a8e66e78d9da20e9b4b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Implement setBadgeNumber for xcb backendCarl Schwan2023-04-041-1/+2
| | | | | | | | | | | | This use the unity launcher specification which is defined here https://wiki.ubuntu.com/Unity/LauncherAPI This spec is used by Plasma and Unity. On other Linux desktop platform where the unity DBus interface is not detected this is no-op. Change-Id: I81a9b95fe4886ad597bb4e775641926b161c49a5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Make flatpak check more backward compatibleIlya Fedin2023-04-041-2/+2
| | | | | | | | | | Since 68de00e0d4f2c574162a6e033d41786e3757d25d, the check doesn't work with flatpak versions lesser than 1.13.1. Checking the file in the root directory works since flatpak 0.6.10. Pick-to: 6.5 6.2 Change-Id: Icc83ea5de4a962b52a737c9842248df3b60b1331 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QWSI: Remove handleFrameStrutMouseEvent in favor of handleMouseEvent+typeTor Arne Vestbø2023-03-312-74/+22
| | | | | | | | | | | | | | | The handleMouseEvent function already takes a QEvent::Type, where clients pass in the corresponding mouse press/release/move type. The same applies to the handleFrameStrutMouseEvent. To avoid the chance that clients call these functions with a conflicting event type (handleFrameStrutMouseEvent with MouseButtonPress instead of NonClientAreaMouseButtonPress e.g.), we remove handleFrameStrutMouseEvent altogether and just let clients use the handleMouseEvent function directly with the correct event type. Change-Id: I4a0241c39aedac0d2d8d5163ba05cde72605959c Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Doc: link to QWindow::requestActivate() in more placesMitch Curtis2023-03-312-0/+4
| | | | | | | | | Make it easier to find the function that actually gives focus to windows that need it. Pick-to: 6.5 Change-Id: I0586b89b42a1be260e36e166c81b686e394d8b5e Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
* Doc: Use \relates for functions in the global scopeTopi Reinio2023-03-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | This addresses the recent warnings introduced by a change to QDoc: qkeysequence.h:32: (qdoc) warning: No documentation generated for function 'qHash' in global scope. qmap.h:1557: (qdoc) warning: No documentation generated for function 'operator+' in global scope. qmap.h:1565: (qdoc) warning: No documentation generated for function 'operator+=' in global scope. qvariant.h:582: (qdoc) warning: No documentation generated for function 'operator>>' in global scope. qvariant.h:590: (qdoc) warning: No documentation generated for function 'operator<<' in global scope. Also, mark qt_win_hasPackageIdentity() declared in qfunctions_win_p.h as \internal. Pick-to: 6.5 Change-Id: Idc9c813370ff3133ac9dc3bf809976b0ece88811 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Ensure QHighDpiScaling::set(Screen/Global)Factor() results in QScreen signalsTor Arne Vestbø2023-03-281-4/+8
| | | | | Change-Id: I328b288b3fd83df0cc81c62bce1d946f90f1cd0d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Align QWindowSystemInterface::handleScreenAdded() and handleScreenRemoved()Tor Arne Vestbø2023-03-283-45/+47
| | | | | | | | | | | Having the logic of handleScreenRemoved() inside the QScreen destructor was making it harder to follow the flow of adding and removing screens. As screen management should always go though the QWSI functions, we keep the logic there. Change-Id: I456e77eb8fc10feae7b1f9994b25c9534ea4e430 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove indirection via QScreenPrivate::setPlatformScreen()Tor Arne Vestbø2023-03-284-21/+12
| | | | | | | | | | The QHighDpiScaling code should call the explicit updateGeometry function instead to re-evaluate the platform screen geometry in light of the change to the scale factor. Change-Id: Idac975c117c431356f4fb812c245348c4722a8b5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Apply ScaleFactorRoundingPolicy to QT_SCREEN_SCALE_FACTORSMorten Sørvig2023-03-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | QT_SCREEN_SCALE_FACTORS is in many cases set on behalf of the user, instead of by the user, so we should apply the standard app scale factor policies to it, instead of interpreting it as a user override. Specifically, make it subject to the rounding policy set by QGuiApplication::setHighDpiScaleFactorRoundingPolicy(). This means that applications which support integer scale factors only will see integers only, also when QT_SCREEN_SCALE_FACTORS specifies a fractional factor. Users who want to override can set QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough to restore the default Qt rounding behavior. [ChangeLog][QtGui] The high-DPI scale factor rounding policy (settable with QGuiApplication::setHighDpiScaleFactorRoundingPolicy() or QT_SCALE_FACTOR_ROUNDING_POLICY) now applies to scale factors set with QT_SCREEN_SCALE_FACTORS. Fixes: QTBUG-95930 Fixes: QTBUG-99546 Change-Id: I936e96671fe2a0a43c3e8129f0768875cb011103 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Don't accept QWSI::CloseEvent when the window is blocked by a modal windowTor Arne Vestbø2023-03-231-0/+1
| | | | | | | | | | | | | | | | | If a window is blocked by another modal window, and we decide that as a result we should not propagate the close event, we need to also report this back to the platform plugin, so that it can tell the operating system to not close the window. This is a problem on macOS, where the system doesn't natively support transient parents being blocked by a window-modal window, so the OS will still allow interaction with the title bar close button, resulting in a QWSI close event being delivered. Fixes: QTBUG-104905 Pick-to: 6.5 6.2 Change-Id: I09ff15b0fbb1002a8f9d83d932ca766ed510f0a0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Move nullptr check to beginning of QInputDevice::operator<<Axel Spoerl2023-03-211-8/+13
| | | | | | | | | | | | | Nullptr check was performed after aquisition of the d-pointer. That acquisition crashes if nullptr is passed to the operator, so the actual check was never hit. This patch moves the nullptr check to the beginning of the method. Fixes: QTBUG-112174 Pick-to: 6.5 6.2 5.15 Change-Id: If339e2de9ce2e33e10d925e79ca06b3854a24f76 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtMiscUtils: add isAsciiPrintable() helperAhmad Samir2023-03-181-3/+5
| | | | | | | | | | | | | | | | | | | | | | - isAsciiPrintable: borrowed the logic from isPrintable(uchar) in qdebug.cpp, now isPrintable(uchar) calls isAsciiPrintable - Replace ::isspace() with ascii_isspace() from qlocale_p.h Functions from ctype.h have a couple of issues: - they're locale-dependent, which isn't what's required here, the code is only interested in ASCII - their args should be representable as uchar or EOF otherwise it's undefined behavior An Early-Warning could use something like: grep -rP "\b(isalnum|isalpha|isblank|iscntrl|isdigit|islower|isgraph|\ "isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper)\b" Pick-to: 6.5 Task-number: QTBUG-111262 Change-Id: I1f47f41bd56735297078ff0d0ddc2ebf999abf8b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* doc: Add note about platform support for window positionsEskil Abrahamsen Blomfeldt2023-03-171-0/+8
| | | | | | | | | | | On some platforms, such as Wayland (and also eglfs), manual window positioning is not supported. Since this has caused confusion in the past, we add a note to the documentation. Pick-to: 6.2 6.5 Fixes: QTBUG-86780 Change-Id: Idf8dcdfad8ccfb9eb0f704fce05216562e433e20 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QThread: add sleep(std::chrono::nanoseconds) overloadAhmad Samir2023-03-131-1/+1
| | | | | | | | | | | | | | All the other overloads are implemented using the new one. Windows change relies on the pre-check in the code review making sure it compiles. [ChangeLog][QtCore][QThread] Added sleep(std::chrono::nanoseconds) overload. Task-number: QTBUG-110059 Change-Id: I9a4f4bf09041788ec9275093b6b8d0386521e286 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QPlatformTheme::removeMnemonics(): use QStringView internallyEdward Welbourne2023-03-101-13/+9
| | | | | | | | One QStringView variable can replace a current position and remaining length variable, while making the code a little easier to read. Change-Id: Ie491cff08f624c7fba3accae87a3a03a883262a9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QPlatformTheme::removeMnemonics(): simplify space removalEdward Welbourne2023-03-101-5/+4
| | | | | | | | | | Move the unrelated advance over the removed mnemonic to before space removal and dispense with the obfuscating extra variable counting how much space we remove. Change-Id: Ibb8b1aee0d7281ae21bc9c7aa7ee84289b800f5c Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix warnings from deprecating QFileOpenEvent::openFile, update snippetVolker Hilsheimer2023-03-091-2/+7
| | | | | | | | | | | | Amends 76c63936d3d3c937960108da88a56394a0ac70b5 by adjusting the test case. We still just test that we can open a file based on a filename that we came up with ourselves. Also, update usage documentation and make the snippet a bit more relevant. Change-Id: I5bf00210d74e2a73d5a71a09a5beb1b3f6f8e225 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Plumb QMessageBox::setCheckBox() through QPlatformMessageDialogHelperTor Arne Vestbø2023-03-092-8/+16
| | | | | | | | | | | | | | | | | | | | | | | Without this plumbing we have no way of knowing if the QMessageBox has a checkbox set, and can't decide to skip the native dialog, leaving the user without the expected checkbox. As the suppression checkbox on macOS can be customized, we can use this plumbing to actually provide native dialog support for generic check boxes. This mechanism can also be used by QErrorMessage, which now matches behavior between native and non-native dialogs in terms of the label of the checkbox and its initial state. We might want to tweak this in the future, since user's might expect the suppression label and state to match the system default, but that's something we can expose from the platform theme if so, and should apply equally to the non-native dialog. Fixes: QTBUG-111803 Pick-to: 6.5.0 6.5 Change-Id: Ied9fc34383fe79fbd8437592ad1c1993b9396178 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Send a filename QFileOpenEvent if invalid URL, deprecate openFileVolker Hilsheimer2023-03-022-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | When the string we receive from the system doesn't parse into a valid QUrl (because QUrl requires a valid IDN), then we shouldn't send the QFileOpenEvent based on that invalid QUrl, but instead pass the string through as the file name. The file name is anyway not guaranteed to be path to a file that can be opened, as per the existence of QFileOpenEvent::open and the repective documentation stating: "some files cannot be opened by name, but require specific information stored in this event." However, that API is not useful at all, the implementation just opens the passed-in QFile, using the stored file name. There's no way to override this, and QFileOpenEvent is a locked class with all data stored inline. So we can't even redirect to a platform-implementation. Deprecate that function. Applications should interpret the string returned by file(), which might not be a path to a local file. Fixes: QTBUG-98384 Change-Id: Iff75489de9d7c5fc034f44c0bda4963b2efb1925 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: we no longer provide a list of common mnemonicsVolker Hilsheimer2023-03-011-5/+0
| | | | | | | | | | | Remove the claim from the QKeySequence documentation, fixing the respective qdoc warning. Amends f10ae4b887f6652dcad95516ded43f2e2994e88f. Pick-to: 6.5 Change-Id: If234cfb0a6b7dc20fb10e623cc3ee2ec167f22c9 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add API in QWindowsPrivate to provide window paletteSanthosh Kumar2023-02-281-1/+3
| | | | | | | | | | | | | | | | The window uses default palette (QPalette()) to determine frame color (either light or dark). This doesn't work for quickcontrols as they depend quicktheme palettes and they don't overwrite default palettes. This patch add API in QWindowPrivate to provide palette for window and this can be overridden by quickcontrol windows to provide their corresponding palette. Fixes: QTBUG-111491 Pick-to: 6.5 Change-Id: I39eea20ee7c61ecf0279143c9784da35be15edd3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Remove duplicate wordsAndreas Eliasson2023-02-282-4/+2
| | | | | | Change-Id: Ia7a38a1035bd34d00f20351a0adc3927e473b2e7 Pick-to: 6.5 6.4 6.2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QtGui: Use single precision for mouseMove detectionVolker Hilsheimer2023-02-271-0/+22
| | | | | | | | | | | | | | | | | | | QGuiApplication::lastCursorPosition is a QPointF, and (at least on macOS) compares always different from the QPointF stored in the event. This might be due to the translation from system coordinates to QPointF introducing noise. The result is that even a simple button press causes mouseMove events to be delivered. To prevent this event noise, overload equality operators for the special QLastCursorPosition type when comparing with QPointF to explicitly use single precision comparison. Pick-to: 6.5 6.4 6.2 Fixes: QTBUG-111170 Change-Id: I82ea23ac9f4fa80c55c9c5c742527dd7ee74fd99 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Revert to existing QPointingDevice::grabChanged signature until Qt 7Shawn Rutledge2023-02-201-4/+5
| | | | | | | | | | There is concern about string-based connect() source compatibility in the case that a signal argument has a different type name. Amends bc857f466d297e5656fadad4987f218900d6b1a6 Change-Id: I2618b8c5f62b39717e4f7043d07168e808390b1d Pick-to: 6.5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Accept full-width parentheses in removeMnemonics()Edward Welbourne2023-02-131-5/+15
| | | | | | | | | | | | | | | | | | | QPlatformTheme::removeMnemonics() removes any match to /\s*\(&[^&]\)/ from the text it is given (a menu entry). It transpires that translators are apt to use the full-width parentheses (compatible with some far-eastern scripts) instead of the plain ASCII ones. This leads to their translated mnemonics don't match the same pattern unless we treat the full-width parentheses as a match for the ASCII ones; consequently, they don't get removed, which this function exists to do. So teach it to recognize the full-width versions, too. In the process, break out the pattern-matching (aside from the leading space) to a lambda to make it easier to read and document. Fixes: QTBUG-110829 Pick-to: 6.5 6.4 6.2 5.15 Change-Id: I7335d0bd8dbba66e1fe58fc3eec93caaaf6ec140 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Rename Qt::Appearance to Qt::ColorSchemeTor Arne Vestbø2023-02-137-44/+22
| | | | | | | | | | | | Based on discussions in the 6.5 API review, where we concluded that 'appearance' is too general. Instead, we follow the CSS standard and use the term 'color scheme'. Pick-to: 6.5 Change-Id: I8ceaf4138ecadff5ccd962480e8e5beb39b556ec Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Jonas Kvinge <jonas@jkvinge.net> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Introduce events for Window device pixel ratio changesDavid Edmundson2023-02-136-1/+49
| | | | | | | | | | | | | | | | | | | | | | | | | There is a mix between screen device pixel ratio. Currently we store the property on a per-window basis, but the change notifications are still on a per screen basis which can fall apart on edge cases. On wayland we are getting per window DPR changes without as useful screen change events so it's important to fix. It also has potential to clean up the Windows backend in the future where the backend is currently papering over the two concepts. This patch introduces two new events: A QWindowSystemInterface to trigger a window DPR change independently of a screen change. An event to notify windows the new DPR rather than needing to track signals on the screen. This happens either when the window dpr changes or implicitly through a screen change. This can deprecate an existing event ScreenChangeInternal so the value is reused and renamed for clarity. Change-Id: I637a07fd4520ba3184ccc2c987c29d8d23a65ad3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Prepare for replacing Qt::Appearance with Qt::ColorSchemeTor Arne Vestbø2023-02-096-0/+21
| | | | | | | | | | | | | | Based on discussions in the 6.5 API review, where we concluded that 'appearance' is too general. Instead, we follow the CSS standard and use the term 'color scheme'. This patch is a first step, only introducing the new API, so that submodules can port over. The next step will be to remove the old API and transition the docs and platform themes. Pick-to: 6.5 Change-Id: I43cdb6bb1ccb49c535c06b1897821467fd83ca60 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Doc: Mark new QShortcutEvent constructor with \sinceKai Köhne2023-02-091-0/+1
| | | | | | Pick-to: 6.5 Change-Id: I32580a29e3d5bbeca2832c421e07cec094e9576d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtGui: Remove double default definitionAmir Masoud Abdol2023-02-071-4/+4
| | | | | | | | | | In all the cases below, the parameters are defined in the qtestsupport_gui.h as well. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I3311d6c23b3a811dbe20286bd4534ca1ed7cd7f3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add a platform theme option to affect SH_UnderlineShortcutMikolaj Boc2023-02-074-2/+11
| | | | | | | | | | | | | The style hint SH_UnderlineShortcut can now be turned on/off via the platform theme. No change in functionality so far on any platform, this behaves the same way it did before the change. The change just adds a possibility for platforms to redefine the default underlining behavior. Task-number: QTBUG-76587 Change-Id: Ibda104f1b733371da19825b96e73c22f42faf853 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QtGui: Disambiguate static variablesFriedemann Kleint2023-02-034-16/+16
| | | | | | | | | | | | They cause clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I3c51fb41d29e5c649537b999dced7e2d413b26a7 Done-with: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
* Doc: Fix smaller issues in new Qt 6.5 QStyleHints APIKai Köhne2023-02-011-1/+2
| | | | | Change-Id: Ifd15d5a41e0b80be7fba89d33d78e4a0f53b88ee Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QOpenGLContext: Handle versionFunctions like other dataLaszlo Agocs2023-01-241-4/+3
| | | | | | | | | | | | | | | | | | | | | | While probably not common, it is not unthinkable that one does a destroy() - create() on a QOpenGLContext while relying on the versioned function wrappers. This is likely broken at the moment since the internal data is not released on destroy(), only when the QOpenGLContext is deleted. This differs from any other similar data (the portable function resolvers, QOpenGLTexture backing data, etc.) which are all dropped and nulled out in destroy(). Also remove the bizarre comment in the dtor which must be something from Qt 4 / QGLWidget times. Note that this does not fix the associated problem since that only relies on the standard mechanism that leads to fully destroying and then recreating the QOpenGLContext when the window changes. Pick-to: 6.5 Task-number: QTBUG-109171 Change-Id: Id265a1d208ffae3792a0608c29324e840ce690dc Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Sanitize the order of things in QOpenGLContext destroy()Laszlo Agocs2023-01-241-9/+23
| | | | | | | | | | | | | | | | | | | | | | | Amends e08fe78b2335046934abae970e59fe0156178b95 (in a way). While touching this function in the other patch, it becomes obvious that the order in which things are cleaned up and invalidated is somewhat odd: the native context is in fact gone _before_ invoking helper callbacks or tearing down the OpenGL API wrappers. This only works because likely nothing relies on the context still being usable when destroying those objects and when the texture/vao helper callbacks run. Reorder this to: 1. emit the about-to signal 2. invoke callbacks and null out helpers 3. destroy the function resolvers 4. only then start tearing down the platform (and so the underlying native) context objects. Pick-to: 6.5 Change-Id: I9067463b8f6ce1f656129594c347c1428439ca5e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Respect custom QWSI event handler when delivering synchronous eventsTor Arne Vestbø2023-01-181-1/+6
| | | | | | | Pick-to: 6.5 6.4 Fixes: QTBUG-110268 Change-Id: I25195904cfc18d593db1be713b6e899e55eb922f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>