summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Clean up QLocaleData::validateChars() and fix its double-handlingEdward Welbourne2021-08-301-59/+43
| | | | | | | | | | | | | | | | | | Decrementing decDigits and checking for zero is less complicated than incrementing a counter to check against it if it's not negative. A plethora of unenlightening local variables could be replaced by keeping track of the last character and of a simple state variable that make checks easier to understand (and explain). Various conditions could be expressed more simply. Comment on the condition for omitting grouping characters from the transcript - it was easy to mistake the comma for a dot ! Comment on the lack of checking of grouping sizes. Change-Id: Iff8da2376507d2abbbaf5739baf6cbb23e55edaf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Teach QByteArrayView how to parse numbersEdward Welbourne2021-08-304-3/+323
| | | | | | | | | | | | Now that we don't need '\0'-termination on the data, this is possible. Moved QByteArray's tests to tst_QByteArrayApiSymmetry and added some more test-cases. [ChangeLog][QtCore][QByteArrayView] Added numeric parsing methods. Change-Id: Ic0df91ecfe5dbf6f008d344dd0464d7927f32273 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Avoid UB (and the consequent need to suppress an MSVC warning)Edward Welbourne2021-08-302-14/+7
| | | | | | | | | | | | | Converting a negative signed value to its absolute value in the matching unsigned type can be done by adding one, negating (which we can now do without the UB), casting and then adding one again. This is cleaner than casting the negative value to the unsigned type in order to then "negate" it within that type, about which MSVC grumbles; we can now avoid the need to suppress that grumble. Change-Id: I9148ead23c928aeb2b90884a2f2e292fdf3af5e3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove temporary inlines for qstrtou?ll()Edward Welbourne2021-08-301-5/+0
| | | | | | | | All callers are now converted to use qstrntou?ll(). Change-Id: I279a800a9f19944e544cc8a7ebaba579d18643b3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Rework QLocalePrivate::bytearrayToU?LongLong()Edward Welbourne2021-08-304-36/+43
| | | | | | | | | | | | Change it to take a QByteArrayView instead of a plain char *; all its callers do know the size and propagating it enables the implementation to call strntou?ll() rather than strtou?ll(), thereby escaping the need for '\0'-termination. Fixes: QTBUG-74286 Change-Id: Ie9394786e9fcf25c1d1be2421805f47c018d13bb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Convert various callers of strtou?ll() to call strntou?ll()Edward Welbourne2021-08-308-29/+32
| | | | | | | | Where size is known or can readily be determined. Change-Id: I442e7ebb3757fdbf7d021a15e19aeba533b590a5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Replace FreeBSD's strtou?ll() with std::from_chars()-based strntou?ll()Edward Welbourne2021-08-307-493/+88
| | | | | | | | | | | | | | | Remove third-party code in favor of STL. Implement (for now) strtou?ll() as inlines on strntou?ll() calling strlen() for the size parameter. (This is not entirely safe, as a string lacking '\0'-termination but with at least some non-matching text after the numeric portion would formerly be parsed just fine, but would now produce a crash. However, strtou?ll() are internal and callers should be ensuring '\0'-termination.) Task-number: QTBUG-74286 Change-Id: I0c8ca7d4f6110367e93b4c0164854a82c5a545e1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* TLS plugins: Prefix with 'q'Mårten Nordheim2021-08-308-8/+8
| | | | | | | | For consistency with other plugins. Pick-to: 6.2 Change-Id: I45507389a42e645c94f1ca3f32262a2181f282f7 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Android: pass -g to testrunner to grant run time permissionsAssam Boudjelthia2021-08-291-1/+1
| | | | | | | | | | | Some Qt modules/tests go through features that require run-time Android permissions which are granted by user input, that of course is not ideally possible while running unit tests. So when installing the app adb can do that for us. Pick-to: 6.2 Change-Id: I92d33d5213c3779d7ca246ec0fb359d2ead4fa6f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* macOS: Hide mouse cursor when initiating IM enabled text inputTor Arne Vestbø2021-08-271-0/+13
| | | | | | | Fixes: QTBUG-72744 Pick-to: 6.2 Change-Id: I952710e88a11fd00498562c9011461a010f02f7b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Correctly implement attributedSubstringForProposedRangeTor Arne Vestbø2021-08-271-6/+36
| | | | | | | | | | | | | | | | The substring range refers to the entire text of the focus object, not just the selection. As there is no way to pull out the entire text via input method queries we do the best we can via ImTextBeforeCursor and ImTextAfterCursor. Returning the correct substring enables input method features such as backtracking into already committed text with the Hiragana IM, as well as the Keyboard Viewer's 'Current Text' toolbar. Pick-to: 6.2 Change-Id: I53286ef1e8e7c5fba37858dda7317ae74d95b528 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Assume input method handles key eventTor Arne Vestbø2021-08-272-12/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When input methods are enabled for the focus object we send key events through interpretKeyEvents, which will involve the input method in the key event processing. The input method will get back to us with callbacks such as insertText, setMarkedText, or doCommandBySelector. In the case of insertText, when the inserted text matches the originating key event's text, we opt to not send the text as an QInputMethodEvent, and instead fall back to sending it as a normal QKeyEvent. The reason for this is that Qt's IM protocol was designed to handle composited text, so sending non-composited (but IM-initiated) text input as IM events is unexpected (see 2d05d3bd2815c220474b3c07bf3f2ef7417d3070). However, we cannot assume that the input method will always call us back with one of the above mentioned methods. The input method can very well eat the event as part of its own operation. This happens for example when pressing and holding 'a' in a US English keyboard layout, which will pop up an input panel for the various accents available. Or it may happen when using the AquaSKK third party IM, which uses the 'l' key to switch the input mode to latin without producing any characters. To allow these input methods the freedom to control the processing of key events we need to reverse the logic for when we send key events as QKeyEvent. We now assume that the IM will handle the event, and only trigger QKeyEvent in two cases where we explicitly were called back by the IM, but decided that a QKeyEvent is needed: - If the IM calls insertText and we consider the text simple text - If the IM calls doCommandBySelector and we can't find a matching selector for the command. We only implement insertNewline and cancel, so in all other cases we want to pass on the key event to let the focus object handle it, for example for 'Select All' and similar key combinations. Fixes: QTBUG-46300 Fixes: QTBUG-71394 Pick-to: 6.2 Inspired-by: Vladimir Belyavsky Change-Id: I9a73a8e1baa2ebe0c5df1166a9ec3d9843632bb1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QNetworkAccessCache: Remove unused codeMårten Nordheim2021-08-272-42/+0
| | | | | | | | The function was never called. As a consequence receiverQueue was only ever read and never written. Change-Id: I30905446452d9f263124d3af08c42e2e1b0cafbe Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix deprecation of QMouseEvent::source() and flags()Shawn Rutledge2021-08-272-1/+3
| | | | | | | | | | Amends 53496e67f0b78645c6080e9218c7a36bc5a9d76d: - move flags() out of the QT_DEPRECATED_SINCE block in the header - add QT_DEPRECATED_SINCE block around source() implementation Pick-to: 6.1 6.2 Change-Id: Id52fa6b04a13efbede3e6ac440060f90b283e773 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* qlocale_win: Simplify and explain month-name format lookupEdward Welbourne2021-08-271-5/+4
| | | | | | | | | | | | Retain the given month number and simply subtract one from it in the one place it's used (once the two array dereferencs are unified). That makes it clear that the off-by-one numbering is just down to our arrays, not some weired quirk of the MS API. Simplify a condition by inverting it: compare to LongFormat instead of ||-ing comparisons to the other two members of the enum. Change-Id: Ia03486b7869255ecdb1372de62d5c745d35d0a0a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Update Android default SDK from 29 to 30Juha Vuolle2021-08-271-1/+1
| | | | | | | | | | | By the time of Qt 6.2 release all new apps targeting Play store must target API level 30 (Android 11) or above (starting in 08/2021 for new apps and 11/2021 for existing apps' updates). Pick-to: 6.2 5.15 Task-number: QTBUG-94451 Change-Id: Id7fa2fd62899a7259e365c917292c6c3ac0d2b0d Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Make clear why QTestLog::addB?XFail() don't add to countersEdward Welbourne2021-08-271-2/+4
| | | | | | | | | | | | | This reverts commit 904617dfb83f39a6a379635b64fea6fcd00f241a and makes clear to future readers why that wouldn't be a sensible change. Update the test's data, eliminating a case of duplicate counting that was caused by the reverted commit. Task-number: QTBUG-95661 Pick-to: 5.12 5.15 6.1 6.2 Change-Id: Ice6d3ab06ca171e0d6eb0fac757f1ab774e229f0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Handle replacement range during marking of textTor Arne Vestbø2021-08-271-0/+16
| | | | | | | | | | | | The input method may include already committed text when marking text, in which case the replacement range reflects the position and length of the existing text. We handle this the same way we do replacement ranges in insertText. Pick-to: 6.2 Change-Id: I148e4701318a59c7e0d9441d157199d7c8606f43 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Handle IM insertNewline by sending synthetic Qt::Key_ReturnTor Arne Vestbø2021-08-273-8/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Depending on the input method, pressing enter may result in simply dismissing the input method editor, without confirming the composition. For example with Hiragana, pressing 'a', then 'Tab', and then 'Enter'. In other cases it may confirm the composition as well, for example with Hiragana, pressing 'a' and then 'Enter'. And in some cases the IME will produce an explicit new line, for example with US English, pressing '~' and then 'Enter', or with 2-Set Korean, pressing 'a', then 'j', and then 'Enter'. Semantically, the input method has then asked us to insert a newline, and we should probably do so via an QInputMethodEvent, either directly or via [self insertText:@"\r"]. This is also how NSTextView handles the command. But, if we did, we would bypass all the code in Qt (and clients) that assume that pressing the return key results in a key event, for example the QLineEdit::returnPressed logic. To ensure that clients will still see the Qt::Key_Return key event, we send it as a normal key event. But, we can not fall back to handleKeyEvent for this, as the original key event may have text that reflects the combination of the inserted text and the newline, e.g. "~\r". We have already inserted the composition, so we need to follow up with a single newline event. Task-number: QTBUG-39125 Pick-to: 6.2 Change-Id: If1e95687e6d5b06011692175a325f457b0b8a72f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Factor out key event handling into helper structTor Arne Vestbø2021-08-272-72/+140
| | | | | | | | | | | This allows us to share code between handleKeyEvent: and flagsChanged: for parsing the incoming NSEvent, and allows for sending key events from other call sites in the future without duplicating the parsing and sending logic. Pick-to: 6.2 Change-Id: Ic63f740523496a9432e439663a20f78b5bc234c5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Return early from key handler if shortcut was handledTor Arne Vestbø2021-08-271-7/+3
| | | | | | | | The code paths after accepting a shortcut event can never be hit. Pick-to: 6.2 Change-Id: Ida77417adb8fcfd25a4b20c4eb86056b3769f014 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QNetworkCookie: Clean upMårten Nordheim2021-08-271-8/+8
| | | | | | | | | | | | | Rewrite the regex to not capture the things we ignore anyway. Use capturedView to avoid allocating a string just to turn it into an int. Fix a (usually) ifdef-ed out piece of code that was still calling a QRegExp function. Make the QRegularExpression static const to save it from having to recompile every time. Change-Id: I2f4841a2bc35df4e6cea44aec72432410583f770 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* rhi: gl: Set the screen on the context, if possibleLaszlo Agocs2021-08-271-0/+2
| | | | | | | | | | | | | | | | | | | | Take the screen from the window, if the window was specified. When it comes to Qt Quick, this is in fact required in order to make the behavior on par with Qt 5, see https://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/quick/scenegraph/qsgthreadedrenderloop.cpp?h=5.15#n1336 try to mirror that in Qt 6 as well. There are still subtle differences between Qt 5 and Qt 6 in particular when qt_gl_global_share_context is set (do we set the screen from that or from the window?), for now leave that question unsettled. What exactly setting the screen on the context does is platform specific, and can become relevant with multi screen, multi GPU systems. Pick-to: 6.2 Change-Id: Icc90b8fea87bf1e34ecf1dec0702f4d3c411db00 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* QObject::connect(): fail to connect to a functor if UniqueConnection is passedGiuseppe D'Angelo2021-08-271-7/+26
| | | | | | | | | | | | | | | | | | | | | The connect() documentation makes it clear that UniqueConnection does not work with free functions / function objects and the like; only with actual PMFs. Rather than silently *ignoring* the flag, be vocal about its presence by warning, and make the connection fail (as the user has passed an illegal argument). [ChangeLog][QtCore][QObject] QObject::connect() now will refuse to connect a signal to a free function / function object if UniqueConnection is passed. Note that UniqueConnection has never worked for such connections -- the flag was simply ignored, and they were established multiple times. Now, the flag is not ignored and results in a connection failure (as well as a runtime warning by Qt). Change-Id: I6509667018c74f9bd24910cde0a1b16c5f84f064 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QToolButton: reimplement the fix for QTBUG-95255Giuseppe D'Angelo2021-08-272-7/+10
| | | | | | | | | | | | | | | | | The code in 188d739400e10fc8571bbf2ec86d5cd338b04a5d uses a connect() to a lambda, passing UniqueConnection to avoid establishing the connection more than once. The problem is that UniqueConnection does not work with lambdas; it works only with "regular" PMFs to QObject subclasses. Re-do the same fix, but without a connection: use the checkStateSet() virtual from the base class that will notify us if setChecked() is being called on the tool button, and from there synchronize the state of the default action. Change-Id: Id512812c562cd6d20bc1a489753b33c269919d32 Fixes: QTBUG-95255 Pick-to: 6.2 6.1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* wasm: enable the new event dispatcher for qtcoreMorten Johan Sørvig2021-08-271-0/+4
| | | | | | | | | Use the new event dispatcher for all non-GUI threads, nn practice for the main thread when using QCoreApplication, and when calling QThread::exec(). Change-Id: I9184d52532e06da7e6a87ee27c7d53e0d15e693a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* wasm: add new event dispatcher implementationMorten Johan Sørvig2021-08-273-0/+671
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add QEventDispatcherWasm to QtCore. The event dispatcher supports managing event queue wakeups and timers, both for the main thread or for secondary threads. Blocking in processEvents() (using QEventLoop::WaitForMoreEvents) is supported when running on a secondary thread, or on the main thread when Qt is built with Emscripten’s asyncify support. Code is shared for all both modes as far as possible, with breakout functions which handle main and secondary thread as well as asyncify specifics,. Some functions like wakeUp() can be called from any thread, and needs to take the calling thread into consideration as well. The current asyncify implementation in Emscripten is restricted to one level of suspend, and this restriction carries over to Qt as well. In practice this means we support one level of exec()-like API. Note that this commit does not _enable_ use of the new event dispatcher. This will be done in separate commits. Task-number: QTBUG-76007 Task-number: QTBUG-64020 Change-Id: I77dc9ba34bcff59ef05dd23a46dbf1873cbe6780 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* wasm: add Emscripten module accessor to qtloader.jsMorten Johan Sørvig2021-08-271-0/+10
| | | | | | | | | | | | | | After enabling -s MODULARIZE=1 there is no longer a global MODULE object. Add module() accessor which can be used to retrieve the Emscripten module. This does not really fit with the current state tracking since the app transitions from “loading” to “running” before the module object is ready. We’ll have to revisit this at some point. Change-Id: Ib7191cf4ce436e1de99f84b63ed4c10936fa62b1 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Implement generating of private cpp exportsAlexey Edelev2021-08-272-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Add the generating of private cpp exports for Qt modules. Add the GENERATE_PRIVATE_CPP_EXPORTS option to qt_internal_add_module that is the manual switch for private exports generator. Existing modules in qtbase doesn't follow any strict convention of using private cpp export. So there is no clue how to detect if generating of the private exports is required or not for the module. Use autogenerated private cpp exports in QtNetwork module. CPP_EXPORT_HEADER_NAME argument of the qt_internal_add_module function is replaced by the CPP_EXPORT_HEADER_BASE_NAME and has a different meaning. The provided name is used as a base name for the private and non-private headers that contains cpp exports. Header files suffixes are constant: .h and _p.h for the non-private and private header files accordingly. Pick-to: 6.2 Task-number: QTBUG-90492 Change-Id: Icf11304e00379fb8521a865965c19b974e01e62f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* macOS: Check NSEvent.characters to determine dead key stateTor Arne Vestbø2021-08-271-2/+3
| | | | | | | | | | | | | | We map NSEvent.characters to text that we pass on in our QKeyEvent, but for Qt 4 compatibility we explicitly skip function keys and arrow keys, as the text these events produce are control characters. See 4dbce2a469608194527188a136baa3e812caf361. However, these keys are not dead keys, so we can't use the resolved text we're planning to pass on to Qt to determine if they are. Pick-to: 6.2 Change-Id: Ib59f0489ae014379c699600f14634c55161ccc8a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Use current NSEvent to determine if IM text matches key eventTor Arne Vestbø2021-08-273-13/+17
| | | | | | | | | Gives us one less state member to worry about in the IM machinery. Task-number: QTBUG-35700 Pick-to: 6.2 Change-Id: Iaa06b29015f9b9594b8107b74a8931f076a26e12 Reviewed-by: Liang Qi <liang.qi@qt.io>
* QNetworkCookie: Fix use-after-freeMårten Nordheim2021-08-261-3/+4
| | | | | | | | | | | | The code was previously calling indexOf() on a temporary, which QRegularExpression would create backing storage for. After 11d1dcc6e263c5059f34b44d531c9ccdf7c0b1d6 the internals were made to use the QStringView path, which inadvertently meant that there was no storage for the temporary string anymore. So we need to keep it alive ourselves. Change-Id: I542da7010934594eba3b93261322963866ed9297 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Android: Add information about who launched this activity to intentsLars Schmertmann2021-08-261-0/+18
| | | | | | | | | | | * With this change, applications can easily determine the source of an intent without creating an own extension of QtActivity. * https://developer.android.com/reference/android/app/Activity#getReferrer() Task-number: QTBUG-84382 Pick-to: 6.2 Change-Id: I6a5200af1d997640f02e2b934343914fb5f32ccc Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QUrl: Implement UTS #46Ievgenii Meshcheriakov2021-08-264-2243/+591
| | | | | | | | | | | | | | | | UTS #46 (https://unicode.org/reports/tr46/) is a successor to IDNA 2003/2008 standards from Unicode. The current implementation uses nontransitional processing by default. An optional argument is added to QUrl::toAce() and QUrl::fromAce() to allow using transitional processing and to ignore the IDN whitelist. [ChangeLog][QtCore][QUrl] ACE processing is now performed according to the UTS #46 standard based on IDNA 2008 instead of IDNA 2003. Task-number: QTBUG-85371 Change-Id: I46b2e86792bc9699cb6961bae8e283fbff72f874 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* unicode: Regenerate Unicode tablesIevgenii Meshcheriakov2021-08-262-9405/+15304
| | | | | | | | | Re-run unicode utility to update the Unicode tables. This adds properties and mappings needed to implement UTS #46 (IDNA). Task-number: QTBUG-85323 Change-Id: Id1de91caddd82095f8f8f2301bfd7bb2ee3fcafd Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* CMake: Build a subset of tests when targeting iOS in the CIAlexandru Croitor2021-08-261-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | Add infrastructure to build cmake auto tests in the CI when targeting iOS. Currently the are only CI instructions for qtbase. More work is needed to make it work for other repos. With this change, we will build a single Widgets application targeting the iOS simulator. We can't target the device SDK in the CI because signing fails due to a missing signing certificate and provisioning profile. The Coin instructions will now set a QT_BUILD_ENVIRONMENT=ci env var whose value will be checked in _qt_internal_test_expect_pass, to ensure we build for the simulator SDK when using a universal Qt. Without this, xcodebuild will try to build with the device SDK and fail to build the project. Pick-to: 6.2 Task-number: QTBUG-95839 Change-Id: Ib39c9527b107b2004746ccbdc9d9d1d658f88c76 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Make _qt_internal_test_expect_pass more configurableAlexandru Croitor2021-08-261-6/+84
| | | | | | | | | | | | | | | | | | Introduce new options: NO_CLEAN_STEP, NO_BUILD_PROJECT_ARG, GENERATOR, MAKE_PROGRAM, BUILD_TYPE. If cache or env var QT_CMAKE_TESTS_ADDITIONAL_CONFIGURE_OPTIONS is provided, the value is interpreted as a list of additional configure arguments to pass to the built project. Also skip adding a test command if there is no BINARY or BINARY_ARGS option provided. Pick-to: 6.2 Change-Id: I3a1d82b41a734dcd3f473e59cc64efd00363e49b Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* rhi: Polish some feature flag docsLaszlo Agocs2021-08-261-22/+37
| | | | | | | | | | | | | | Clean a bit, also enhance, e.g. mention textureLod for TexelFetch which is how Quick3D uses it, and most notably expand the "in practice" notes. As no application or library can be expected to write fully conditional code based on all these flags, knowing when a certain feature is (un)supported in a real run time environment is essential in order to make informed decisions on when and in what manner (i.e. with or without conditions), rely on a given feature. Pick-to: 6.2 Change-Id: I15ea34e11bd345b36248f92de9b1fdb1fdc3e8d9 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: gl: Allow passing in a custom shareContextLaszlo Agocs2021-08-263-3/+14
| | | | | | | | | | | | | | | | We already honor AA_ShareOpenGLContexts and pass in the QGuiApp's context as the shareContext for the QRhi's QOpenGLContext. Extend this to also allow specifying a QOpenGLContext in the init params struct. A good example of this is the backingstore compositor that serves QQuickWidget and co. If one wanted to implement that with (an OpenGL-based) QRhi, instead of direct OpenGL calls, then the ability to create a QRhi that uses a context that shares resources with a given other context becomes essential. Pick-to: 6.2 Change-Id: I6bc5ff8e803d467f8795197ac1f12fdc0f73bbd1 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* QLocale: improve documentation snippetIvan Solovev2021-08-261-9/+11
| | | | | | | | | | | | QString::toDouble() now always uses C locale, so the previous code snippet does not make much sense, as the results do not depend on the selected default locale. The updated snippet uses the default locale, which allows to show the difference between locales. Pick-to: 6.2 Change-Id: I76a00429fa5b75cf109cf45bc25280a7fd427e0f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* wasm: don’t dereference null reply pointerMorten Johan Sørvig2021-08-261-40/+33
| | | | | | | | | | | | | | | | | | | Move all access to the reply inside the nullptr check, while making sure to still call emscripten_fetch_close() unconditionally where needed. Make all four Emscripten callback handlers have a similar structure where we check if the reply is not null and not in the Aborted state. (This removes one emscripten_fetch_t nullptr check in stateChage(), if it is really the case that Emscripten calls us with a null emscripten_fetch_t then we should add it back.) Pick-to: 5.15 6.1 6.2 Change-Id: Iadcbe6338c338cfeb8967490e0951d8b3e1ec5b3 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* macOS: Modernize and clean up key event handlingTor Arne Vestbø2021-08-261-54/+56
| | | | | | | | | | | | | - Pass key event type as QEvent::Type - Use proper type for NSEventModifierFlags - Use modern Objective-C property access in key handler - Modernize flagsChanged implementation using ranged-for - Use explicit Qt::Key type in key handling - Add FIXME comments for dubious code Pick-to: 6.2 Change-Id: I533e0a5685108dc3cdccd2b276b4eb7a729d172e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Move replacement range calculations into helper methodsTor Arne Vestbø2021-08-261-35/+70
| | | | | | | | We're going to need this logic for marked text as well. Pick-to: 6.2 Change-Id: I461024c3df0c4956c794f16d1cb31fc6b0efe4c5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix Clang warning about loop variable creating a copyTor Arne Vestbø2021-08-261-1/+1
| | | | | Change-Id: I2a8b75294ee3bde008bcff37519da087f603ca51 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QGraphicsView: send timestamp information through QGraphicsSceneEventVolker Hilsheimer2021-08-264-0/+34
| | | | | | | | | | | | | | | | | Qt relies on event timestamp information to detect double click events. The information was not passed through QGraphicsSceneEvent, so the synthesized QMouseEvent delivered for the second press of a double click to an embedded widget was never recognized as a double click. This requires addition of a new setter/getter to QGraphicsSceneEvent. Event though not all QGraphicsSceneEvent instances will have a valid timestamp, this provides us with more flexibility than adding the API to several QGraphicsSceneEvent types (mouse, touch, wheel). Pick-to: 6.2 Fixes: QTBUG-96009 Change-Id: I343f25902286157f6d6670641dfad9c92dd44250 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* NetworkAccessBackend: Remove the backend part of the nameMårten Nordheim2021-08-262-2/+2
| | | | | | | | | | | | | | For consistency with naming of other plugins. Slight compatibility break, but this is semi-private API. [ChangeLog][Network][QNetworkAccessBackend] The NetworkAccessBackend plugin-type is renamed to NetworkAccess, if you have a plugin marked NetworkAccessBackend you need to change it to NetworkAccess. Pick-to: 6.2 Change-Id: Ib5ea02f542254b0f5b8c425c89ee00075a58c956 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QNetworkAccessManager: move #ifery out of if-conditionMårten Nordheim2021-08-261-4/+8
| | | | | | | for legibility Change-Id: Id5bc2471e79bb8560cec46068cc72573f6adec34 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QNetworkAccessBackend: emit readyRead less oftenMårten Nordheim2021-08-261-1/+4
| | | | | | | | | Once per iteration of the loop wouldn't theoretically be so bad if there was no overhead to emitting signals or reading from buffers. Change-Id: I0e424264fcc95eb2e2e5f8f908cf9ae3a7cc4b7e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Refactor QApplication::translateRawTouchEvent to take a QTouchEvent*Volker Hilsheimer2021-08-264-21/+11
| | | | | | | | | | | | Both call sites just pass the data from an existing QTouchEvent through, so just pass the QTouchEvent through instead. Amends 20d4f45a132606f7a910050d468519108486e9cf. Pick-to: 6.2 Change-Id: If3b9508b83311889b58e109e7f64743985b8b178 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Forward touchEvents to children inside QGraphicsProxyWidgetVolker Hilsheimer2021-08-263-12/+19
| | | | | | | | | | | | | | | | | | | | Just sending the event to the embedded widget is not enough, we have to perform hit-testing for the different touch points, and send the event to the child widget under the point. Fortunately, QApplicationPrivate::translateRawTouchEvent provides the logic that generates multiple events for groups of touch points. Since that helper always sent events spontaneously, add an optional parameter to allow sending of non-spontaneous events. Add a test case that simulates touch events to different widget configurations inside a QGraphicsProxyWidget. Fixes: QTBUG-67819 Task-number: QTBUG-45737 Pick-to: 6.2 6.1 5.15 Change-Id: Iffd5c84c64ee2ceadc7e31863675fdf227582c81 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>