summaryrefslogtreecommitdiffstats
path: root/src/gui
Commit message (Collapse)AuthorAgeFilesLines
* Fix alpha handling of QImage::setPixelv6.0.3Allan Sandfeld Jensen2021-03-232-7/+26
| | | | | | | | | | It was treated differently depending on format, made it consistently behave the same for all formats (following the behavior of the primary formats). Change-Id: Ie24e19957d076fdf3ebd333074e26ede187489eb Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit c32cd44d34910cfd42e32537578e4a573138a282)
* Avoid int overflow in QImage rotate90/180/270Eirik Aavitsland2021-03-191-21/+21
| | | | | | | | Fixes: QTBUG-91223 Change-Id: Ice53c80d695a5ffdf9162df84e7c9b1e43106bae Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 8daa94431341afece6beb052e6224d215f8507b7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* rhi: metal: Stop using BufferOp for no good reasonLaszlo Agocs2021-03-151-6/+8
| | | | | | | | | | | | Do what the Vulkan backend does, and just take the offset and the QRhiBufferData. There is no reason to store a full QRhiResourceUpdateBatchPrivate::BufferOp struct within the backend. Change-Id: I67528029de40320b3e4f031346d40dfc0bb9ab52 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit adf6ba7eaeba97fb2561394e52ee265d94e1c6e0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* rhi: metal: Skip unnecessary writes when updating the entire bufferLaszlo Agocs2021-03-151-1/+4
| | | | | | | | | | | | Follow the similar Vulkan change in 20eb40bce92c3e5460cd2540547f3c404fe6dccc and drop the queued up buffer data for a given slot when the current update covers the entire buffer. This is relevant in particular for Qt Quick 3D where such dynamic buffer changes are common. Change-Id: If1e70d78968586b552a5357bc97af10cc61d9611 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 0c6375a346551dbf2effb2ea54e1df7de56f0849) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Support family names that end/start with spaceEskil Abrahamsen Blomfeldt2021-03-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | If the family name starts or ends with a space in the actual font data, then this would not be selectable by Qt. This is because we trim the family name before matching it against the contents of the database. Testing on Windows GDI, it actually does trim the spaces on the family names (matching a request for "Chibola" with a font called "Chibola " for instance), but since we read the font data ourselves, we are not doing this. To ensure we never have font names that cannot be matched in the database, we make sure we trim the family names before registering them. [ChangeLog][QtGui][Text] Fixed matching against fonts which has a family name that ends or starts with a space. Task-number: QTBUG-79140 Change-Id: I9cdb50b78a7da2d2697f992ce462033eb1d7ada7 Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 7fd9ed32012bd9001e78ad692a4802e0e3366e44) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid undefined color values in corrupt xpm imageEirik Aavitsland2021-03-121-1/+1
| | | | | | | | | Issue reported by Codechecker. Change-Id: I1a5aa2203fb31e0ce3b630a11e450925aee81fb0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit f651e6a26cb59f7b7c7671cded8a10b9f98f5c71) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Change section titles that cause bad linksPaul Wicking2021-03-121-6/+6
| | | | | | | | | | | | Section titles are valid targets for QDoc's autolinker. When they are identical to other valid link targets, such as for example a class, these sections may cause invalid links. Fixes: QTBUG-91141 Change-Id: Ie9a6258d2bf83932335976d8c0b5fc59f2028ae5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 5fa8f5df7bb722c5b7451229f5eecd13bd13326f) Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* rhi: metal: Avoid unused argument warning on iOSLaszlo Agocs2021-03-101-0/+3
| | | | | | | Change-Id: I4cb729f3d8dbe7703b89153b742ce2874f35cfd2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit dd7087342dc73ee7adf7b24fc96f79d9d1056682) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* rhi: metal: Use the layer as the single source of truthLaszlo Agocs2021-03-101-8/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...when it comes to the output size. This mirrors what all other backends do. For example, with Vulkan the only source of size is the surface (VkSurfaceKHR), never the QWindow, even though we'd expect that the surface size equals to window_size * dpr, and that's almost always true, but there are exceptions. (e.g. we have seen bugs on Windows with some drivers in high DPI situations where the Vulkan surface did not fully match the window size, yet it is the surface, and only the surface, that matters for rendering, i.e. viewports and such must match the surface, not the native window) With Metal we hit a similar problem on iOS: the QWindow's size*dpr and what we calculate from the CAMetalLayer have a height difference of 1. Mitigate this by making QRhiSwapChain::surfacePixelSize() and the calculation for currentPixelSize() done via the same route (the CAMetalLayer). Otherwise, if there is a mismatch between what the QWindow and the layer says, Qt Quick will think that there is a resize happening (has happened) whenever starting a new frame, and that has far reaching consequences (suboptimal performance, increased memory usage by buffers, etc.) Change-Id: I114df92bf35622c99f2747420fdce401db7705a6 Fixes: QTBUG-91438 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 83fb8fe208ec816df7d04c8247d5696d95f2cab1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* rhi: gl: Fix missing uniform data with certain command listsLaszlo Agocs2021-03-092-1/+33
| | | | | | | | | | | | | | | Following patterns from the other backends is insufficient with OpenGL because we do not use real uniform buffers. There is currently a possibility that a shader program will be bound without following it with setting uniforms. Correct this by having a second level of tracking of the associated srb object in the pipelines. Fixes: QTBUG-91630 Change-Id: I74a012daade826dd22c436bde06381c1233bad11 Reviewed-by: Andy Nichols <andy.nichols@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 80029e0ca65d4bf4575f7a08d186c781ec6c2f0e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Use correct include for QWGLContextPaul Wicking2021-03-071-1/+1
| | | | | | | | Task-number: QTBUG-91500 Change-Id: If487a2d14dd61d127dc35aa039f9b71915128da1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 15f934dcea2743ceb59d3c9ad840e2b00b39d043) Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Specify correct include for QWGLContextPaul Wicking2021-03-041-0/+1
| | | | | | | | Fixes: QTBUG-91500 Change-Id: Ie842c9e911fe5492cc13aeba459d28d6553438fd Reviewed-by: Topi Reiniö <topi.reinio@qt.io> (cherry picked from commit afde5faf856078d34542da1d4d4db8a0237bfc67) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix out-of-buffer in ICC curv parsingAllan Sandfeld Jensen2021-03-041-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. Change-Id: Ibea9fa2840c01d690716d8f48e301fbfa67aa163 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 840c8b4de2556c22d8b131573a338268dd0107a5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix logic problems with table based grayscale ICC profilesAllan Sandfeld Jensen2021-03-032-5/+5
| | | | | | | | | White-point was calculated wrongly and some tables could cause bad behavior in the tables. Change-Id: I24e8f5f3cc1306f5f898a4acbf7b008e26bd04e2 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit f493d41722fc76a04f699ea26128fdf3d215d913)
* Limit value in setFontSizeFromValue()Robert Löhning2021-03-021-2/+2
| | | | | | | | | | | | | Avoids overflows in QFreetypeFace::computeSize and QFontEngineBox::boundingBox Fixes oss-fuzz issue 30290 Change-Id: If8e9ff74bf706a701e26832ad21b3439a3b437f7 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 976fede67ca4a4d322bc8d2c00266a2e2f1a6e3d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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. Fixes: QTBUG-91401 Change-Id: Ia97438f08de5e0383e77631dca9b253b47ef8167 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 63152571844a15adfa76db5f8a9e7a505da75412) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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. Change-Id: I4728b4036affedfffce8bca5c1e7be3869344fbe Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit c2bec047e281d949015ecd27daf2ba2d51b21526) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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. Fixes: QTBUG-91161 Change-Id: Iddf31b7abfd0a1bada3b051ed4de3bf6c2897d8e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit dec429e0778493bc4e85d6b18202804d0bbbe5f1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Extend colorspace testing and fix bug it uncoveredAllan Sandfeld Jensen2021-02-162-1/+2
| | | | | | | | | | | When changing transferfunction the look-up-tables needs to be regenerated. Change-Id: I83ca5fe570f85d478a374f52c0a82db84e70c3b8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit b2631c72c0628e68c0fae7567fd12e6646455efc) Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QRectF/Documentation: Fix malformed tableFriedemann Kleint2021-02-161-1/+1
| | | | | | | | | The colspan should be 2. Manifests as error in the Qt for Python documentation. Change-Id: Idec8a2b62a3495e00b7f2b31e8ed9d04b551f22e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 5de72ac9150e4c6a6b5bc52f49fd2a891c4eb20c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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. Change-Id: I87bb42141a1086b2c565db881077f33acb4aab64 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 10aa4b5c61b0073a76ff22946f1682f021cbd34b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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. Change-Id: I872aeeb45e518f9a34b4ac35642264821f9927f2 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 95712c5e5438e4eb5cd205ab4659febf3192137a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid overflow in text layoutEirik Aavitsland2021-02-111-0/+4
| | | | | | | | | | Fixes oss-fuzz issue 29313. Change-Id: Idbabd162fa9e0dbce687981bdbcc75be37189a61 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Robert Löhning <robert.loehning@qt.io> (cherry picked from commit bfc09b8d8fa6c1a397aff458c644ed424754adf0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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. Fixes: QTBUG-75630 Change-Id: I8f261876c325b60f61e95ca2e5fde2cb227d4cba Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 1549dff04c49aa37333e54f8bc45900d0f35b270) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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. Fixes: QTBUG-90698 Change-Id: I7ed2eb44c54240ecb2f8a38e5acf1f32608b2bfb Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 0ffdbb21261eee3a9ec1cd541478ee883a12065c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 Change-Id: Iddee2e171a81664ae9e3989115881f23262b2182 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit ef763e195892a6d8ce207f5d947fe508f645cb6d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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(). Task-number: QTBUG-89423 Change-Id: If30a980d8449135b516745fec73170d53367b4b7 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> (cherry picked from commit a1e9817cec5e0dccf26040d0b0d24e974841d5b8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove false Q_UNREACHABLE from shaping codeEskil Abrahamsen Blomfeldt2021-02-041-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was added by 9ff76c27b9031ae7c49c4c9e8b5a3bea1e0e3c78 on the basis that it signifies a shaping error and would later assert or crash. But the line is easily reachable by user code. If Harfbuzz returns 0 glyphs, it just means it is unable to shape the string, for instance if the input string only contains default ignorables (like a ZWJ) and does not have any appropriate glyph to use for replacement. Qt expects there to always be at least one glyph in the output (num_glyphs == 0 is used to indicate shaping is not yet done), so to avoid asserts later on, we simply populate the output with a single 0 token, which is a required entry in the font that is reserved for representing unrepresentable characters. This also adds a test and therefore a zero-width joiner to the test font to reproduce the issue. [ChangeLog][QtGui][Text] Fixed a possible crash with certain fonts when shaping strings consisting only of control characters. Fixes: QTBUG-89155 Change-Id: Ia0dd6a04844c9be90dcab6c464bebe339a3dab11 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> (cherry picked from commit fccd419dd632306a4bd85928223e0a56a59510ef) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid int overflow in gradient drawingEirik Aavitsland2021-02-011-3/+6
| | | | | | | | | | Fixes oss-fuzz 29348 Change-Id: I3568a0a7a7e8d87881f5b052c6c00831b53b3842 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Robert Löhning <robert.loehning@qt.io> (cherry picked from commit 93243b5d6a6726087aeec387366ca699cad4e31c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QIcon: Use the @nx pixmaps in the paint methodBastien Bouclet2021-01-291-1/+1
| | | | | | | | | | | | Make use of the device pixel ratio in the QIcon paint method so the @nx hi-dpi pixmaps are selected when appropriate when painting to a QPainter. Fixes: QTBUG-90042 Change-Id: I53995a2285ef879e3c4fddb9f8da702e256a260f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit b69b04c4790f319104a1098147cea9405b6e7062) Reviewed-by: Bastien Bouclet <bastien.bouclet@gmail.com>
* Don't forward-declare non-Qt things with QT_FORWARD_DECLARE_*Mårten Nordheim2021-01-271-1/+1
| | | | | | | | As it breaks in namespace builds Change-Id: I1a278330eeea6b2b89c8a57c0df828dff94ebf7a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 6cd5448404048ffd7194a1f78991e50be3535e07)
* Fix division by zerov6.0.1Allan Sandfeld Jensen2021-01-271-0/+4
| | | | | | | | | | | Consider a zero we need to divide with illegal input. Fixes oss-fuzz 29347 Change-Id: I2aae1d765d2dd81c95d423038ef5cb878d4f8026 Reviewed-by: Robert Löhning <robert.loehning@qt.io> (cherry picked from commit 16b8d766abe86868597b30cec03152355ee1a91b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Protect against sign-change of size on 32bitAllan Sandfeld Jensen2021-01-271-1/+1
| | | | | | | | | | | | | Since qsizetype is signed and the profileSize unsigned, it can turn negative circumventing the test here. Fixes oss-fuzz issue 29278. Change-Id: I1e211c78db6f4ff150613f52d8fc29807f0088ff Reviewed-by: Robert Löhning <robert.loehning@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 05741b404ad5a8f9a490191a347e67c61456a89c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Gracefully reject requests for absurd font sizesEirik Aavitsland2021-01-221-0/+6
| | | | | | | | | | Avoid overflows. Fixes: QTBUG-89899 Change-Id: Ic1a83c1704fe20be3d032358dc91ee8e751f2281 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 679750684087cad7a48921c4174a53cdf4855049) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Rasterizer: compute intersection factors only when neededEirik Aavitsland2021-01-201-7/+12
| | | | | | | | | | Fixes oss-fuzz issue 29285 Change-Id: I8f7e0bc898b119d153a36cef5a74371249ed7686 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Robert Loehning <robert.loehning@qt.io> (cherry picked from commit e1ed570f9d0ec3998f130e2c3870ef49e7994dbf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix XCB launch key mappingAllan Sandfeld Jensen2021-01-161-18/+17
| | | | | | | | | | | | | | They have been reported wrong since Qt 4, and not fixed for behavior compatibility, fixing it for Qt 6. [ChangeLog][X11] XF86LaunchXX keys have been remapped, so the Qt names and X11 names match, instead of being 2 off. Fixes: QTBUG-25261 Change-Id: Ie3a8676439ae3e93a78218c9e7f4443565e84356 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io> (cherry picked from commit cfd935fe6c26800befc10889afc0aebde311acca) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix convertToRGBA64PM for Grayscale16Allan Sandfeld Jensen2021-01-151-2/+1
| | | | | | | | | | | The input has been fetch into a set of uint32s, so no longer a string of ushorts. Fixes: QTBUG-90246 Change-Id: Id52a6824317b0744310008cc2ce2f726539b4c8c Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit ade24763c74ce506276218ec1ce0e307301717fe) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* AA_SynthesizeTouchForUnhandledMouseEvents: keep correct coordinatesShawn Rutledge2021-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | QGuiApplicationPrivate::processMouseEvent() sends a QWindowSystemInterfacePrivate::TouchEvent if the mouse event is not accepted and AA_SynthesizeTouchForUnhandledMouseEvents is enabled. A QPA TouchEvent always contains native touch points, which is why it calls QWindowSystemInterfacePrivate::fromNativeTouchPoints to translate the QMouseEvent's device-independent position back to the raw position that it would have had if it came from a real touchscreen. Therefore we must give that function touchpoints that are actually in native coordinates. It may be that some of this transformation could be avoided entirely, but here we prove that the existing way works correctly, by adding coordinate checking to the tst_QWindow::mouseToTouchTranslation() test. Task-number: QTBUG-86165 Change-Id: I4c9ca2b11e9eb76d79712c187db3eb9865da581a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit aeeac48cbdea744406f0c8abefe271f571b61d07) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QGuiApplication: use global position to create local position for synthetic ↵Richard Moe Gustavsen2021-01-141-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | mouse events When QWidgetWindow handles a QTouchEvent, it will call updateTouchPointsForWidget() for each widget it tries to deliver the touch event to. This will make sure that the point's position() is updated to be local to the widget being processed. The problem is that we never reset this overwriting of local positions in the event after we're done. So if we later try to synthesize a mouse event from it, the local position in the fake mouse event will be based on the local position inside a random widget, and not the original local position sent from QPA. Rather than trying to store all the original local positions inside the event before going through this delivery logic, and reset it afterwards, we base the local position of the synthesized mouse event on the (unmodified) global position instead. Fixes: QTBUG-90033 Pick-to: dev Change-Id: I1588351482de7cce9c06d102db3686ea8dd0c118 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* a11y: Do not cache classes that don't have a factory pluginJan Arve Sæther2021-01-131-5/+4
| | | | | | | | | | | | | | | | | | | For Qt Widgets we thought it was a good idea to also store in the cache if a class didn't have a factory plugin. This worked fine there, since the number of QWidget classnames is quite limited (so the factory plugin cache will soon reach a limit) In QML however, classes are often suffixed with e.g. Button_QMLTYPE_123, Button_QMLTYPE_124 etc. This number suffix is just increased continuously. This could lead to that the factory plugin cache will grow ad infinitum, which will cause "memory leaks" in addition to a performance penalty. Fixes: QTBUG-75106 Change-Id: I9ba189f989f0b90ab62a2c54a2e9230236a998d8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 583668005d4d6399fc16d165dcb6a5af2b94323d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Windows font engine: Silence warnings about not being able to enumate font ↵Friedemann Kleint2021-01-131-2/+2
| | | | | | | | | | | | families Turn the warning into a qCDebug() statement and add explanatory comment. Fixes: QTBUG-85683 Change-Id: I2a6a7a089a660294f3e9c3096299c75635b3b215 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 29b2387587fe2ed2a73bdcbfa928acb755537284) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove QtDBus includesDavid Skoland2021-01-137-66/+79
| | | | | | | | | | | | | | Per the discussion of QTBUG-88831, we determined that module-wide imports are unfortunate, especially for compile times. Following this, all QtDBus includes have been replaced with the headers for the classes actually used in each file. Additionally, some cleanup of header file order and format has been performed in the changed files. Change-Id: I62c1b75682a48422f0ba1168dd5d7bd0952808ac Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 9e09677c1dd4da92735736a0fbcb703416bf4d6d)
* rhi: gl: Reset tracked state upon a buffer update or readbackLaszlo Agocs2021-01-131-33/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...encountered in the command list. Move all, previously local, tracking variables into a struct. This allows creating helper functions to reduce error-prone repetition in the executeCommandBuffer() function body. The only real change in the patch is in the handling of Command::BufferSubData and Command::GetBufferSubData: here, instead of calling glBindBuffer directly, use a helper function that also resets the relevant state tracking variables. A subsequent Command::BindVertexBuffer or BindIndexBuffer will therefore correctly rebind the appropriate buffers. This is particularly relevant with certain command stream patterns exercised by some Qt Quick 3D scenes: - A View3D renders a mesh, - another View3D has some 2D Qt Quick content, as well as a model with the same mesh. When both View3Ds use the default Offscreen render mode, the resulting command list consists of segments along the lines of: 1. prepare resources for first View3D 2. render content for first View3D - this binds the vertex and index buffers for the mesh (state is tracked; all 1-4 steps are within the same command list, processed by a single call to executeCommandBuffer()) 3. prepare the content for the "inline" 2D Qt Quick scene - this may update vertex and index buffers, that may lead to adding BufferSubData commands to the list (tracked state (last vertex/index buffer) may need invalidation/updating - and that's where our problem lies) 4. the second View3Ds 3D content is rendered: a model with the same mesh as the last (Quick)3D draw call, so same vertex and index buffers. If #3 did not invalidate and/or update the tracked state, the glBindBuffer calls are (incorrectly) skipped. Fixes: QTBUG-89780 Change-Id: Icc933252f3993b8727d192e7ba4aa0f842bab51e Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 5f8efb259774040303f37d00b6307afd22857af2) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Doc: Add details to QFont::toStringPaul Wicking2021-01-121-1/+20
| | | | | | | | | | Add details that explain the return value. Fixes: QTBUG-81467 Change-Id: Ifad407a27259711fc9abe1bacc7ba9db105bdcc0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 8c395a20eddc15ae923b7658f275fa87c8d33db9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use design metrics when adding text to QPainterPathEskil Abrahamsen Blomfeldt2021-01-121-0/+5
| | | | | | | | | | | | | | | | | | | | | When we add text to QPainterPath, we will add the design metrics (unhinted glyphs) and scale these down to match the target font size. But the glyph positions we pass in are based on the hinted metrics, samples at the target font size. Thus, on fonts/systems with hinting, these do not match the scaled design metrics outlines. To fix this issue, we make sure the text layout uses design metrics when determining the glyph positions. [ChangeLog][QtGui][Text] Fixed an issue where QPainterPath::addText() would get inconsistent kerning for smaller font sizes when hinting is enabled. Fixes: QTBUG-20900 Change-Id: I651997d1a6a86e6271557438afa2cdad078a83ca Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 6a3f8cbc3ad47d8585aac25d3775ed2350afe20c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Explain how boundingRect handles null QRectFPaul Wicking2021-01-111-1/+3
| | | | | | | | Fixes: QTBUG-87107 Change-Id: Ib7f9bd58b0f3454167dc61f95e0d8e6dec52a5ed Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 149ad1e615bf0974e52a681af73e9fb04bc1c762) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Link to correct locationPaul Wicking2021-01-111-4/+4
| | | | | | | | | | Reflow text to fit style while at it, to satisfy git clang-format. Fixes: QTBUG-89709 Change-Id: Iab2bf09399adf2cb0f0219ab40978bb238825ae8 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> (cherry picked from commit 713829b718e3842cec3266838d5692f754582de6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QPdfWriter: fix embedding fonts in pdf filesChristian Ehrlicher2021-01-091-1/+1
| | | | | | | | | | | | | The container size change from int32_t to int64_t created a subtle error during font serialization. The size of a QByteArray was serialized without a proper cast and therefore now 8 bytes instead 4 bytes were written to the stream. Fixes: QTBUG-89727 Change-Id: If9255a5a3124038356bc5053810f98c7c88f8a01 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 05706bd2b005dd159be34107cc43c92e7f12eb35) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Revert "Fix invalid text layout data when a full layout run is interrupted"Frederik Gladhorn2021-01-071-5/+2
| | | | | | | | | | | | | | | | This reverts commit 09ee4282e5eedf5b44245e8b28b223339f87ddfa. The commit made the layouting time go from linear to quadratic, which is problematic when rendering big documents impractical. I wrote an alternative fix for QTBUG-20354 which will come as separate change since it approaches the problem in a different way. Fixes: QTBUG-89599 Task-number: QTBUG-20354 Change-Id: Ie450332f06ee40e60c8e4c6c7d10834bff1acf74 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit a62fa9b7cc520f3548356182bf5d6642c05be204) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove superfluous OpenGL_GL_PREFERENCE assignmentJoerg Bornemann2021-01-061-2/+0
| | | | | | | | | | | | | | | We did set this variable, however after src/gui/configure.cmake was loaded (it is early-loaded in src/CMakeLists.txt), meaning the assignment had no effect. Also, what this assignment tried to achieve is covered by our global CMake policies now. Task-number: QTBUG-89754 Change-Id: Ie7aeee1505d112d799455b2915acbfa7e9a12a64 Reviewed-by: Cristian Adam <cristian.adam@qt.io> (cherry picked from commit 36b1e03ecdaac40aaae5fa42ee9a5b3b50991ea3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>