summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-1741-201/+308
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qlogging.cpp src/gui/painting/qtextureglyphcache_p.h src/gui/text/qfontengine.cpp src/widgets/widgets/qlineedit.cpp Change-Id: Ic8798538df466b7141caa8bbf1fb7605eb56be37
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-138-54/+88
| |\ | | | | | | | | | Change-Id: I5d2a4fa33b4aa22da39ac045e6b85ab940b8720b
| | * Remove unused arguments from QWidgetPrivate::create_sysTor Arne Vestbø2019-07-123-25/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The public QWidget::create still has them, but we don't need to propagate them on - that just makes debugging the window creation flow harder. The window argument to QWidget::create is technically used to guard an early exit in the function, but to keep behavior the same we leave it for now. Change-Id: Ic0287575aa25f1272e216adc1b75e34d6f55f6d9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| | * Revert "Reset QWidget's winId when backing window surface is destroyed"Tor Arne Vestbø2019-07-121-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit a9246c7132a2c8864d3ae6cebd260bb9ee711fcb. The QWidget machinery is way to fragile to reset the winId under the feet of QWidget like that. We would potentially need to include all the logic in QWidget::destroy. This also ties into the flow between QtGui and QtWidgets during window closing, which is still unresolved. Change-Id: I168048a63c89796398eb5331a80ce3e5c8d9a208 Fixes: QTBUG-76588 Task-number: QTBUG-69289 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
| | * Fix warnings as errors on macOS with new Xcode 10.2.1Alexandru Croitor2019-07-121-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | A switch statement was comparing enum values of a different enum. Change-Id: I578f79b15b1007afaa64cd3a2a80d6a75d3bed77 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
| | * macOS: show QSystemTrayIcon message icons in notification popupsVolker Hilsheimer2019-07-111-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The icon provided was ignored, even though NSUserNotification provides the option to specify a contentImage. The message popping up will show that image on the right side of the notification; it will not repace the application icon on the left side. [ChangeLog][Widgets][QSystemTrayIcon] On macOS, show the icon passed into showMessage in the notification popup Change-Id: I8ecda7f893006e74a4f35f37ddc07063ebfe4e83 Fixes: QTBUG-76916 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| | * Optimize and fix handling of QtMessageHandlersMarc Mutz2019-07-111-15/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A function may almost always have static storage duration, but that does not necessarily mean that we can store and load pointers to them without memory ordering. Play it safe and use store-release and load-acquire for them (which combines to ordered for the fetchAndSet call in qInstall*Handler(), as we don't know what the caller will do with the returned function pointer). Also change the initial value of the atomic pointer to nullptr. Nullptr already signified the default handler in qInstall*Handler(), so the API doesn't change. But by using nullptr to mean default, we place these variables in the BSS segment instead of TEXT, save dynamic init, or at least a relocation, and we dodge the smelly comparison of function pointers, using comparison against nullptr instead. Also, as a drive-by, put the call to ungrabMessageHandler() in a scope-guard. Both the message handler, as well as the Qt code calling it (toLocal8Bit()!), may throw, and that would stop all further logging. In Qt 5.9, we can't use qScopeGuard(), yet, so use a local struct calling ungrabMessageHandler() in its dtor. The code still has one problem: When a logging action is underway, and another thread exchanges the message handler, we might still execute code in the old handler. This is probably not a problem in practice, since no-one will use a dynamically-compiled function for logging (right? :), but should probably be documented or fixed. This patch does not address this issue, though. Change-Id: I21aa907288b9c8c6646787b4001002d145b114a5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit cd401b74a13cd9d9a47d977f195c7985cf725d55) (cherry picked from commit ea16c860bd75a35134ebb1d4f3be5db58f4a4e21)
| | * QSaveFile: Fix changing the file name after hitting on readonly fileFriedemann Kleint2019-07-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The call to QFileDevice::unsetError() in QSaveFile::open() does not clear QSaveFilePrivate::writeError. Clear it in addition. Fixes: QTBUG-77007 Change-Id: I5e5009750f1726d1c74c1b4eb1c33f3a5393fe4f Reviewed-by: David Faure <david.faure@kdab.com>
| | * QDirIterator: don't require NFD normalization on Darwin for validityThiago Macieira2019-07-111-3/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HFS+ filesystems do enforce NFD normalization, so the test worked for those filesystems. But on APFS, the filesystem is normalization- insensitive but preserves it, so our transformation caused valid files to be rejected. This commit also optimizes the solution for all systems too. Instead of converting from 8-bit to UTF-16 then back to 8-bit (allocating memory in both steps), we only convert to UTF-16. And if we detect the locale is UTF-8, then we use the further optimized QUtf8::isValidUtf8 function that doesn't allocate any memory at all (ditto for US-ASCII, the case of someone running with LANG=C). Fixes: QTBUG-76522 Change-Id: Ief874765cd7b43798de3fffd15aa0d81620ad317 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | Merge "Merge remote-tracking branch 'origin/5.12' into 5.13"Qt Forward Merge Bot2019-07-1234-162/+237
| |\ \
| | * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-1234-162/+237
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure.pri Also required s/solid\.color/solidColor/ in a couple of places in: src/gui/painting/qpaintengine_raster.cpp Change-Id: I29937f63e9779deb6dac7ae77e2948d06ebc0319
| | | * Windows QPA: Fix handling of mouse messages synthesized by the OSAndré de la Rocha2019-07-112-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old handler only marked mouse events associated with mouse messages synthesized by the OS with Qt::MouseEventSynthesizedBySystem when these messages resulted from touch screen, not tablet input. Quick seems to depend on this behavior. Fixes: QTBUG-76617 Change-Id: Ib863d73ae9325f9a19d8a175817fef4e82f7df0b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| | | * Fix build with -no-feature-printerKai Koehne2019-07-111-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Skip printsupport subdirectory if printer feature is disabled. Also removed android-embedded condition for the plugin: Such a configuration should just disable the printer feature. Fixes: QTBUG-76941 Change-Id: Ifca7d2311a575c1589ad6a87a775bd016591ee2c Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
| | | * Windows: handle errors correctly when connecting to unreachable hostVolker Hilsheimer2019-07-111-60/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous code handled only some error codes, in a very inefficient way, for some code paths. This change standardizes error handling using a helper function that maps winsock WSAE* codes to Qt error codes. The test for connecting to unreachable hosts or ports is now more generic, and enabled on Windows, where it passes in local tests, but dependency on network configuration still makes it fragile, so ignoring some failures without completely skipping the test. [ChangeLog][Network][Windows] Correctly emit errors when trying to reach unreachable hosts or services Change-Id: Icaca3e6fef88621d683f6d6fa3016212847de4ea Fixes: QTBUG-42567 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
| | | * QPixmapCache: guard against usage from non-main threadsEirik Aavitsland2019-07-101-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Depending on the active QPA plugin, QPixmaps may now be created and used also in non-main threads. But QPixmapCache is not designed to be used from such threads, so add guards to ignore such access attempts, both from application code and from Qt library code. Such unsafe access would often cause a cryptical "~QObject: Timers cannot be stopped from another thread" warning; that also disappears with this fix. [ChangeLog][QtGui][QPixmapCache] Ignore unsafe access from non-main threads Task-number: QTBUG-76694 Task-number: QTBUG-72523 Change-Id: Ia2db37e528aec08bfb48808630bdf5e543689039 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
| | | * QHostInfo: fix a race condition on QHostInfoCache::enabledMarc Mutz2019-07-092-17/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In auto-test-enabled builds, QHostInfoCache can be enabled and disabled using qt_qhostinfo_enable_cache() at any time. We cannot rule out that users use this function, or, indeed, that the auto-test never gets a threading stress-test. Under the assumption, then, that QHostInfoCache::enabled can be set by any thread at any time, and is read by any thread using QHostInfo::lookupHost(), we're presented with a data race, thus UB. Fix by making the accesses to QHostInfoCache::enabed atomic. Relaxed operations are suffcient, as the bool is the only data of interest in these situations. In particular, access to the cache itself is protected by the cache's mutex. We use std::atomic<bool> because QAtomicInteger<bool> doesn't exist on all implementations, but std::atomic<bool> must. Commit a0faf9e2366 set the precedent that it works. Change-Id: Ia1766753bb54c5fe8d8447b51a49a96a7a853eef Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
| | | * QFreeList: fix memory order on block deletionMarc Mutz2019-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Blocks are likely to have been created in a differnt thread from the one performing their deletion, so we need an acquire fence. The rest of the atomics use in the class looks ok, but nevertheless warrants a deeper analysis. Change-Id: I1571ded3a06695b0d58b5bf1d80d6283ac21f959 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 6fa34930c23c7494a3f2703777f46794ff091e2b) (cherry picked from commit 51bcc7e07e2bb5b42bb200dcd5269e9e9e2fe240) Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
| | | * QSimpleTextCodec: fix load memory order of atomic pointerMarc Mutz2019-07-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pointer value is not the only data we're interested in, but instead points to indirect data, so we need a release fence on store (present) and a corresponding acquire fence on load (was missing). Change-Id: I51f8251c0c7f4056192880430f2be5e0836dbed6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 6f84829031f318bfda1deff5f409b5ea6c6a5c5f) (cherry picked from commit 4cc6e1419294a729e53d698bace2254903c1429b) Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
| | | * Don't set the mouse cursor for items that are disabledVolker Hilsheimer2019-07-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As with widgets, items that are disabled should not receive any input events. Similar to QGraphicsScene, which ignores disabled items when handling mouse presses, the view should also ignore them when handling mouse moves to update the cursor. Since QGraphicsView only adjusts the cursors on mouse moves, reenabling an item that is currently under the mouse will not change the cursor. This is consistent with other changes of item attributes that would position the item under the mouse (such as moving it). The overhead of hit-testing items for every such attribute change would be too large, and applications can generate a mouse move event if they really need to adjust the cursor in all situations. [ChangeLog][QtWidgets][QGraphicsView] Ignore disabled items when setting the mouse cursor. Fixes: QTBUG-76765 Change-Id: Ifcd31fc0581e8421e58eeb436a55b031909eed7e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| | | * xcb: fix thread synchronization issue in QXcbEventQueue::waitForNewEvents()Gatis Paeglis2019-07-081-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch amends 730cbad8824bcfcb7ab60371a6563cfb6dd5658d The issue was that the event reader thread (QXcbEventQueue::run()) can enqueue events sometime between GUI thread has last time peeked at the queue and before it has called waitForNewEvents() and hence started waiting for more events (via QWaitCondition). This scenario is even mentioned in the QWaitCondition documentation: "[..] if some of the threads are still in do_something() when the key is pressed, they won't be woken up (since they're not waiting on the condition variable) and so the task will not be performed for that key press. [..]" And if there are no more events on the X11 connection, the waitForNewEvents() in QXcbClipboard::waitForClipboardEvent() would timeout. Fixes: QTBUG-75319 Change-Id: I8990a2a0c00571dfc334fb57d616dee999042885 Reviewed-by: Igor Kushnir <igorkuo@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| | | * Doc: Fix incorrect enum value referenced in QImageReader::transformation()Topi Reinio2019-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And remove the \c command to enable auto-linking. Fixes: QTBUG-76878 Change-Id: Ia2352942c7e7040088347becbda07062a9544c98 Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
| | | * Fix compilation with C++20Marc Mutz2019-07-065-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implicit capture of 'this' in [=] is deprecated in C++20. Fix by using explicit captures. Change-Id: I1633446f4670202b0d1aca938d8c27dbc0c1411e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
| | | * QHostInfo: fix a race condition on wasDeletedMarc Mutz2019-07-051-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The plain bool variable wasDeleted is set to true in the QHostLookupManager dtor before the call to clear(), which calls waitForDone() on the thread pool performing the lookups. All tasks on the thread pool start by checking this variable so as to return early when destruction is in progress. But the check was outside the mutex-protected area, so as a non-atomic load, without a happens-before relation to the write, this is a Data Race, thus UB. Fix by moving the check past the mutex locking into the critical section. This way, tasks that were waiting for the mutex after seeing no wasDeleted before get the message reliably. This does not introduce a dead-lock, since the call to waitForDone() is outside any mutex protection leaving a window for the tasks to obtain the mutex and react on wasDeleted. Change-Id: Ied4b9daa7dc78295b0d36a536839845c4db2fb78 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
| | | * QWidget::restoreGeometry(): Fix Windows being restored out of screen areaFriedemann Kleint2019-07-051-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Factor out the screen area check to a separate helper and apply to restoredGeometry, too, fixing an oversight of 2f2bfc4e59cecfdd210663fbf81c000ecddfb822. Change-Id: I795d8d5e3cddb5e986c96c08a342d69063d04970 Fixes: QTBUG-76900 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
| | | * QWidget::restoreGeometry(): Remove code related to restoredFrameGeometryFriedemann Kleint2019-07-051-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | restoredFrameGeometry is only used for a sanity check in format version 0, add a comment and remove code. Task-number: QTBUG-76900 Change-Id: I797b07d069f8568cb39541bcbe9009935a4a79f7 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
| | | * Support pen color in QOpenGLTextureGlyphCacheEskil Abrahamsen Blomfeldt2019-07-052-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an enabler for supporting pen color for color fonts in Qt Quick. Task-number: QTBUG-74761 Change-Id: I3e605f939e6677cbbd4a650ae7998dea8fd2d7a9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| | | * Fix the appearance of QSpinBox arrows on high-DPI displaysAndre de la Rocha2019-07-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A previous change to QLineEdit::sizeHint() has caused the QSpinBox arrows to break the widget frame on a high-DPI display with some particular scale values like 150 or 175%. This change updates QLineEdit::sizeHint() so that it has a minimum height, using the same values used in 5.11. Fixes: QTBUG-76047 Change-Id: I21f3e736da473b10fdf52e5a60e5fc5d07f270a1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| | | * Support pen color with color fontsEskil Abrahamsen Blomfeldt2019-07-0512-34/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Color fonts may also contain regular alphabet characters that should be rendered with the current pen. In Qt, however, these characters were drawn into the cache with a default pen color of black. Since all characters in a font is currently backed by the same cache, and it would require a lot of plumbing to get around this, a step in the right direction is to include the current pen color in the cache as long as it is an RGB cache. This means that drawing text with the color font with different pen colors will create different caches. There is no API to select font color on Freetype currently, but this problem has also not been observed there, as the fonts in question, with both regular and color glyphs, are not being detected as color fonts (so the text color will be correct). So Freetype will be left out for now. [ChangeLog][QtGui][Text] Fixed bug where regular text rendered with a color font would always display in black. Task-number: QTBUG-55096 Task-number: QTBUG-74761 Change-Id: Icc7dbf73241db1e7cc6a0de18c2de927aeecf713 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| | | * Windows QPA: Fix blinking dot on Windows 7/8/8.1Andre de la Rocha2019-07-041-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A blinking white dot could appear on dark backgrounds on Windows 7/8/8.1. It was caused by a workaround added to trigger the on-screen keyboard on the Microsoft Surface. This change effectively restricts that workaround to Windows 10, where the blinking dot was not an issue. And anyway, impact over the Surface functionality should be minimal, as all models produced since 2015 only support Windows 10 (and it's unknown if the workaround was ever necessary for early models running Windows 8.1). Fixes: QTBUG-74492 Change-Id: Ic9b9c0f71f23b75212054c56a29796cf0efa109a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| | | * Windows QPA: Fix Wheel event coordinatesAndre de la Rocha2019-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases, the wheel event coordinates would be incorrect, as the local coordinates were being determined relative to one window and the event being sent to another window, possibly incorrect. Fixes: QTBUG-75820 Change-Id: I4c3c4c6c4688bd9232d67ce4052d24365f6aea3a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * | | QByteArray: Clarify that QByteArrays always use the Latin-1 encodingAndre Hartmann2019-07-121-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... irrespective from the users current locale. Fixes: QTBUG-76938 Change-Id: I78810a75ecf9e9f1067363ce56656124b6ddcefd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | | Doc: Ensure macOS-specific widget docs are generated on other platformsTopi Reinio2019-07-122-0/+4
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Clang parser in QDoc fails to parse the .mm source files if their include files are not found. Add a dummy 'AppKit.h' file under the /doc directory for this purpose, and add its include path to qtwidgets.qdocconf. Task-number: QTBUG-77009 Change-Id: Iaa984cb8f860367cbb7aa95808d26fb69d7da349 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | | Fix more implicit QAtomic<T> <-> T conversionsMarc Mutz2019-07-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were hidden in !QT_CONFIG(thread) code. The irony! This patch does not change the semantics of the operations. It just makes the implicit operations explicit. Any fixes or optimizations are left for follow-up patches, if any. Change-Id: I014eb71745532dae2efe7963aa87321f61b1bd7a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | QWasmEventTranslator: replace five QHash with constexpr C arraysMarc Mutz2019-07-162-41/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mapping is static, but a dynamic (even mutable) container was used. Fix by using C tables and liner scan, which will be just as fast or faster than a hash lookup, for the maximum of six entries of each table. Change-Id: I899d5b1428dc82cf58862f238595a266aef8279f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | | QAbstractItemModel: don't inherit QHash just to add elementsMarc Mutz2019-07-161-14/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we can depend on C++11, use _WITH_ARGS and std::initializer_list. Saves ~400B in text size on optimized AMD64 GCC 9.1 Linux LTO builds. Change-Id: I37fce1c63a5f74f6dfc059febf0152ac93c8be7f Reviewed-by: David Faure <david.faure@kdab.com>
* | | QProcessEnvironment: simplify lockingMarc Mutz2019-07-163-37/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mutex is only protecting 'nameMap'. Proof: it's only defined on platforms on which there is a 'nameMap'. Also, nothing else is mutable, so no lazy init going on here. So, drop all the mutex protection, except where we access 'nameMap', and draw the mutex as close as possible to the nameMap uses, iow: copy ctor, prepareName() and nameToString(). As a consequence, the old (Ordered)MutexLocker class only needs to be defined on Unix. Change-Id: Ic969313bc48ad7ebf24c5dca7fd48359956b048d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Optimize QInotifyFileSystemWatcherEngine::getPathFromID()Marc Mutz2019-07-151-8/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code basically wants to get the last element of equal_range(id). The problem is that backwards iteration on QHash is very expensive, because it's implemented as forward search with wrap-around at bucket end. So it was implementing its own equal_range with look-ahead. The problem is that it compared each key in the equal_range twice: once in the if, and once more in the following while iteration. I expect to see this kind of algorithm more as we move away from the fake bidirectionalism of QHash, so I decided to implement it in a generic way. We can copy it somewhere else when we find more users. Change-Id: I7951652107ab897f6a456035f02e0339835e078d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | QNetworkRequest: make the default ctor implicitMarc Mutz2019-07-152-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As in QVarLengthArray (c34242c679aaea6ee1badf6c1e5f274f925f5f50), this will probably bite someone someday, so fix it before there's a bug report. Use ctor delegation to keep code size increase small. There's also the benefit that default-constructing a QNetworkRequest now no longer creates an expensive QUrl object just to destroy it unused again. Add an auto-test. Change-Id: I5ceb5402ca3946048d695244d1b1c36564a1e80a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | Eradicate Q_FOREACH in the WASM plugin and mark the plugin free of themMarc Mutz2019-07-152-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first one is trivially correct: it clearly doesn't modify the container under iteration. The second is a bit more subtle, because drawWindow() could be expected to call a paintEvent and this could theoretically lead to lowering, closing, or opening of a window. But this function just ends up blit()ting, so it doesn't call into user code. Change-Id: Id15e0102e9c8aa12516af27d771104e9993c48a1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | | QWasmFontDatabase: replace QStringList with a C array of stringsMarc Mutz2019-07-151-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The content is static, so a dynamic container is overkill. Use a C array. Don't make it static, as that creates more problems than is solves (static initialization). Change-Id: I07534c3336efbb6bbc19bfa1b8dad0c578d4e274 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | | Fix qdoublescanprint_p.h path in corelibTasuku Suzuki2019-07-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The qdoublescanprint_p.h header moved from tools/ to text/ when text/ was introduced. Amends a9aa206b7b8ac4e69f8c46233b4080e00e845ff5. Change-Id: Ia7167fc3c4cdb05d4f2e56c0a0427a80e3cee362 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | QVarLengthArray: optimize pop_back()Marc Mutz2019-07-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't call realloc() with all its machinery when we know exactly what to do: destroy the last element and decrease the size by one. Extend the test, removing the unused Foo class for a new Tracker one. Change-Id: I568eef4f6335669689fb16fd23af92cb4d6464bd Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | QAbstractMetaCallEvent: fix compilation with out feature.thread on ClangMarc Mutz2019-07-141-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | Clang warns that the private field semaphore_ is unused, and is correct, of course. Change-Id: Ic1372cedd3f4b2facca9f6f6be398d26f406b379 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | QNativeSocketEngine: disable sign-compare warning-turned-error on ClangMarc Mutz2019-07-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On the WASM platform, the macro CMDG_NEXTHDR, which is not under our control, emits a warning about comparing ulong and long with each other, which -Werror turns into an error: qnativesocketengine_unix.cpp:1004:24: error: comparison of integers of different signs: 'unsigned long' and 'long' [-Werror,-Wsign-compare] cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~ emsdk/emscripten/1.38.30/system/include/libc/sys/socket.h:286:44: note: expanded from macro 'CMSG_NXTHDR' __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix by locally disabling the warning. Change-Id: Ia2ed4318b2ef679b84ac8544835d1e383568ccac Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QFilesystemEngine: fix unused variable warning-turned-error on WASMMarc Mutz2019-07-131-0/+4
| | | | | | | | | | | | | | | | | | | | | ... and, presumably, Integrity. Change-Id: I54d35fd11b7df139022e2575c29b2d832f80f761 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Remove usages of deprecated APIs of qtbase/guiSona Kurazyan2019-07-132-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Replaced the usages of deprecated APIs by corresponding alternatives in the library code and documentation. - Modified the tests to make them build when deprecated APIs disabled: * Made the the parts of the tests testing the deprecated APIs to be compiled conditionally, only when the corresponding methods are enabled. * If the test-case tests only the deprecated API, but not the corresponding replacement, added tests for the replacement. Change-Id: Ic38245015377fc0c8127eb5458c184ffd4b450f1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | Centralize the MSVC work-around for std::is_permutationMarc Mutz2019-07-122-15/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's currently only one user, but another one is coming up, so apply DRY and centralize the work-around for the MSVC warning C4996 on use of 3-arg STL algorithms in one place. The code is prepared to handle other algorithms with ease, should any more crop up. Change-Id: Ia881888d6a2b5286c6d8d823bc2b76788efad624 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | ABI fixups for QColorSpaceAllan Sandfeld Jensen2019-07-122-4/+15
| | | | | | | | | | | | | | | | | | | | | Declare it shared to Qt and make the move method noexcept. Change-Id: I25d5d255d300fda109ffa1a08e1849b15e9ff29c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | QHash: optimize equality operatorMarc Mutz2019-07-121-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - First compare the d-pointer before dipping into *d - Keep a running count as we calculate thisEqualRange, as std::distance() on QHash::iterator is very expensive. - Skip the pointless first comparison of the unadvanced iterator's key() with itself (found by Mårten Nordheim) Also rename (it, thisEqualRangeEnd) → (thisEqualRangeStart, it), to keep advancing `it`, which is more natural than advancing an `end` and later resetting it = end. Change-Id: I2c27c071b9ee23425a763328402dad9efee4cbd0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | Finish deprecating obsolete members of QWheelEventShawn Rutledge2019-07-1215-212/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt 5.0, delta() and orientation() were already marked obsolete, but Widgets and tests have kept on depending on them all this time. We now start using alternative API so they can really be deprecated. All constructors except the newest one are also deprecated. The plan is for all events from pointing devices to have QPointF position() and globalPosition(), so we deprecate the other position accessors. [ChangeLog][QtGui] Obsolete constructors and accessors in QWheelEvent now have proper deprecation macros. What is left is intended to be compatible with planned changes in Qt 6. Change-Id: I26250dc90922b60a6ed20d7f65f38019da3e139e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>