summaryrefslogtreecommitdiffstats
path: root/src/gui
Commit message (Collapse)AuthorAgeFilesLines
* High-DPI: Set the minimum scale factor to 1Morten Johan Sørvig2021-03-021-5/+3
| | | | | | | | | | | | | | | Avoid painting errors with dpr < 1, also for the PassThrough mode. This limits the minimum high-dpi scale factor to 1, for the code path which determines the scale factor based on screen DPI. Pick-to: 6.1 Task-number: QTBUG-89948 Change-Id: I14b3f130f0ae141d5f05c87437f926a9f76d1dec Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Handle para tags the same way for OOB checks as the other tagsAllan Sandfeld Jensen2021-03-021-21/+16
| | | | | | | | | Do not include the first parameter in the main tag anymore. That is a left over from before unaligned access was added. Pick-to: 6.1 Change-Id: I2caf027c6b9930d3e23fe5ec8bdcd45db34835a9 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Handle desc tags the same way for OOB checks as the other tagsAllan Sandfeld Jensen2021-03-011-7/+3
| | | | | | | | | | Including one entry of the value in the header is pointless after the unaligned access rewrite, and a potentially dangerous pattern, though safe here due to overchecking. Pick-to: 6.1 Change-Id: I4c0380040f89920467c309503408f1df6f88423f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Limit value in setFontSizeFromValue()Robert Löhning2021-03-011-2/+2
| | | | | | | | | | | | Avoids overflows in QFreetypeFace::computeSize and QFontEngineBox::boundingBox Fixes oss-fuzz issue 30290 Pick-to: 5.15 6.0 6.1 Change-Id: If8e9ff74bf706a701e26832ad21b3439a3b437f7 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QBrush: get rid of an unused private functionGiuseppe D'Angelo2021-02-282-6/+0
| | | | | | | No idea why it's there, it's unused. Change-Id: Icf7b48e1e4ab37158a81e15ffa5a7125bfd10822 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix out-of-buffer in ICC curv parsingAllan Sandfeld Jensen2021-02-281-5/+6
| | | | | | | | | | After the unaligned ICC profile fix, we could read 2 bytes past the end of the buffer for curv elements with 0 parameters, though we wouldn't use or return the data. Pick-to: 6.1 6.0 5.15 Change-Id: Ibea9fa2840c01d690716d8f48e301fbfa67aa163 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Reduce warnings from ICC parsingAllan Sandfeld Jensen2021-02-252-9/+11
| | | | | | | | | | Messages about Qt deficiencies reduced to info, and info set as the default message level. Pick-to: 6.1 6.0 5.15 Fixes: QTBUG-91401 Change-Id: Ia97438f08de5e0383e77631dca9b253b47ef8167 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix logic problems with table based grayscale ICC profilesAllan Sandfeld Jensen2021-02-252-6/+6
| | | | | | | | | White-point was calculated wrongly and some tables could cause bad behavior in the tables. Pick-to: 6.1 6.0 5.15 Change-Id: I24e8f5f3cc1306f5f898a4acbf7b008e26bd04e2 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add more support for structured bindingsGiuseppe D'Angelo2021-02-251-0/+79
| | | | | | | | | | | | | | | | | | | | | | | After QPoint(F), it's now the time of QSize(F) and QVectorND, which can be unambiguously decomposed. [ChangeLog][QtCore][QSize] QSize is now usable in a structured binding declaration. [ChangeLog][QtCore][QSizeF] QSizeF is now usable in a structured binding declaration. [ChangeLog][QtGui][QVector2D] QVector2D is now usable in a structured binding declaration. [ChangeLog][QtGui][QVector3D] QVector3D is now usable in a structured binding declaration. [ChangeLog][QtGui][QVector4D] QVector4D is now usable in a structured binding declaration. Change-Id: I67bb152f4210f2be27607179cd2ec522174cc483 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QIcon::setIsMask: don't dereference nullptrVolker Hilsheimer2021-02-251-2/+2
| | | | | | | | | | | | | | QIcon::detach might result in the d pointer being nullptr, and other code tests for that condition and allocates the d pointer explicitly. Change the order of the tests in setIsMask as well, fix static analzyer warning 0a4723ca2d216ec8883a3d412aeded4c. Pick-to: 6.1 Change-Id: Idca12f230036362f13cbaee1ae4f0e5ce6726015 Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* And fix handling and test of QImage::fill(uint) as wellAllan Sandfeld Jensen2021-02-251-0/+4
| | | | | | | | | Only RGB444 and RGB666 were treated slighlty different from the rest, but the test had a few additional mistakes. Pick-to: 6.1 6.0 5.15 Change-Id: I4728b4036affedfffce8bca5c1e7be3869344fbe Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Improve QImage::fill(uint) documentationAllan Sandfeld Jensen2021-02-251-5/+5
| | | | | | | | | | Remove paragraph about long gone methods, and rephrase it as a note on corresponding getters. At the same time document 64-bit behavior as undefined. Pick-to: 6.1 Change-Id: I26ffd95040eb0aea30585aa0fa8526417b0ecc7a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Assert that either both or neither pointer are nullptrVolker Hilsheimer2021-02-241-0/+2
| | | | | | | | | | Identical change to qmetatype.cpp Fixes static analyzer warning 0267bc9b3ba521cf8bf0a7fea8981ee5 Pick-to: 6.1 Change-Id: Id6219f5025d703dd43b1742a067aa934d6aacd8c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid int overflow in QImage rotate90/180/270Eirik Aavitsland2021-02-241-21/+21
| | | | | | | Pick-to: 6.1 6.0 5.15 5.12 Fixes: QTBUG-91223 Change-Id: Ice53c80d695a5ffdf9162df84e7c9b1e43106bae Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Move build tools to libexec instead of the bin dirJoerg Bornemann2021-02-231-1/+1
| | | | | | | | | | | | | | [ChangeLog][Build System] Tools that are called by the build system and are unlikely to be called by the user are now installed to the libexec directory. This is a step towards easier co-installability of different Qt versions. Pick-to: 6.1 Task-number: QTBUG-88791 Change-Id: Id19575b5ba27795f7715e4ea6a09391b26dd4942 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Fix handling of virtual/native pixels in QAndroidPlatformWindowAndreas Buhr2021-02-231-15/+22
| | | | | | | | | | | | f92e1953699b2529cc6ea2fd399fe4f2b887e83c made sure a new QAndroidPlatformWindow always has a geometry. However, it did not take into account HiDPI handling. This patch fixes it and introduces proper HiDPI handling. Pick-to: 5.15 6.0 6.1 Fixes: QTBUG-91161 Change-Id: Iddf31b7abfd0a1bada3b051ed4de3bf6c2897d8e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* iOS: Pass the text to handleExtendedKeyEvent when knownAndy Shaw2021-02-232-2/+6
| | | | | | | | | This will ensure that the QKeyEvent also has this information passed on as appropriate. Pick-to: 6.1 Change-Id: I52436404115b453664b9b3414f8ec4e715dd6a28 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QAbstractFileIconProvider: Use platform theme iconsFriedemann Kleint2021-02-213-24/+114
| | | | | | | | Add code paths to use platform theme icons should icon themes fail. Task-number: QTBUG-66177 Change-Id: I9554637f5230b1f57faaeef6b2c04cf082271edb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Initialize some uninitialized member variablesHe MingYang2021-02-202-8/+10
| | | | | Change-Id: Ia8e06850a2288f40906602adfbe40abb0faf8057 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add scaledPixmap() overrideMorten Johan Sørvig2021-02-192-0/+7
| | | | | | | | | | | | | | | | | QAbstractFileIconEngine implements the QIconEngine interface and creates a new interface where subclasses override the filePixmap() function. QIconEngine subclasses must now also override scaledPixmap(); add implementation which forwards to filePixmap(). (The intermediate implementation in QPixmapIconEngine is not used by QAbstractFileIconEngine.) Pick-to: 6.1 Task-number: QTBUG-91104 Change-Id: I229e3a003ad0c3fff768eac7e75c59fe7145fcaa Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Make constructing QFont from families explicitVolker Hilsheimer2021-02-181-1/+1
| | | | | | | | | Disallow implicit conversion from QStringList to QFont. Address API review comment. Pick-to: 6.1 Change-Id: I73eb3a49182865e050965e97d459463e73bcddfd Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Doc: Fix documentation warnings qtbaseNico Vertriest2021-02-181-4/+4
| | | | | | Task-number: QTBUG-90662 Change-Id: If31847f8f2b8b57a8a8624d0406a030b5752f1c8 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Use newlines more consistently in generate compile-test codeEdward Welbourne2021-02-152-48/+28
| | | | | | | | | | | The generated code contained many repeated blank lines. Most main()s were preceded by one, but not all. Only include blank lines for actual empty entries in lists, where configure.json specified them, plus one before main if anything else precedes it. Change-Id: I6e6c34940e08712a1aa848a3c9ad1b0fb5806d77 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Simplify test-snippets in configure.cmakeEdward Welbourne2021-02-152-64/+32
| | | | | | | | | The main(void) signature obviates the need for unused parameters and has existed since (at least) C89; so use that instead of the old-fashioned argc/argv arguments we don't use in any of these tests. Change-Id: Ibfe850a1fce378673c9781011475ea623fd75ad4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QRectF/Documentation: Fix malformed tableFriedemann Kleint2021-02-151-1/+1
| | | | | | | | The colspan should be 2. Manifests as error in the Qt for Python documentation. Pick-to: 6.0 5.15 Change-Id: Idec8a2b62a3495e00b7f2b31e8ed9d04b551f22e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* MinGW: fix warning in QMatrix4x4::map functionsMårten Nordheim2021-02-151-5/+5
| | | | | | | | | | | | | | | | The definitions get the following warning (treated as error): redeclared without dllimport attribute after being referenced with dll linkage [-Werror] I take it to mean that because they are labelled 'inline' the compiler disregards the 'dllimport', but that makes it inconsistent with the declaration. So we label the declaration inline as well. Pick-to: 6.1 6.0 5.15 Change-Id: I87bb42141a1086b2c565db881077f33acb4aab64 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Extend colorspace testing and fix bug it uncoveredAllan Sandfeld Jensen2021-02-132-1/+3
| | | | | | | | | | When changing transferfunction the look-up-tables needs to be regenerated. Pick-to: 6.1 6.0 5.15 Change-Id: I83ca5fe570f85d478a374f52c0a82db84e70c3b8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix Wacom Art Pen detection on xcbShawn Rutledge2021-02-122-3/+8
| | | | | | Fixes: QTBUG-91102 Change-Id: I6cd7af26153457609c1fa8fb0a9e167939d592fc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix QImage::fill with semi-transparent QColorAllan Sandfeld Jensen2021-02-121-11/+10
| | | | | | | | | A few formats were not treating the input QColor correctly. Fixed and added more exhaustive test. Pick-to: 6.1 6.0 5.15 Change-Id: I872aeeb45e518f9a34b4ac35642264821f9927f2 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Revert "Remove the qmake project files" for snippetsNico Vertriest2021-02-121-0/+3
| | | | | | | | | | | This reverts a limited part of commit ad2da2d27a590333fc89a56fc58700a09c3017b3 that deleted .pro files for snippets compilation. Some .pro files which contain snippets used in the documentation itself should be restored. Task-number: QTBUG-90483 Change-Id: I1b03833c8ff17b5fca43a5b6c5417e8545b1711b Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QMatrix4x4: deprecate operator*(QVector3D, QMatrix4x4)Giuseppe D'Angelo2021-02-112-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The operation is sketchy for a number of reasons: 1) Mathematically, it doesn't make sense. The code interprets the QVector3D as a point, extending it with w=1, and uses it as a row vector. But similarly, the vector could be intepreted as a directional vector, with w=0. No semantic is "better" than the other. 2) QMatrix4x4 is not meant to be post-multiplied. Granted, one could use a QMatrix4x4 as arbitrary storage for 16 floats, but QMatrix4x4 builds itself to be always *pre* multiplied (e.g. translate changes the 4th column, not the 4th row). We can keep post multiplication for the general case if we do it against a QVector4D, but I don't feel that we should support it also for QVector3D. [ChangeLog][QtGui][QMatrix4x4] The multiplication operator (operator*) between a QVector3D and a QMatrix4x4 has been deprecated. User code needs to extend the QVector3D to a QVector4D first (by specifying the intended w coordinate), and then multiply the QVector4D by the matrix. Pick-to: 6.1 Change-Id: I41b64d8ab7eb6126dc4c49fe29cf3f1b7afc7987 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix mingw compiler warningsMårten Nordheim2021-02-113-32/+22
| | | | | | | | Mark overridden functions with override. Remove unused static function. Change-Id: I06bd52c66ac7b970dfced0e553eac9c4a4d44d79 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QMatrix4x4: deprecate operator*(QMatrix4x4, QVector3D/QPoint(F))Giuseppe D'Angelo2021-02-112-3/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | The operation does not make sense at the "fundamental" level for these classes (algebraic, in this case), so it shouldn't exist. It's also a semantic trap: * it interprets a _vector_ as a _point_ instead (the vector gets 1-extended in 4D) * after the multiplication, it gets perspective divided. These semantics do not belong to operator*. operator*(QVector3D/QPoint(F), QMatrix) will be tackled in a next commit; we don't have a straightforward replacement for it. Drive-by, document that map() interprets vectors as points. [ChangeLog][QtGui][QMatrix4x4] operator* between a QMatrix4x4 and a QVector3D, QPoint, or QPointF has been deprecated in favor of map() and mapVector(). Pick-to: 6.1 Task-number: QTBUG-89708 Change-Id: Iad78d6eb68cc8cdc3ac16b1635c4d3b522c95213 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Filter cosmetic lines using transformed, not world coordinatesEirik Aavitsland2021-02-101-4/+4
| | | | | | | | | Lines smaller than 1e-12 would not be drawn even when scaled up. Pick-to: 6.1 6.0 5.15 Fixes: QTBUG-75630 Change-Id: I8f261876c325b60f61e95ca2e5fde2cb227d4cba Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QTextureFileData: support key value metadataJonas Karlsson2021-02-094-3/+56
| | | | | | | Task-Id: QTBUG-76970 Pick-to: 6.1 Change-Id: I9dba1b373250cea4d0c806997290a7afcdc900d7 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Canonical pointer usageHou Lei2021-02-091-6/+6
| | | | | | | | Other affected rows have also been fixed. Change-Id: Ie0a32f724bd2e40e7bfacfaa43a78190b58e4a21 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Long live VK_KHR_display platform plugin!Laszlo Agocs2021-02-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Experiment with this once again, this time in a more forward looking manner: move the code previously placed into eglfs's eglfs_viv backend into its own plugin. Move our attention to devices like the Raspberry Pi 4, where VK_KHR_display has recently been introduced to the Mesa v3dv backend. This is not in Mesa 20.3.3, the latest release at the time of writing, but is available and functional when building master. This serves as the reference system for testing the plugin, because it looks like a fairly robust implementation. The sole thing the plugin enables at the moment is creating a QVulkanInstance and a QWindow with surfaceType VulkanSurface. This is sufficient to run plain QWindow+QRhi (with QRhi::Vulkan), Qt Quick, and Qt Quick 3D (with QSG_RHI_BACKEND=vulkan) applications. One display and mode is chosen, by default the first in the enumeration lists reported by the Vulkan extension. This can be overridden with QT_VK_DISPLAY_INDEX and QT_VK_MODE_INDEX (modeled after QT_VK_PHYSICAL_DEVICE_INDEX). The indices can be determined based on the logs printed to the debug output. Changing the mode seems to be working nicely with v3dv. Multiple screen setups, where there would be more than one VkDisplayKHR enumerated, have not been tested yet. Regardless, multiple screens (reporting more than one QScreen, with a different QWindow on each, eglfs style) are not currently supported. This may be improved later (while keeping in mind that VK_KHR_display does not have a fully-featured output management API). Multiple (non-fullscreen) windows and especially raster windows (QWidget) are not and will not be supported. Our single QWindow is always forced to fullscreen. When it comes to input, the level of support should match linuxfb and eglfs. Note that while mouse input is fully functional, there is no mouse cursor. (and this is unlikely to be implemented) [ChangeLog][Platform Specific Changes][Embedded Linux] Introduced a vkkhrdisplay platform plugin to run Vulkan-based applications in fullscreen, without a windowing system, on systems where VK_KHR_display and VK_KHR_display_swapchain are supported by the Vulkan implementation. Change-Id: I6388416f7fb2bfdc4b412a0a4971f25cc05d4668 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* egl: Add debug option to print all EGLConfigsLaszlo Agocs2021-02-081-0/+15
| | | | | | | | | QT_QPA_EGLFS_DEBUG=1 prints the attributes for the chosen EGLContext. Make QT_QPA_EGLFS_DEBUG=2 print the same for all EGLContexts. Pick-to: 6.1 Change-Id: Id161d04789fbd015e29e5a5a89a0901000096ea3 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Handle macOS 11 issues in softHyphens testAllan Sandfeld Jensen2021-02-081-2/+8
| | | | | | | | | | Calculate the effective width of the hyphen better, and compare with ceiled sizes. Pick-to: 6.1 6.0 Fixes: QTBUG-90698 Change-Id: I7ed2eb44c54240ecb2f8a38e5acf1f32608b2bfb Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Avoid C-style casts when possibleHou Lei2021-02-071-16/+16
| | | | | | | Other affected rows have also been fixed. Change-Id: I1d2c28eb37a9d259d3132156163d4135894c18c3 Reviewed-by: David Faure <david.faure@kdab.com>
* Clean up documentation in QVector[234]DEdward Welbourne2021-02-051-30/+50
| | | | | Change-Id: I13f04c06280b998e5489eb114977ec0ed37178b7 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix crash when requesting A32 glyph on WaylandEskil Abrahamsen Blomfeldt2021-02-051-1/+5
| | | | | | | | | | | | | | | | | | | | | | | On Wayland we aren't getting any information about the subpixel layout of the screen. On Freetype, this triggers an assert / memory corruption when explicitly requesting a subpixel antialiased glyph (via QRawFont) because it needs to know the layout to render the glyphs. It might be possible to get this information in the Wayland plugin, but at least we should have a failsafe which doesn't crash when the problem occurs. This simply falls back to using A8 antialiasing when it doesn't know the subpixel layout. [ChangeLog][Freetype] Fixed crash when calling QRawFont::alphaMapForGlyph() with subpixel antialiasing on Wayland. Fixes: QTBUG-90236 Pick-to: 6.0 Pick-to: 6.1 Pick-to: 5.15 Change-Id: Iddee2e171a81664ae9e3989115881f23262b2182 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* macOS: Don't assume NSEvent charactersByApplyingModifiers: produces characterTor Arne Vestbø2021-02-051-2/+5
| | | | | | | | | | In cases where the keyboard layout doesn't have a mapping for a given event and modifier combination the result will be an empty string. Fixes: QTBUG-90683 Pick-to: 6.0 Change-Id: Ice06241f0ae71a19cde041410818decc312bc630 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* macOS: Don't wrap key event keys in QCharTor Arne Vestbø2021-02-052-13/+17
| | | | | | | | | | | | | | | | | | | | | | | Key events have a wider range of possible values than the unicode range, as they also include all the special keys as defined in Qt::Keys. Instead of turning the argument to keyMapForKey into an integer, we can remove the argument completely, as it was only used as a fallback in the cases where UCKeyTranslate (or in the future, charactersByApplyingModifiers:), failed to map the virtual key and modifiers to a character. But in those cases we should not fall back to the Qt key from the key event, as that doesn't match what the keyboard layout defines. Most keyboard layouts explicitly define the base key as the key for these "undefined" mappings, but if the keyboard layout does not, we should not produce any input in the application, to match what AppKit does in this case. Fixes: QTBUG-90315 Pick-to: 6.0 Change-Id: Ib9ffd9521049ee8e4b103597c1d34cbe3d23dbdf Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* rhi: metal: Present drawables via addScheduledHandler instead of presentDrawableTor Arne Vestbø2021-02-051-3/+7
| | | | | | | | | | | | | | The former API is the recommended way to present drawables -- avoiding WindowServer submission throttling and potential issues with lock-ups when window are not serviced, are being moved to other screens, or users mistakenly call waitUntilCompleted. The scheduled block captures the drawable and retains it until the block is done executing. Change-Id: I99dca2db3bcfbea67c686dd5d97ba5011598997e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: metal: Manually manage drawable lifetimeTor Arne Vestbø2021-02-051-3/+8
| | | | | | | | | | | | | | | | | | | The drawable returned from nextDrawable is autoreleased, which means unless we explicitly retain it we have no guarantee that it will stay alive long enough to be used again in endFrame(). For example, if the user had an autorelease-pool in their custom render code, where the call to beginPass() happens, the drawable would be released when that pool went out of scope. The only reason we didn't hit this yet is due to the default autorelease-pool being at the level of the runloop, so the drawable happened to outlive the rendering of a single frame. An advantage of manually managing the lifetime of the drawable is also that we can release it immediately after being done with it, instead of waiting until the autorelease-pool drains. Change-Id: Ie6fd271adbe1121eb947bb7075142f1a6c81175d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* QStandardItem(Model): refactor multiData supportGiuseppe D'Angelo2021-02-051-24/+23
| | | | | | | | | | | | | | | QSI(M) allow users to override their data() functions. This means that we can't have their data() implemented in terms of multiData(), or otherwise a subclass that overrides data() will fall out of sync with its multiData() implementation. We must keep multiData() implemented in terms of data() instead. While at it, document QSI::multiData(). Pick-to: 6.0 6.1 Task-number: QTBUG-89423 Change-Id: If30a980d8449135b516745fec73170d53367b4b7 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Make explicit that we expect co-ordinates to be finiteEdward Welbourne2021-02-042-52/+111
| | | | | | | | | | | | | | | | | | | The various spatial-vector, line, point, region and margin types have all long taken for granted that their co-ordinates are finite and, in particular, not NaN. Make this expectation explicit in the documentation. Added assertions where (chiefly) noexcept and (where the assertion would be a simple qIsFinite() call) constexpr didn't preclude doing so. Also assert against zero divisors that would lead to non-finite results. Make minor clean-ups to docs in the process. QMarginsF had several methods whose declaration, definition and docs weren't consistent in their parameter names. Task-number: QTBUG-89010 Change-Id: I601a830959d13a73dcb17ce31a1202a1486c8f7f Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Rationalize QVector[234]D's length-handlingEdward Welbourne2021-02-041-87/+28
| | | | | | | | Use qHypot() instead of casting to and from double so much, use qFuzzyCompare(_, 1.0f) rather than qFuzzyIsNull(_ - 1.0f). Change-Id: I70f38fe2d9aefe1ceb15e1a370f181a7856911b7 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Rationalize QQuaternion's length-scaling codeEdward Welbourne2021-02-041-56/+40
| | | | | | | | | | | | | | | | | | | | | Use qHypot() to implement length(), avoid duplicating its code and use its result more carefully, saving the need for casting to and from double. Subtracting a double from 1.0f still got a double, so the qFuzzyIsNull() checks were using double's tolerance, where the use of 1.0f indicates the float tolerance would have been more apt. Also, use qFuzzyCompare(_, 1.0f) instead of qFuzzyIsNull(_ - 1.0f). In getEulerAngles(), scale co-ordinates by length before multiplying (to ensure O(1) quantities) rather than scaling the products by the squared length (possibly after {ov,und}erflowing). Change-Id: Id8792d6eb047ee9567a9bbb246657b0217b0849f Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>