summaryrefslogtreecommitdiffstats
path: root/src/plugins
Commit message (Collapse)AuthorAgeFilesLines
* Cocoa: Don't call makeKeyAndOrderFront for native app-modal dialogsDoris Verria2021-09-242-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | We show non-modal and Qt::WindowModal native dialogs as modeless panels by calling makeKeyAndOrderFront on the panel. When we exec() a dialog on the other hand, we start a modal event loop by calling runModalForWindow. This method will display the dialog and make it a key window before running the modal event loop. So we don't need to and shouldn't call makeKeyAndOrderFront explicitly before that. Doing so will make Cocoa lose the reference to the previous active window (as it maintains only one level of previous active window) and wrongly choose the main window as key after the dialog closes. Avoiding the call to showModelessPanel for Qt::ApplicationModal dialogs fixes it. Also, in order to display a modal when show() is called and app modality is set via setModality, display it as a modeless dialog as well. This keeps the same behavior we have currently, but it is still not the right way to handle it as we don't respect the modality set by the user. A clean-up of that logic to come in a follow-up commit. Fixes: QTBUG-42661 Change-Id: I8f33e3866b191d775a64a5d9ec3dd65736114e62 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 7c26d7f482b9c15cc6ff850d5954151031010226) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* xcb: update connection time when possibleLiang Qi2021-09-092-3/+19
| | | | | | | | | | At least we try to do it with all events triggered by user. Change-Id: I28b399a2517600f7da2c91a50fecdf58b9d81fb6 Reviewed-by: JiDe Zhang <zhangjide@uniontech.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 25feb2fe3e393dd1820bb4ee8c4105fb088de045) Reviewed-by: Liang Qi <liang.qi@qt.io>
* Cocoa: Make sure we can display multiple sheets for the same NSWindowDoris Verria2021-09-071-1/+5
| | | | | | | | | | | | | | | | On macOS, to display a modal with Qt::WindowModality set, or of type Qt::Sheet, we call beginSheet:completinHandler:. However, this method won't display the specified sheet unless the current active one is dismissed, which is a different behavior than what we expect for this case. Use beginCriticalSheet:completionHandler: whenever we already have an active sheet attached to the NSWindow, which allows us to display multiple sheets for the same window. Fixes: QTBUG-91059 Change-Id: I86bdbcbd63758edbbc48a8aade0178917dcb0e5b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit f3bc1f850046341745d42e2d6739724321634891) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QCocoaTheme: add ButtonText color to standard paletteRichard Moe Gustavsen2021-08-201-1/+2
| | | | | | | | | | | | | | | | | The standard palette had no value set for ButtonText. The result was the we drew button text in QtQuickControls2 using Text color instead, which would be wrong in dark mode, and result in a dark color instead of white. Note: Widgets hardcode the color "white" directly in the mac style, and was not affected by the missing value. Fixes: QTBUG-89177 Change-Id: Ie2d99bfac9fcc70d45e5bd40ea45becf3fd70d87 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit b7150d22c8ea6349b5d1fd61d5059e0fbe2745ed) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: close popups on mousedown within the window frameVolker Hilsheimer2021-08-193-34/+53
| | | | | | | | | | | | | | | | | On macOS, we close active popups when handling mouse-down events in the NSView, but not for such events in the window frame. This allows users to close a window that has a context menu open via the window's close button, which then leaves open popups behind. Factor the popup-closing code out into a dedicated method that we can call from within the NSWindow::sendEvent implementation for mouse down events. Fixes: QTBUG-30522 Change-Id: I9c354efc449cfefff3ed84fa34b1cd8a0da3b4a7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 70b94eea10d7af83cced09296755a8af28e167b5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Don't wipe NSWindowStyleMaskFullSizeContentView if set manuallyTor Arne Vestbø2021-08-171-1/+3
| | | | | | | | | | | The NSWindow may have style masks set by the user via winId(). We don't want to wipe those just because we're recomputing the style mask. Fixes: QTBUG-69975 Change-Id: Ibca8388d45b623f4cdfaff4b256c4eb012e2ffac Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit d627d351bedb96c727aa6e3b7cb2cc2d678c5606) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix Style java code format and warningsAssam Boudjelthia2021-08-172-27/+2
| | | | | | | | | | | The code had many bad formating and syntax or API usage warnings, as well as some unused methods or classes which are fixed with this patch. Task-number: QTBUG-71590 Change-Id: Ib113a0dc05703afb5190ec880b27daf75274cb1e Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit dc9075554135160bb07aa54708aba69d127160e2)
* xcb: add a timeout control when reading INCR propertyLiang Qi2021-08-101-2/+6
| | | | | | | | | | | | | | | | | | | | For the first call of QXcbClipboard::clipboardReadProperty() inside of clipboardReadIncrementalProperty() in getSelection(), it will get a XCB_NONE reply before the contents arrived via property change. Then we give a chance to read more. Manually tested with following setups: * examples/widgets/mainwindows/application with gvim(gtk3) * examples/widgets/widgets/imageviewer with GIMP 2.10.18(based on gtk2) and GIMP 2.99.6(based on gtk3 via flatpak) Fixes: QTBUG-56595 Done-With: JiDe Zhang <zhangjide@uniontech.com> Change-Id: Ib45f08464d39ad79137b1da99808c89b7dca2d08 Reviewed-by: JiDe Zhang <zhangjide@uniontech.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 02248eea5562c1df39ee23f195011afacc6759b0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Fix leaked NSMutableArray in applicationActivationChangedTor Arne Vestbø2021-08-081-1/+1
| | | | | | | | | | The +[NSObject new] method is a combination of alloc and init. Fixes: QTBUG-95619 Change-Id: I341f8a3958fb7a016cf4c346750ea6d46eeebe9f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit ab70aa362ee5dd5b1375b198dcd6d6445ab2daeb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Stop relying on balanced CGDisplay reconfiguration callbacksTor Arne Vestbø2021-08-023-84/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were using CGDisplay callbacks to determine when a screen reconfiguration had happened, and when it had propagated to changes in NSScreen.screens, so that we could update our QScreen view of the world. Unfortunately the CGDisplay callbacks were not deterministic enough to use as a signal for when a reconfigure had completed. Since we can't rely on NSApplicationDidChangeScreenParametersNotification either (it comes in too late), we're now resorting to updating our QScreens at every chance we get: - On every CGDisplay reconfiguration ending - On QCocoaWindow::windowDidChangeScreen() as a result of AppKit moving the window. - On NSApplicationDidChangeScreenParametersNotification - On QCocoaScreen::get() as a last resort Since the result of these updates are only reflected as QScreen property updates or QGuiApplication signals if a change actually occurred, it should be safe to update early and often. Task-number: QTBUG-77656 Fixes: QTBUG-80193 Change-Id: I98334a66767736d94ad2fcb169e65f0d8bc71a30 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit 6e250179229ebe7e2a056ba0e363592f4d1f6972) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Windows QPA: Fix coordinates reported through UI AutomationAndré de la Rocha2021-07-271-10/+7
| | | | | | | | | | | | | | | Conversion to/from native screen coordinates was incorrect and could fail for non-primary screens. This could cause a control's bounding rectangle to be incorrectly reported, or a search for a control based on its position within the window to fail, causing incorrect behavior with accessibility tools and other software interacting with the application using UI Automation. Fixes: QTBUG-91459 Change-Id: I5d56584ff26d977cdd34d35af46644e32aa11e7c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 0235c0217883bc9d0ca83c7533e9c0286901bb3c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix incorrect default plugin conditions on WindowsAlexandru Croitor2021-07-231-1/+1
| | | | | | | | | | | | | | The correct variable to check is WIN32 rather than WINDOWS. This affects which plugins get automatically linked in a static Qt build. Amends a3b58a7844f77bd416fad8307f8333ff7c0efacf Fixes: QTBUG-95283 Change-Id: Idf78c78a1029f4d13fb460c07bef3d2669e55b09 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 91cc4fd6994701c87329de866333eb0bda0e37ef) Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Update deprecated NSAccessibility methodVolker Hilsheimer2021-07-211-1/+1
| | | | | | | | | | | | accessibilityEnabledAttribute is replaced with isAccessibilityEnabled. https://developer.apple.com/documentation/appkit/nsaccessibility/1535024-accessibilityenabled?language=objc Fixes: QTBUG-95293 Change-Id: Ie88fa61ad97d6c77dcec15e63a73f64c90011497 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit fe1085e9aebd3b669a18bd889fc007b1fc1c1e5d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Scale image with MDI icons using the correction factorVolker Hilsheimer2021-07-201-2/+2
| | | | | | | | | | | | | | | | The buffer might be large than needed and contain a lot of uninitialized pixels. Scaling it down to the requested size is wrong, we need to scale it by the correction factor. Amends e56b8e1e59b6df7c7abd48b163abe6846849eb7a. As a drive-by, make the correction factor helper function static. Fixes: QTBUG-94733 Change-Id: Ia5be2a77459321e30485d330b49cf57fdbb664d2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 5d7a58ea45ed834655220e05012ff17ac235131a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS 10.15: Fix focus frame for combo boxesVolker Hilsheimer2021-07-191-0/+2
| | | | | | | | | | | | | | | Amends df316963213e765de5b94469622df48b0c9a9e6e to take care of macOS 10.15 specifically, where the focus ring is a pixel too high and leaves a gap that's visible on high-dpi displays. On macOS 10.14 and before, and for editable comboboxes, the focus frame is correct. Fixes: QTBUG-94069 Change-Id: I278aa30036808c06f8e71385d4797315e46d8f1d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit eaa48136a39f153b05bb1842734bbe2277191510) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: fix separator actions not showing in menusVolker Hilsheimer2021-07-191-14/+9
| | | | | | | | | | | | | | | | | | Amends a3f3af8a8fb8f8b09d1685df5ab836244f850a62, which resulted in the last visible separator always getting hidden. Don't abuse QCocoaMenuItem::visible property to store whether the native NSMenuItem is shown, only store whether it should be shown. Rename the local variables to simplify the logic. Fixes: QTBUG-94802 Change-Id: I56e8c99a2a46d8cbdf75c4ad6cb714961f28a6a3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 6832789bbd1a19499bffd05b1cac400db2bdd948) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Don't make frameless tool windows miniaturizableVolker Hilsheimer2021-07-141-2/+4
| | | | | | | | | | | | | | | Amends 556fbbea6e96c07c6cbd552c4179e5717e799acf, which breaks translucency of frameless tool windows. Possibly a bug in macOS, a window being made miniaturizable should not have side effects on background or translucency. Fixes: QTBUG-95042 Task-number: QTBUG-65637 Change-Id: I651196e3cf8a9c59b250e5f1b4064cc4ded02372 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit e71a5d5cc3c0337e7dbd5d571ecee5668baf8b63) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Map QSurfaceFormat color space to NSWindow via ICC dataTor Arne Vestbø2021-07-131-2/+5
| | | | | | | | | Instead of special casing sRGB. Change-Id: I7ad20c4b9600210333d5e44c3a2d20ce7d39dd92 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 3c3f6ebdbb48c9c071ef1a34a955b36bdaed4f99) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* xkb.compose: get locale from user env settingsLiang Qi2021-06-251-4/+10
| | | | | | | | | | | | | | The setlocale call will only give useful results if the program had previously set the current locale using setlocale... See also "Compose Locale" section in xkbcommon doc: https://xkbcommon.org/doc/current/group__compose.html#compose-locale Fixes: QTBUG-85529 Change-Id: I65b1ac86ea54445bc3a2e1707df79bd9f732ab46 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 73ea9f032864566cc019d286b2f210b78cd70a3d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* xcb: fix cursorTheme update issueTang Haixiang2021-06-241-2/+6
| | | | | | | | | | | | | | | | Clear the cache when cursor theme changed. Idealy we should subscribe root window's RESOURCE_MANAGER property to update cursor theme via Xcursor. KDE already has a daemon KDE GTK Configurator to sync KDE settings to GTK. Then we can register the fallback there both for KDE and GTK changes. See also https://invent.kde.org/plasma/kde-gtk-config Fixes: QTBUG-94538 Change-Id: Ia4de30930a0dc1dc306c61e1553970c3dab67bd6 Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 7311cdc0d2c10d47511e5b4850e3b348ea10e0d8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Unregister screen notification handlers on QGuiApplication shutdownTor Arne Vestbø2021-06-232-3/+16
| | | | | | | | | | | | | In the case of a plugin, the plugin might be unloaded, and destroy its QGuiApplication. We don't want the screen notification handlers to outlive the application, as that results in crashes. Fixes: QTBUG-91919 Done-with: Yang Yang Change-Id: I3a4c0fcf97b785357516d1dac34489511400f154 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 96469ae338c3146f4efea3fabaaae5bc6ecd6a59) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix potential double-free in QSqlCachedResult::cleanup()Edward Welbourne2021-06-231-1/+3
| | | | | | | | | | | | If d->sql is non-null, it gets freed; later in the same function, it gets reallocated, unless the query is empty, in which case the now-freed value was still recorded, so that later clean-up might find it and mistakenly think it needs to be freed again. Clear when freeing. Change-Id: I8d37d2ba1fcaa320916eaf30dceaa720bbf62f38 Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 0e1da78ad36a0639275b7a0ac8a046f46577452d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix leak of transaction context handle in QSql's OCI driverEdward Welbourne2021-06-231-11/+21
| | | | | | | | | | | | | | | Transaction handles were allocated but nowhere freed. Thanks to Stefan Latsch for pointing this out and suggesting the fix. Make the handle yet another member of QOCIDriverPrivate so that close() can free it. At the same time, also free the service context handle d->svc when failing do open(); and shuffle the order of frees to be the reverse of the order of allocations. Fixes: QTBUG-94246 Change-Id: I45818ada6d884b06028056d28635390a300e2def Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit c42ebd5ba6f1fb861cabdbe44ab10df55b9b3ada) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Allow programatically minimizing frameless windowsMorten Johan Sørvig2021-06-221-1/+4
| | | | | | | | | | | NSWindowStyleMaskMiniaturizable also controls programatic minimize, in addition to the window decoration button. Fixes: QTBUG-65637 Change-Id: Iac5fb483433441173d770f4fcfb9e93440b9fe6a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 556fbbea6e96c07c6cbd552c4179e5717e799acf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS 11: Fix positioning of focus frame around comboboxVolker Hilsheimer2021-06-181-4/+8
| | | | | | | | Fixes: QTBUG-94069 Change-Id: I09079726c96a41f628ae55724cfe53dbc225d358 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit df316963213e765de5b94469622df48b0c9a9e6e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* iOS: cleanup connection when a screen disconnectsRichard Moe Gustavsen2021-06-161-1/+3
| | | | | | | | | | | | | | | | | The iOS port creates one QIOSViewController per connected screen. And each view controller listens for changes to the application state. The problem is that we never disconnect this connection again. So if a screen is removed, and the corresponing view controller is deallocated, the connection is still kept alive. This will cause crashes to occur when the signal emits, since the slot will then be accessing deleted memory. Fixes: QTBUG-76948 Change-Id: I758e51af9297cd62de193aae825f4475a2c7c3e5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit d829d54a42393d797c5f6ab3b80e88df35fad1e4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Prevent overly deep build dir hierarchy on WindowsJoerg Bornemann2021-06-111-2/+6
| | | | | | | | | | | | | | | | On Windows, building Qt with Ninja Multi-Config failed in a reasonably named build dir. The reason for that is our deep build dir hierarchy, created with add_subdirectory, and long target names like QNetworkListManagerNetworkInformationBackend within that hierarchy. Rename said target to QNLMNIBackend, and set AUTOGEN_BUILD_DIR to a short string that does not repeat the target name. Fixes: QTBUG-94211 Change-Id: Iea6fee012fa46d9bfb01142b60e6cb5273893c50 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit d23613acf7bfe37c1c78eb9aadc489e888e34dfb) Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* macOS: close visible gap between tab bar base line and tabsVolker Hilsheimer2021-06-111-1/+1
| | | | | | | | | | | | | | | | | Dock widgets enable the QTabBar::drawBase property, but the clip region left a gap of 3 pixels on each side between the base line and the tabs. Correct the size of the hole cut into the clip region accordingly. Visually tested on macOS 10.15.7 and macOS 11.2.1 using the dockwidgets and tabdialog example. As a drive-by, fix a spelling mistake in related documentation. Fixes: QTBUG-86362 Change-Id: Iada027999467741d0590576ee4508e6f41fb056d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit f5d6f8dca0c45f311b19731128a495392884ec8c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Keep NSWindow alive after handling windowShouldClose callbackTor Arne Vestbø2021-06-091-0/+9
| | | | | | | | | | | | | | | | | | | | | | Option-clicking the close-button on a window in macOS is a request to batch-close all the windows. When this happens we get an event in through the window that was clicked, which in turn results in AppKit calling windowShouldClose: for each window. We respond to that by explicitly closing each window (instead of just responding YES or NO), which results in the window being released and deallocated. This causes a crash when AppKit then follows up by closing each window after we responded YES to windowShouldClose. We work around this by keeping the window alive in the closest auto release pool, which is typically at the level of the runloop. This ensures that the window is alive for the duration of the logic that AppKit has for batch-closing windows. Fixes: QTBUG-92232 Change-Id: I68b6138eb8325af0576b438ffa011137fec27926 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 8a4e274dcf836f58c7417c11737bdded50a84dbd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* windows: gl: Print GetLastError() when makeCurrent failsLaszlo Agocs2021-06-091-1/+6
| | | | | | | | | | | | | | This matches the behavior of other implementations, such as QEGLPlatformContext: doing a qWarning with the relevant error from eglGetError() or equivalent is helpful when something goes wrong and should be common among QOpenGLPlatformContext implementations. Task-number: QTBUG-85714 Change-Id: Ifa5d22b83808c92ae92efcbcddc8d8c3d3ba34b1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 03650696a1fb727a337865d43f068ddc7723a893) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: render shortcuts in context menus correctly alignedVolker Hilsheimer2021-06-031-2/+18
| | | | | | | | | | | | | | | | On macOS, shortcuts should be rendered along the imaginary line between the modifiers, and the key. The modifiers are right-aligned on the left side of that line, the key left aligned on the right side. Make an exception for multi-chord sequences, render those always left aligned. Fixes: QTBUG-73990 Change-Id: Ie03f3f40278700bdfafbfca7aa52075825e20234 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 64a64fd485bd78f44b93beb3d712db67b6d33c05) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: fix mimetype/namefilters handling for FileDialogAssam Boudjelthia2021-06-021-8/+9
| | | | | | | | | | | | | | | | | | | | | Android file dialog uses setType() to set the main mimetype for the dialog if no mimetype or multiple (+1) mimetypes are provided, then the additional mimetypes can be provided via EXTRA_MIME_TYPES flag. The problem was that the mimetypes deduction from the namefilters was: * the namefilter used was empty, now we take the first item nameFilters(), because mimetypes cannot be changed once the dialog is open anyway. * The regex extraction was getting a namefilter ending with an empty char and that was giving a mimetype of any format thus making it show all possible files. Fixes: QTBUG-83089 Change-Id: Ifaef40c2186732ad3a604d28e086409c35dafacf Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit ed431caa27672427d28f8ecde667a3a064ddda7e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* SQLite driver: fix crash when binding a QByteArray/QStringGiuseppe D'Angelo2021-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing SQLITE_STATIC to sqlite3_bind_*() means that ownership of the data stays in the caller, i.e. SQLite itself doesn't make a copy; such data must be therefore be kept valid until sqlite3_step() is called. The code in the SQLite driver uses that option to avoid copying byte array or string data. But, unlike what the comments in the code say, we do NOT keep the QByteArray/QString alive long enough: they're contained by a temporary QVariant object which gets destroyed at the end of the loop that binds each argument. Luckily the fix is simple: since that QVariant is just a copy of the QVariants used as bound parameters, and these are held in a container (which lives long enough), simply create a reference to the container's elements rather than a copy. This ensures that the data is alive by the time sqlite3_step() is called. This problem doesn't normally appear because of implicit sharing of QByteArray/QString. When the QVariant is copied, the inner element is just a shallow copy. Getting the pointer to the data, and destroying the QVariant, does not destroy the data (it's kept alive by the QByteArray/QString inside the *copied-from* QVariant). Of course there's a catch: if the *copied-from* QVariant contains a QString created via fromRawData, then everything blows up. In this case, 1. the copied QVariant is created (which bumps the QString refcount)¹ 2. the QString inside of it is accessed directly (via QVariant::constData) 3. utf16() is called on that string, which detaches it (!) 4. the result of utf16() is passed to SQLite, with SQLITE_STATIC 5. the copied QVariant is destroyed; this destroys the inner QString, which, being detached, deallocates the data too early. 6. sqlite3_step() is called, kaboom. (The copied-from QVariant still has the string created by fromRawData.) ¹ Note that QString uses the Small QVariant Optimization, so the QString object itself into the QVariant is copied, it's not just a *QVariant* refcount increase. Change-Id: Idcdb192809f1f8f79b4a901e1247f933eb06e854 Fixes: QTBUG-94070 Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 0f38259cb3aee5cce5a2af99af3f69712c9f1123) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: don't show invisible separator itemsVolker Hilsheimer2021-05-272-3/+8
| | | | | | | | | | | | | Give QCocoaMenu access to the item's visibility property by adding a public getter, and respect that state when syncing the separator to the corresponding QCocoaNSMenuItems. Fixes: QTBUG-88651 Change-Id: I7e238e5d3be141ec8f4e8f6f3ab22d761094d2d2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit a3f3af8a8fb8f8b09d1685df5ab836244f850a62) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: respect underline attribute in menu item fontsVolker Hilsheimer2021-05-271-2/+4
| | | | | | | | | | | | When we draw menu item text with CoreText instead of QPainter, then we need to translate QFont::underline() explicitly to an entry in the attribute dictionary. Task-number: QTBUG-73990 Change-Id: I7e0c258f7cf80a89b29517fa8122576342654de1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 5ac479f5990a4c2b09ea34fb98d10c17d405aa5e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Qt xcb: remove false detects of Qt::GroupSwitchModifierAleksei Nikiforov2021-05-271-3/+3
| | | | | | | | | | | | | | | | | | In some cases, if X11 is configured with CapsLock as keyboard language switch key, and CapsLock is toggled via Shift+CapsLock key combination, toggled CapsLock is falsely detected as Qt::GroupSwitchModifier for subsequent key events. This change fixes this false detect, but doesn't fix detection of Qt::GroupSwitchModifier which is likely still broken. Fixes: QTBUG-49771 Change-Id: I485e2d4f3c654707c62adaba367c1b8afb3fc36c Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 25a7034d78aeb12726a1052d64c0aa3314a1f69d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Silence warning C4996 (use of deprecated GetDesktopDpi)Kai Köhne2021-05-272-0/+6
| | | | | | | | | | | | | | | Silences warnings warning C4996: 'ID2D1Factory::GetDesktopDpi': Deprecated. Use DisplayInformation::LogicalDpi for Windows Store Apps or GetDpiForWindow for desktop apps. Using GetDpiForWindow sounds like the right approach, but it's not obvious where to get the window handle from here. Task-number: QTBUG-94043 Change-Id: I2fc005e0c970c8338184f4500b876774ec9d976b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit fd9c2c803363d2036ba497946c2eee58b4c4fe18) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Restore logic to set wantsBestResolutionOpenGLSurfaceTor Arne Vestbø2021-05-201-0/+8
| | | | | | | | | | | | | | | | | The logic was removed in 1fc7ca091b3fdda52381a383318a3a752ec21132 when we removed support for surface-backed views, based on the documentation for wantsBestResolutionOpenGLSurface noting that layer-backed views ignore the property. But in some cases, when plugin views are embedded into host views, and the host was built with a pre-10.14 SDK, AppKit seems to get confused, and we still need to set this property. Fixes: QTBUG-93770 Change-Id: Id67f2fcb8c090c0e01c05d00792eaef311146df1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 40878e75176880e95398604d9e63be2138cc642b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Fix warning about comparing different types in QCocoaScreen::isOnlineTor Arne Vestbø2021-05-201-2/+2
| | | | | | | Change-Id: Ieb70108d22bf254c69665e5b3e3a2988703e26a2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 640eb55c130c6c2c982dc212a8a5bd2b8fb7a225) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QXcb: don't dereference pointer before checkingVolker Hilsheimer2021-05-201-1/+2
| | | | | | | | | | | | | | | The virtualDesktop pointer is expected to be populated by queryPointer, but that method handles the case that there either is no reply, or that the reply doesn't match, in which case the pointer remains nullptr. Don't dereference it afterwards without checking. Addresses code checker warning a179d1087759bb6ca9c3380257bd70d6 Change-Id: I5877f26fd3b49327c0de3f2c918bb606bee8ac57 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit c2258e85a32b66cf7cbc59a4789e68c31c9955be) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix BASE argument of qt_add_resourcesJoerg Bornemann2021-05-181-87/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The BASE argument of qt_add_resources now denotes the root point of the alias of the file. Before, BASE was merely prepended to every file that got passed to qt_add_resources. Old behavior: qt_add_resources(app "images" PREFIX "/" BASE "../shared" FILES "images/button.png") Alias is "../shared/images/button.png", and pro2cmake generated QT_RESOURCE_ALIAS assignments to fix this. New behavior: qt_add_resources(app "images" PREFIX "/" BASE "../shared" FILES "../shared/images/button.png") The alias is "images/button.png". No extra QT_RESOURCE_ALIAS assignment is needed. The new behavior is in effect for user projects and for Qt repositories that define QT_USE_FIXED_QT_ADD_RESOURCE_BASE. Qt repositories will be ported one by one to this new behavior. Then the old code path can be removed. Task-number: QTBUG-86726 Change-Id: Ib895edd4df8e97b54badadd9a1c34408beff131f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 92185d417de43237ae62eae55599c65922cd9a15) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* iOS: Accessibility: Set the correct traits for EditableTextAndy Shaw2021-05-141-1/+9
| | | | | | | | | | | | | Since the correct accessibility traits for EditableText are not available as a direct enum value, then we depend on the defaults for a UITextField to give us this information. Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Fixes: QTBUG-93494 Change-Id: If428414aec5ce571f0f8c0ecccffdbaf1c908120 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit 08cd5580df382af5ddfe1c0c44bc9dd68e4cd1e7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Windows QPA/Vista style: Fix placeholder colorFriedemann Kleint2021-05-111-1/+10
| | | | | | | | | | | Bring back the code that was removed by 62c3dd5632b04a7ee2410cc2233c0d0605ad5bd6 to the Windows theme. Fixes: QTBUG-93635 Change-Id: I066e89d482a584c1719f6bfb6160710ee73e1b81 Reviewed-by: André de la Rocha <andre.rocha@qt.io> (cherry picked from commit 26638dfe3be009e886d5fc0b2ffa1879efee56b5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix passing QJniEnvironment to ANativeWindow_fromSurfaceMarius Kittler2021-05-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The function ANativeWindow_fromSurface (as declared by `$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/android/native_window_jni.h` from version r22.b of the Android NDK) takes a `JNIEnv*` so `.jniEnv()` must be used. This prevents the following compilation error: ``` error: no matching function for call to 'ANativeWindow_f romSurface' m_nativeWindow = ANativeWindow_fromSurface(env, m_androidSurfaceObject.object()); ^~~~~~~~~~~~~~~~~~~~~~~~~ /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/android/native_window_jni.h:45:16: note: candidate function not viable: no known conversion from 'QJniEnvironment' t o 'JNIEnv *' (aka '_JNIEnv *') for 1st argument ANativeWindow* ANativeWindow_fromSurface(JNIEnv* env, jobject surface); ^ 1 error generated. ``` Change-Id: I70d75cb7edc5875314fcb8a70d51d0ef40442101 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 590f70a849d85c438385c313fb452f528fd304a4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* iOS: Accessibility: Don't cut off the last character from the text valueAndy Shaw2021-05-091-2/+1
| | | | | | | | | | | | The second parameter is the position of the first character not to be returned when calling text(). So it needs to be passed the length of the text, otherwise the last character is cut off. Task-number: QTBUG-93494 Change-Id: I7dd8324b3939220de125ba819b7b77588b21bd4b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 5c29f981fa069907678f961cf58ecefd64bf268b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Simplify bundled libjpeg buildEirik Aavitsland2021-05-061-1/+0
| | | | | | | | | | | | | Move the config headers of the bundled libjpeg back into its source directory, where they originally live, to avoid having to trick with the include path to find them. The goal is unification across maintained Qt branches, making version updates simpler. Change-Id: I5b574446bbd264b0a1cb3efceb4c1cb7203cac7d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 5df88b85c6e61409c5c759e78f32edaac7b2022f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* cocoa: move DEBUG_PASTEBOARD into logging categoryLiang Qi2021-05-053-62/+21
| | | | | | | Change-Id: I8f49c030588122adff3c0eab4189bfa7e6aeff09 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 9f8d5bceb47eafa79fdd9c2a5186e6a86be7fecb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* iOS: Implement QIOSScreen::logicalBaseDpi()Morten Sørvig2021-05-032-2/+2
| | | | | | | | | | | | | | | | logicalDpi() and logicalBaseDpi() should return the same DPI on iOS, in order to make Qt not apply a scale factor. Accomplish this by overriding logicalBaseDpi() instead of logicalDpi(). The default QPlatformScreen::logicalDpi() implementation will then call logicalBaseDpi(). Fixes: QTBUG-92579 Change-Id: I7a27cf61f0154cef32098069ab3dfb29ad6acf27 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit e3e070e87b3a8036f7200755ba32b57437304ee6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: Fix Application becomes unresponsive issuePekka Gehör2021-05-033-0/+11
| | | | | | | | | | Block key events until the plugin is running. Fixes: QTBUG-67944 Change-Id: Iea47f2e94d850141834a7e8fc26218be2cacf660 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 2262a9cd2d135d5ea2ade42460496c88d8b2c292) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QVnc: clip requested screen region to available screen imageEirik Aavitsland2021-04-301-2/+3
| | | | | | | | | | | Avoid potential oob memory access. Fixes: QTBUG-91770 Change-Id: I34fff1cf8dec5275572a027288b0e8310359d9f8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit c494c1e8754ed13b409133196d9db00bf7e0f2b5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>