summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
Commit message (Collapse)AuthorAgeFilesLines
...
* QFileSystemMetaData: use QTRY_COMPARE*(10s)Ahmad Samir2024-02-091-2/+1
| | | | | | | | | | | | | After d4bb448cddce63e0c6a84a86020fa59dd32b2293 (thanks to Marc), now we can use chrono literals with QTRY_* macros. Amends 72f5b35b3d7704db6ef16e4c60751ed8444363be . (Cannot be backported to older branches because the QTRY* commit is only in the dev branch). Change-Id: Ic31d1ee717af604dd762afa44741cf9ea9b33a8e Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QtIcoHandler::canRead(): avoid checking more than onceShawn Rutledge2024-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QtIcoHandler::canRead() calls ICOReader::canRead(), which assumes that QIODevice::pos() is at the position where the .ico data starts (i.e. pos() == 0 if this is a separate .ico file). But if an AnimatedImage in Qt Quick opens an .ico file, canRead() gets called multiple times: the first is when QQuickAnimatedImage::frameCount() eventually results in QImageReaderPrivate::initHandler(); then ICOReader::readHeader() is called, which moves the file position. The second time is when QQuickAnimatedImage calls QMovie::isValid(). At that time, QIODevice::pos() == 6: we need to avoid calling ICOReader::canRead() because it's no longer at the start of the data. Without this change, AnimatedImage reports "Error Reading Animated Image File" and doesn't show anything. The fix is to store the known-good state, the same way that QTiffHandler::canRead() returns true if its d->tiff already exists (TIFFClientOpen() succeeded). The test checks that it's ok to call QMovie::frameCount() first and then QMovie::isValid(). Calling frameCount() has the effect of moving QIODevice::pos(). Pick-to: 6.5 6.6 6.7 Task-number: QTBUG-117429 Change-Id: Ie3a5225f2cea9a0d76d685e83ce4d4a10cbe9188 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Improve KTX file reading memory safetyJonas Karlsson2024-02-093-0/+14
| | | | | | | | | | | | | | | | | | | | * Use qAddOverflow/qSubOverflow methods for catching additions and subtractions with overflow and handle these scenarios when reading the file. * Add 'safeView' method that checks that the byte array view constructed is not out of bounds. * Return error if number of levels is higher than what is reasonable. * Return error if number of faces is incorrect. * Add unit test with invalid KTX file previously causing a segmentation fault. This fixes CVE-2024-25580. Fixes: QTBUG-121918 Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: Ie0824c32a5921de30cf07c1fc1b49a084e6d07b2 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove extra semi-colonsTasuku Suzuki2024-02-065-7/+7
| | | | | Change-Id: I92fddb36cd136fd1bd627955f15d0559b9942d7e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Change license for tests filesLucie Gérard2024-02-04115-115/+115
| | | | | | | | | | | | According to QUIP-18 [1], all tests file should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Fix frontMatter tests: fixed fonts and testdataShawn Rutledge2024-02-023-7/+12
| | | | | | | | | | | | | | | | When the main font is a fixed-width font, QTextMarkdownWriter generates backticks around plain text; so QEXPECT_FAIL if we detect that. tst_QTextMarkdownWriter::frontMatter() Compared values are not the same Actual (output) : "---\nfoo\n---\n`bar`\n\n" Expected ("---\nfoo\n---\nbar\n\n") Also, include all test data as resources for platforms that need it (such as Android). Task-number: QTBUG-103484 Change-Id: If18ca493c402b128cdc0fb1910b2e822512af6e8 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Extract and re-write "front matter" in markdown documentsShawn Rutledge2024-02-024-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It's increasingly common for YAML to be used as metadata in front of markdown documents. md4c does not handle this, so we need to remove it ahead of time, lest md4c misinterpret it as heading text or so. The --- fences are expected to be consistent regardless of the format of what's between them, and the yaml (or whatever) parser does not need to see them. So we remove them while reading, and QTextMarkdownWriter writes them around the front matter if there is any. If your application needs to parse this "front matter", just call qtd->metaInformation(QTextDocument::FrontMatter).toUtf8() and feed that to some parser that you've linked in, such as yaml-cpp. Since YAML is used with GitHub Docs, we consider this feature to be part of the GitHub dialect: https://docs.github.com/en/contributing/writing-for-github-docs/using-yaml-frontmatter [ChangeLog][QtGui][Text] Markdown "front matter" (usually YAML) is now extracted during parsing (GitHub dialect) and can be retrieved from QTextDocument::metaInformation(FrontMatter). QTextMarkdownWriter also writes front matter (if any) to the output. Fixes: QTBUG-120722 Change-Id: I220ddcd2b94c99453853643516ca7a36bb2bcd6f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Implement missing features in DirectWrite font backendEskil Abrahamsen Blomfeldt2024-02-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The DirectWrite font backend is an optional backend which is planned to take over as the default on Windows. In order to do this, though, a few gaps need to be filled in order for it to pass all autotests. The following things are covered by this: 1. Bitmap fonts are unsupported in DirectWrite. We enumerate these using GDI and fall back to the GDI font engine when loading them. As part of this, we introduce a new handle type for fonts on Windows which can represent both the DirectWrite and GDI engines. 2. "Legacy font names" where sub-family is embedded in the family name is now enumerated together with the typographic font name. 3. The DirectWrite font engine was not loading kerning pairs from the font, like the other engines (omission which was detected by the test) 4. Turning off antialiasing does not work with DirectWrite, so we fall back to GDI for this. 5. Loading supported writing systems from application fonts was not supported. Task-number: QTBUG-119420 Change-Id: Icf6c351afb0d7487b2f4634199088d701a324aae Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QMovie non-anim: use QImageReader::imageCount but not nextImageDelayShawn Rutledge2024-02-023-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 3f4d6279c4b0d04422efff478a5e2fb36259dbaa (khansen 2005) QMovie calls QImageReader::read() until QImageReader::canRead() returns false. That's apparently to support animated image formats in which the frame count is not known at the beginnning (i.e. not specified in the image format's metadata). But non-animated multi-frame formats are expected to return valid values from QImageReader::imageCount(); and those also tend to keep returning true from canRead() regardless of how many frames have been read (the interpretation of canRead() is "does the file have the expected format?" rather than "are we about to read too many frames?"). So, when a multi-frame image is abused as an animation, QMovie was able to keep reading the same frame repeatedly and pretend that the frame sequence goes on forever. It also tended to read frames as fast as they could be decoded, because nextImageDelay() is not usually provided, because multi-frame image formats don't specify a frame rate in their metadata. So now we change QMovie's behavior for image formats where QImageIOHandler::supportsOption(Animation) returns false: trust imageCount(), but not do not trust nextImageDelay(). But to actually jump to the next frame in this case, we also need to call QImageReader::jumpToNextImage(). Altogether, this makes QMovie support "flipbook" animation for multi-frame image formats, such as tiff and pdf. Added "read frame x of c" logging in qt.gui.imageio category. For testing, we use a pre-existing multi-frame Obj_N2_Internal_Mem.ico file, to avoid depending on the tiff plugin. [ChangeLog][QtGui][QMovie] QMovie now handles non-animated multi-frame image formats (such as tiff): QImageIOHandler::imageCount() is observed, and the default frame rate is 1 FPS. Pick-to: 6.5 6.6 6.7 Fixes: QTBUG-117429 Change-Id: I6dad2a684e12c78a68288402e223a59427bf649e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QFileSystemModel: don't crash with setIconProvider(nullptr)Ahmad Samir2024-02-011-0/+14
| | | | | | | | | | | | | | | | | | | | The method takes a pointer, so the code shouldn't crash when passed a nullptr. QFileInfoGatherer::getInfo() still needs to generate a descriptive string for the file, so we refactor QAbstractFileIconProvider::type() to put the implementation into a reusable static function QAbstractFileIconProviderPrivate::getFileType(const QFileInfo &info). This unfortunately involves constructing a QMimeDatabase on the fly, but the docs say that is fine. Drive-by change: use nullptr instead of `0` for pointers. Pick-to: 6.5 6.6 6.7 Fixes: QTBUG-99178 Change-Id: Ia32ea0a26701d593e74fbecced7be8d9e0aa0f52 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Stabilize tst_QFileSystemModel::showFilesOnly test caseVolker Hilsheimer2024-01-312-7/+8
| | | | | | | | | | | | | | | | | | | | | | Amends 83e5d74864a8780445db4b34e406afc53b331039. A model index returned by QFileSystemModel might become invalid when events get processed, so don't store the result of setRootPath to re-use it in a QTRY_COMPARE function. Instead, always ask for a fresh model index. Also, use std::chrono::duration::count correctly; it returns the "tick", not the corresponding milliseconds, so (10s).count() returns 10 instead of 10000. Explicitly use 10000ms here. Un-blacklist the test on macOS again. Task-number: QTBUG-74471 Pick-to: 6.7 6.6 6.5 Change-Id: Ic98bb53c696441131bbc1055b64822faf2aec96f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QFileSystemModel: blacklist a flaky unittest on macosAhmad Samir2024-01-301-0/+2
| | | | | | | Task-number: QTBUG-74471 Pick-to: 6.7 6.6 6.5 Change-Id: I4cda7794300c1a9d941e1543ee66b37efb0dea15 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QPainterPath: Fix boundingRect and controlPointRect ignoring start pointNoah Davis2024-01-301-0/+28
| | | | | | | | | | | | | | | | | | | | | | The boundingRect and controlPointRect did not use the start point from the `QPainterPath(const QPointF &startPoint)` constructor until the `dirtyBounds` or `dirtyControlBounds` member variables were set to true. Those two are false on construction. This bug was fixed by adding a new constructor for QPainterPathPrivate that initializes the `elements`, `bounds` and `controlBounds` member variables with the start point from the constructor. There is also an autotest to verify that the top left of the boundingRect and controlPointRect are at the same position as elementAt(0) when the start point constructor is used. [ChangeLog][QtGui][QPainterPath] boundingRect() and controlPointRect() now use the start point from QPainterPath(const QPointF &startPoint). Pick-to: 6.7 6.6 6.5 Change-Id: I7bf30364406c14ed60f75d24b78a9a5535f75d93 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix infinite loop in QTextLayout with setNumColumns()Eskil Abrahamsen Blomfeldt2024-01-291-7/+19
| | | | | | | | | | | | | | | | | | | | | | If the line width is negative, then we might exit the layout loop before consuming any text, and thus the loop will never finish. This is a side effect of a change for maximumWidth: 991c056438b311566bc4ea543af0f33dfd5dffbb. 49a63d375972079ae3000c8b7d512d58d4de32bb fixed this issue for QTextLayout::setFixedSize(), but I forgot to do the same in the overload of QTextLayout::setNumColumns() which includes an alignment width and therefore sets the line width in addition to the column count. Basically, we just make sure the line width is never negative so that the width > line.width condition also means the width > 0. Pick-to: 6.5 6.6 6.7 Fixes: QTBUG-115459 Change-Id: If904bfc64cd74e819a0864db55fa9555073d0781 Reviewed-by: Vladimir Belyavsky <belyavskyv@gmail.com> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* QFileSystemModel: respect dir filtersAhmad Samir2024-01-261-0/+34
| | | | | | | | | | | | | | | | | | | | | Given a dir A that has some files and a subdir B, when a model is set to only show files, setting the root path to A, the filters are initially respected. Setting the root path to B then back to A, the filters would be ignored and B would be visible in the model. Traversing the path elements in node() led to dir B getting added to the bypassFilters hash table, which made filtersAcceptNode() bypass the filters. I couldn't find a commit explaining the logic behind using bypassFilters (the trail goes cold at the 'Qt 4.5' mega commit). The only clue I found was the "// always accept drives" comment in the code, which hints at this being useful only on Windows(?). Fixes: QTBUG-74471 Pick-to: 6.7 6.6 6.5 Change-Id: Icb9055524a28990c591e924634a63e29a49835aa Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Avoid detection of heading in tst_QTextMarkdownImporter::thematicBreaksShawn Rutledge2024-01-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In md4c 0.4.8, three or more hyphens immediately after text were seen as a thematic break: some text --- But in 0.5.1 it makes the text into an H2 heading (even though this style of heading would normally have the text fully "underlined" with hyphens). The CommonMark spec 0.30 says If a line of dashes that meets the above conditions for being a thematic break could also be interpreted as the underline of a setext heading, the interpretation as a setext heading takes precedence. Thus, for example, this is a setext heading, not a paragraph followed by a thematic break: https://spec.commonmark.org/0.30/#example-59 So the new behavior seems more correct. But rather than testing so deeply, just disambiguate by adding a newline, since Qt may be expected to work with various versions of md4c, and such minor behavior differences are not expected to come up often in practice. QTextMarkdownWriter already adds a newline when writing such markdown. Pick-to: 6.2 6.5 6.6 6.6.2 6.7 Change-Id: I5a4bf8720d994616274eb8534b4d7085399130fc Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QTextImageHandler: Use QUrl::toLocalFile to convert to local file nameChristian Ehrlicher2024-01-211-1/+1
| | | | | | | | | | | Simply stripping away the first six characters does not work on Windows. Amends 2d87c4d881b74619fef966ffb0d7a00cb4ccea50 Pick-to: 6.7 6.6 6.5 6.2 Fixes: QTBUG-120577 Change-Id: If48ba026785cab784f46109e34ac80e39a990b79 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tests: skip tst_QGuiApplication::topLevelAt() on WaylandLiang Qi2024-01-171-0/+3
| | | | | | | | | This amends 189f9873ae3f23377708fbf9880398fd6a078715 . Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-121015 Change-Id: I66d2a2b0162b9c7b488af840ff5d3a881b657782 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Don't include windows.h in the public qopengl.h headerVolker Hilsheimer2024-01-161-0/+1
| | | | | | | | | | | | | | | | | | | | All we need are the APIENTRY and WINGDIAPI macros, as those are used in the gl.h header. Define those locally for the time we need them. Use a QT_APIENTRY macro instead of hijacking APIENTRY for when we declare OpenGL functions with the stdcall calling convention. A few build fixes needed in tests that used Windows types without explicitly including windows.h first, or that (incorrectly) included one of the sub-headers of windows.h (like winuser.h). [ChangeLog][Potentially Source-Incompatible Changes][OpenGL] On Windows, the public qopengl.h header no longer includes windows.h. Pick-to: 6.7 Fixes: QTBUG-120687 Change-Id: I3770ac8eaeee5bcf4e7234e5a2539935a8aa5a7d Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* rhi: Add an autotest for multiviewLaszlo Agocs2024-01-156-1/+210
| | | | | | | Fixes: QTBUG-119742 Change-Id: Id4dba72eadfac74e1dd9ef57d90774c6a8bf8bdd Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* tests: XFAIL tst_QShortcut::windowShortcut() on WaylandLiang Qi2024-01-101-0/+4
| | | | | | | Pick-to: 6.7 Task-number: QTBUG-120334 Change-Id: I6cafda6fa8f8c9b20a6695b982413057ddf56dd2 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tests: skip tst_QShortcut::applicationShortcut() on WaylandLiang Qi2024-01-102-0/+7
| | | | | | | Pick-to: 6.7 Task-number: QTBUG-120334 Change-Id: I0c71c6f474f1a0f31bc823579a54556a3e64bda2 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QRadialGradient: Fix undefined behaviorHatem ElKharashy2024-01-081-0/+16
| | | | | | | | | | | | The UBSan raises a division by zero in getRadialGradientValues. This can be avoided by calculating the inverse in qt_fetch_radial_gradient_template as a checker is done to avoid division by zero there. (Credit to OSS-Fuzz) Pick-to: 6.7 Fixes: QTBUG-120332 Change-Id: I798d1efc87ee07df7ca6f401aa476013cdbffe42 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Skip 'off-by-one' adjustment in block length during undo operationSanthosh Kumar2023-12-201-0/+57
| | | | | | | | | | | | | | | | | | | | | | The adjustment of block length with 'off-by-one' affects content length during undo operation. The issue occurs when we perform undo operation for a set of group blocks that have same fragment position. Since their positions are same, group block change (QTextDocumentPrivate::documentChange) with respect to insertion doesn't affect document block length and further adjustment to 'off-by-one' without considering this leads to incorrect document content change information (such as invalid information with regard to characters removed). This patch skips adjustment of group block length during undo operation. Amends 8fbedf2196a292fe2affcf83ddc846b9c852772a Fixes: QTBUG-113865 Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: I315dcf01ba5b2f4ed6d95e9d6910d82848374aef Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Replace uses of QWheelEvent with newly added QTest::wheelEventDoris Verria2023-12-201-7/+3
| | | | | Change-Id: I83fdc4cc3328fd178b054bef3113bf5df75d71cf Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Copy color table in QImage::transform paint pathAllan Sandfeld Jensen2023-12-141-0/+11
| | | | | | | | | A copy without pixel ratio was made, but color table not set. Pick-to: 6.7 6.6 6.5 6.2 Fixes: QTBUG-119902 Change-Id: I328f3faa70d7a1263061cbe51921999393e30801 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Silence -Wbraced-scalar-init warningAmir Masoud Abdol2023-12-131-6/+6
| | | | | | | There is no need for {}, and removing them resolves the warning. Change-Id: Id9812a9ba328f03839dd953662a82b05f99b0b8b Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* QIcon: prefer downscaling over upscaling pixmap iconsDavid Schulz2023-12-131-0/+18
| | | | | | | | | | ... instead of just choosing the closest scaling factor. Otherwise we end up with the 1x pixmap for a 1.25 scaling factor instead of a the better fitting 2x pixmap. Task-number: QTBUG-90634 Change-Id: Ic554fc8d2715deea43bc22e71414902a263b2fef Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Centralize conversion from unpremultiplied to premultiplied image formatAllan Sandfeld Jensen2023-12-121-0/+25
| | | | | | | Makes it possible to add new unpremultiplied formats later. Change-Id: Id998a2674ca9067a0e2a5f85c7baf04bcd9a9912 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* pagelayout: Fix inaccuracy in marginsPixels and paintRectPixelsJarkko Koivikko2023-12-091-0/+72
| | | | | | | | | | | | | | | | | | | Do not use rounded value for conversion, which gives inaccurate result. Example case: typical margin for A4 paper size is 8.4 pt. At 600 dpi, the old code was using rounded point value of 8, which produces an incorrect result: 8 / (72.0 / 600) = 67 pixels The correct margin is of course: 8.4 / (72.0 / 600) = 70 pixels Pick-to: 6.6 Change-Id: I44b2eeabb82fd3bf8e2dcfcba66ae96cde763875 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* pagesize: Fix pixel overflow in QPageSize::sizePixels and rectPixelsJarkko Koivikko2023-12-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | This update addresses an issue in converting page size from points to device pixels. Previously, rounding the result could lead to an overflow beyond the physical pixel capacity. Example case: A4 paper size at 600 dpi: - points to pixels: 842 pt / (72.0 / 600) = 7016.666666666667 However, the physical pixel height for an HP printer: - GetDeviceCaps(hdc, PHYSICALHEIGHT)) = 7016 This fix prevents pixel size from exceeding the physical print area, avoiding unprinted pixels. Pick-to: 6.6 Change-Id: I66eabc628d3374d9cfb19b0eb5928f83afbc13dc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Faure <david.faure@kdab.com>
* print: QPageLayout: Fix pt unit conversionJarkko Koivikko2023-12-091-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch corrects the miscalculation in point unit conversion, ensuring correct margin updates. Previously, non-pt units were rounded to two decimal places. When converting back to pt, rounding was to zero decimals, making the result always less than the original. This could result in margins falling below the minimum allowed. Example: original_points = 8.4 multiplier = 2.83464566929 mm: qRound(8.4 / multiplier * 100) / 100 = 2.96 new_points: qRound(2.96 * multiplier) = 8 // wrong! The fix rounds back-converted values up to two decimals, ensuring they are never less than the original and thus stay above minimum margins. new_points: qCeil(2.96 * multiplier * 100) / 100 = 8.4 Also, remove unused function qt_convertPoint. Pick-to: 6.6 Change-Id: I6109f8d381aec96db1ce04cc167f7b73c1c0b9a8 Reviewed-by: David Faure <david.faure@kdab.com>
* QFont::Tag: use new comparison helper macrosVolker Hilsheimer2023-12-081-0/+28
| | | | | | Task-number: QTBUG-104111 Change-Id: Id57b075d00e657c2606b6c1a8f1215ed0d067cbd Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QIcon: add theme icon constantsVolker Hilsheimer2023-12-071-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a list of constant string literals for a subset of icons from the freedesktop specification. Those are icons we document to support today, and that users might have written themes for. Omit icons that are mime types (we have Q(Abstract)FileIconProvider and QPlatformTheme::fileIcon for that), the "flag-aa" icon (where 'aa' is an ISO 3166 country code, and Face* icons. Flags and Face icons can be added as supported QIcon constants, but should then be rendered as emojis from the respective font (they are not provided by any of the native icon libraries or icon fonts). We use string constants instead of an enum so that we have the same code path for icon constants, user-defined icons, and native icons. I.e. in addition to QIcon::fromTheme(QIcon::ThemeIcon::EditCopy), code can request the icon for "trash.circle.fill" on Apple platforms, or or for U"\ue5cd" on platforms where the engine is font-based; or an app can define their own icon name and provide the assets through a theme- description, as before. The downside is that we cannot use arrays for looking up the native icon for an enum-value in the engine implementations, but given that icons are cached this is an acceptable trade-off. To make the list of icon contants more manageable, have them in a separate header file. Since we want those constants to live in the QIcon "namespace", we then include that header in a declaration of a nested struct, "ThemeIcon", resulting in e.g. QIcon::ThemeIcon::EditCopy. Change-Id: Ic20e36ab321e6c4b20806ec0b400bba13fffc983 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QIcon: don't rely on getting a null-icon in testVolker Hilsheimer2023-12-071-4/+10
| | | | | | | | | | | | | | | If a QPA-provided engine provides an "edit-cut" icon, then it won't be null. We cannot reliably test that the icon came from the fallback theme as the cacheKey of the icon doesn't change (the proxying to a different theme is handled internally by the QThemeIconEngine). That the cacheKey of a QIcon doesn't change even if the pixmaps we get from it change is not a problem in practice; QIcon is a named container for transient graphical assets that might change for reasons outside of Qt's control (such as color scheme, or display resolution). Change-Id: I695e8ad0c8f0aec7f17a2c242e64b615178b78b5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Tests: remove blacklisted CIs no longer availableChristian Ehrlicher2023-12-062-5/+0
| | | | | | | | | | | | | | | | Remove the following CIs from BLACKLIST files as they are no longer used: - msvc-2015 - msvc-2017 - windows-7sp1 - opensuse-42.3 - ubuntu 16.04/18.04/20.04 - rhel 6.6/7.4/7.6 - redhatenterpriselinuxworkstation-6.6 Change-Id: Ief9550e3455a1ed211d978933262c8d5557b0fec Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* rhi: Make sample count selection logic be closer to Qt 5Laszlo Agocs2023-12-061-2/+62
| | | | | | | | Pick-to: 6.6 6.5 Fixes: QTBUG-119148 Change-Id: Ia119ab3ced9da08853c608aa256bde08a6fd8d4e Reviewed-by: Andy Nichols <andy.nichols@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Skip test cases that resizes window on eglfs_viv on VxWorksMarcin Zdunek2023-12-051-0/+3
| | | | | | | | This change is required when running in real hw with eglfs backend. It passed on CI because CI used "offscreen" backend and eglfs is not tested on CI at the moment. Task-number: QTBUG-115777 Change-Id: I4bbfbedcbe21c5c2041be9bdb8ae370156bb6200 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* QPpmHandler: fix reading ppm filesChristian Ehrlicher2023-11-271-5/+5
| | | | | | | | | | | The ppm spec allows 1-bit ascii ppm files to have no spaces bitween the single bits. Therefore we have to adjust read_pbm_int() to stop after reading one digit. Pick-to: 6.6 Fixes: QTBUG-119239 Change-Id: I161038076c5dee4662aa66a1215822fc75e6a19e Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* tst_qstatictext: remove dead codeChristian Ehrlicher2023-11-261-59/+0
| | | | | | | | Remove dead code from tst_qstatictext as proposed in the bug report. Fixes: QTBUG-22424 Change-Id: Id0916cba75eb7c7a21c61c078d94470b143d0f24 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Disable tst_ForeignWindow::embedForeignWindow() null-parent check on LinuxTor Arne Vestbø2023-11-221-0/+3
| | | | | | | | It's flakey, so let's unbreak the build while we investigate further. Pick-to: 6.6 Change-Id: I9f7559803dd3ebc80946e5e5c5d31292101cd36f Reviewed-by: Liang Qi <liang.qi@qt.io>
* tst_QTimer: refactor CMake codeAhmad Samir2023-11-221-14/+17
| | | | | | | | | It's used to build different variations of the unittest, linking against QtCore-only/QtGui, with/without GLib, that's four individual tests. Change-Id: Iaf0f37041dbb148134631f86be99feaa881a8ce8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Stabilize tst_ForeignWindow::embedForeignWindow()Tor Arne Vestbø2023-11-191-5/+1
| | | | | | | | | | We only care about no longer being a child of the old parent window, not what the system does when we reparent to nullptr. Pick-to: 6.6 Change-Id: Ibd670432f0fd2595195d3951014a570dfdb7a998 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Add dedicated child and parent events for QWindow reparentingTor Arne Vestbø2023-11-171-0/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | When a QWindow is parented into another window, either via its constructor, or via setParent(), we also update the QObject parent of the window. This in turn sends ChildAdded and ChildRemoved events to the new and old parent of the window, as well as ParentAboutToChange and ParentChange to the window itself. But at the point when these events are sent, the QWindow parent relationship has not been fully established. We have not updated d->parentWindow, nor have we propagated the parent relationship to the platform window. This is problematic because clients can not use these events to react to window parent changes synchronously. For example. trying to raise a child window when added to a parent is not going to work, because at that point the child window isn't a native child of the parent. Instead of re-using the QObject events for QWindow, like QWidget does, by delaying the events or sending them manually at a point when the window parent relationship has been fully formed, we opt to add new dedicated events. Change-Id: I019c14eba444861f537e4f68ab3a82297f843cf7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Prevent reparenting of foreign window embedding containerTor Arne Vestbø2023-11-151-0/+45
| | | | | | | | | | | A foreign window used to embed a Qt window into it should not end up with changes to its own parent, as its only job is to give the embedded Qt window a parent handle. Pick-to: 6.6 Change-Id: If1bc89658fedf449d266bc0cc750c90b6a841a68 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* macOS: Take window mask into account when computing QCocoaScreen::topLevelAtTor Arne Vestbø2023-11-151-0/+33
| | | | | | | | | | | | | | Although not explicitly documented, this is the behavior in practice on XCB and Windows, and we rely on this behavior in our implementation of QApplication::widgetAt(), where we punch a temporary hole in the widget using a mask if it has Qt::WA_TransparentForMouseEvents set. Pick-to: 6.5 6.6 Fixes: QTBUG-41696 Task-number: QTBUG-119092 Change-Id: Ie7abc31b6930ee6b56fcdf391befc625c1ddf502 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QGuiApplication: check return value of platformTheme::palette()Christian Ehrlicher2023-11-141-0/+10
| | | | | | | | | | | Under some circumstances (e.g. setDesktopSettingsAware(false) on windows) it may happen that the call to platformTheme::palette() returns a nullptr which is not checked before dereferencing the pointer. Therefore add a check for this to avoid a crash. Fixes: QTBUG-111527 Change-Id: I6443d5d1a9b813f499d8f65b4fee55b0b8299b16 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QStandardItem: store Qt::UserRole-1 in a static constexpr varAhmad Samir2023-11-141-1/+1
| | | | | Change-Id: I809135aed1883130891863e7c8650d0b3e7f3a35 Reviewed-by: David Faure <david.faure@kdab.com>
* QStandardItem: add note about reimplementing data/setData() wrt. flagsAhmad Samir2023-11-141-0/+32
| | | | | | | | | | | | Extend the unittests. Drive-by change: add missing include, otherwise static analyzers (clangd) complain. Fixes: QTBUG-105150 Pick-to: 6.6 6.5 5.15 Change-Id: I312133d5b35119e2e51002dfefe0e141c0708e3d Reviewed-by: David Faure <david.faure@kdab.com>
* Add checking if using eglfsMarcin Zdunek2023-11-131-0/+31
| | | | | | | | | | | We are using eglfs in VxWorks which make 3 few testcases fail, because eglfs windows are fullscreen by default. This is the same solution as in qt5 in tag 5.12.6 from commit with hash 39027ef076c. [...] EGLFS forces the first top-level window - either a QWidget or a QQuickView - to become fullscreen. [...] from: https://doc.qt.io/qt-6/embedded-linux.html Change-Id: I3ab3208b3c7c1b2e27d879bac1ee0679f48109e2 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>