summaryrefslogtreecommitdiffstats
path: root/src/gui/image
Commit message (Collapse)AuthorAgeFilesLines
* QMovie: fix regression in frame delaysEirik Aavitsland2 days1-3/+3
| | | | | | | | | | | | | The recent addition of support for multi-frame (non-animation) formats had an unwanted side effect of sometimes calling QImageReader::nextImageDelay() when the reader is at a different frame than intended. Fix by effectively reverting to the previous call pattern. Fixes: QTBUG-124227 Pick-to: 6.7 6.5 Change-Id: I735f8d67afb17bd4c77f9b4507a71796b7d66958 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Copy image offset in copyMetadataAllan Sandfeld Jensen8 days1-4/+2
| | | | | | | | Making it be carried more consistently. Pick-to: 6.7 Change-Id: I8d2da1264a59febbd44bbcff798b647ec2813bb0 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Convert "(added in)" enum warnings to [since] syntaxAllan Sandfeld Jensen8 days1-30/+51
| | | | | | | | | | With the since syntax we can now mark since more standardized Pick-to: 6.7 Change-Id: I3c53010043a40e8887f1899cde2689ee80e530ae Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
* QImageReader: use QFile::open return valueGiuseppe D'Angelo10 days1-3/+4
| | | | | | | | | The code was already OK because it used QFile::isOpen to check if open() succeeded or not. In preparation for making open() [[nodiscard]], refactor the code to just use its return value. Change-Id: Ibab86ca894103f01ff3b6084caedb3117ffb6c7e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add CMYK support to QColorSpaceAllan Sandfeld Jensen2024-04-122-28/+162
| | | | | | | | [ChangeLog][QtGui][QColorSpace] Support for CMYK color spaces has been added. Change-Id: I2c684dbeee8b97fc90ca4e2a892349a7fa465d06 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Add color space model, making gray color spaces explicitAllan Sandfeld Jensen2024-04-053-16/+548
| | | | | | | | | This also adds image conversion of both format and color space, which will also be required later for conversions to CMYK formats and color spaces. Change-Id: I578c0a010ffcdb4df4cf9080c0621fac8bc342bf Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QImage: remove the last mentions of Format_CMYK32Giuseppe D'Angelo2024-04-053-4/+2
| | | | | Change-Id: I8ef63d7f3f14f16111a7e45e07734c10e448984c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix a regression when painting CMYK over ARGB32_PremultipliedAllan Sandfeld Jensen2024-04-041-3/+110
| | | | | | | | | | With the introduction of CMYK32 the old logic of assuming depth meant compatible alpha version no longer works. So change the logic to more explicitly return compatible opaque or alpha versions and remove the now invalid qt_maybeAlphaVersionWithSameDepth. Change-Id: Ib1f7b76b0ce0eae7d49a0dfe369918a746bbe2b4 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Port QImage::Format_CMYK32 to CMYK8888Giuseppe D'Angelo2024-04-044-15/+17
| | | | | | | | | | | | Follow the established convention that byte-oriented image formats have the "8888" suffix, not "32". The old enum name is temporarily left to help port other submodules. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: I4b6f10cb22312b614cb9cf4b0ac439907276c538 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* GUI: add CMYK painting supportGiuseppe D'Angelo2024-04-034-2/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a CMYK 8bpp format to QImage. The idea is to enable the transport of CMYK images inside Qt, for instance to be loaded/saved from files or painted on CMYK capable paint devices (e.g. PDF). Also, rasterization support *from* a CMYK image is added (on top of a RGB surface), as well as CMYK image scaling/conversion. Conversion and rasterization between CMYK and RGB isn't particularly optimized nor it honors any colorspaces yet. The overall idea is to match 1:1 the existing behavior of CMYK QColor (which get naively changed to RGB; there isn't colorspace support in QPainter yet). There are no plans to add rasterization *towards* CMYK. Image save/load in native CMYK formats will be added in future commits. This work has been kindly sponsored by the QGIS project (https://qgis.org/). [ChangeLog][QtGui] Support for 8-bit CMYK images has been added. Change-Id: I4b024cd4c15119c669b6ddd450418a9e425587f8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add QColorSpace::isValidTargetAllan Sandfeld Jensen2024-03-271-2/+8
| | | | | | | | To indicate color spaces that can not be used as a target, but only as a source. Change-Id: Iae79e3533599c112872d171a2f45178029be89dc Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QMovie: allow only one dimension to be used for scaledSizeVladimir Belyavsky2024-03-201-5/+1
| | | | | | | | | | | | | | | | | In 4c21f728374605ff529aa53c63c3d59517098435 we did this for QImageReader. So, to support the same for QMovie, we just need to remove the custom (and very inefficient) scaling for frames. This should be safe since the underlying QImageReader must ensure that the returned image matches the scaled size. [ChangeLog][QtGui][QMovie] Allow only one dimension (width or height) to be set for the scaled size. In this case, the other will be calculated automatically based on the original movie size and maintaining the aspect ratio. Fixes: QTBUG-115039 Change-Id: I50979a75970c79647dbb8c8b4b121266ba033a63 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QImageReader: allow only one dimension to be used for scaledSizeVladimir Belyavsky2024-03-191-6/+26
| | | | | | | | | | | | | | | If only one dimension (width or height) of the scaled size is set by an user, let's try to calculate the second one, based on the image original size and maintaining the aspect ratio. [ChangeLog][QtGui][QImageReader] Allow only one dimension (width or height) to be set for the scaled size. In this case, the other will be calculated automatically based on the original image size and maintaining the aspect ratio. Task-number: QTBUG-115039 Change-Id: If1b13b1ead3cf788915c08bdb3ba8becd8bf8042 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* PNG: preserve ICC profiles that QColorSpace does not handleGiuseppe D'Angelo2024-03-101-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | QColorSpace::isValid() returns true if QColorSpace can handle the profile. When called on a QColorSpace obtained via QColorSpace::fromIccProfile, this doesn't necessarily mean that the ICC profile itself was invalid; it could be that the ICC data was valid, but QColorSpace didn't know how to use it. This is especially true on Qt <= 6.7, where only XYZ/RGB matrix profiles were supported. We don't fully parse ICC v4, and we're lacking an API to differentiate between "ICC data was valid but QColorSpace doesn't handle it" vs "ICC data was invalid". Still, an invalid QColorSpace will still the original ICC data, so it can be saved again without loss of information. So: 1) when loading a PNG with embedded ICC data, keep the loaded profile even if it's "invalid"; 2) when writing a PNG, check if we have ICC data to save, and unconditionally write it if it's the case. This avoids data loss in the two directions. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Pick-to: 6.7 6.6 6.5 Change-Id: I1f27f603acbca1590c820e80f52f3b994f5ea5c7 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Icon: work around compile optimization bugVolker Hilsheimer2024-03-041-158/+158
| | | | | | | | | | | | | We are observing that the strings become sequences of zeros in release builds, possibly triggered by qOffsetStringArray being used in a static constexpr function to initialize a constexpr array. Pull the array out of the function as a static on translation unit level, which is a pattern we use regularly elsewhere in Qt. Pick-to: 6.7 Change-Id: I69c8cfe4e2d6d7d4659edda621ba1afe9768035b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Call QColorTransformPrivate::applyReturnGray directlyAllan Sandfeld Jensen2024-02-291-4/+4
| | | | | Change-Id: I03434d11cf0ee734b4c0300db9b675fe393ccfab Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QPixmap: fix the documenation for toHICONGiuseppe D'Angelo2024-02-281-2/+3
| | | | | | | | The functions are now on QImage, not on QtWIn. Change-Id: Ida777c7fc087bf673c5305beffb498ada115ed73 Pick-to: 6.7 6.6 6.5 6.2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QIcon: complete the documentation of ThemeIconsVolker Hilsheimer2024-02-211-152/+170
| | | | | | | | | Add missing \since 6.7, and document the purpose of each value based on the description in the freedesktop specification. Pick-to: 6.7 Change-Id: Id88438abf152c317600454d7137a19b13aa0a3cc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QIcon: remove unmapped ThemeIcon enum valuesVolker Hilsheimer2024-02-212-282/+0
| | | | | | | | | | | | | | | The ThemeIcon enum provides symbolic names of icons for which most engines provide an icon. We couldn't find a matching icon for several of the XDG icon names, so remove those enum values for which we don't have at least two matches. Also remove names that are too specific for a desktop environment, like icons for certain applications or system-wide actions. Pick-to: 6.7 Change-Id: I5a6c74256bda66d9fde7513f834a8361858605c4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove extra semi-colonsTasuku Suzuki2024-02-061-1/+1
| | | | | Change-Id: I92fddb36cd136fd1bd627955f15d0559b9942d7e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QMovie non-anim: use QImageReader::imageCount but not nextImageDelayShawn Rutledge2024-02-021-4/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-012-7/+12
| | | | | | | | | | | | | | | | | | | | 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>
* Simplify new QIcon ThemeIcon constants and APIVolker Hilsheimer2024-01-263-270/+819
| | | | | | | | | | | | | | | | | | | | Originally we thought that exposing the string literal through the API would be useful for people that want to know what icon they will get when using a specific constant. But since the mapping from platform independent icon name to platform specific icon name is anyway hidden in the engine implementation, this is no longer useful. Based on header review comments, simplify this by making the ThemeIcon list of constants a scoped enum. If it's really useful for e.g. designers to know which exact icon they get on a specific platform, then we could, in a future release, add a static QIcon::themeIconName API that returns the platform specific icon string for a ThemeIcon constant. Pick-to: 6.7 Change-Id: I231eb98fefb4ac82d38209b4e1257bb3caadeb08 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Make sure hicolor is searched before dash fallbacksMike Chen2024-01-172-16/+24
| | | | | | | | | Search full icon name from hicolor before dash fallback Pick-to: 6.7 6.6 Fixes: QTBUG-121030 Change-Id: I3e3ee142c33466203639f32857fce3ea1946a9f7 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QImageIOHandler: doc tidiesGiuseppe D'Angelo2024-01-131-3/+3
| | | | | | | | | | | Remove a "." after the enumerator names that would end up in the docs. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: I6db1e83331552a58f77479166a67b88bb25f2d6e Pick-to: 6.7 6.6 6.5 6.2 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QIcon::availableSizes(): don't return duplicatesChristian Ehrlicher2024-01-121-5/+6
| | | | | | | | | | | | QIcon::availableSizes() returned duplicate sizes when there are pixmaps with a different dpi but same size. This is not useful and therefore filter them out. Also rearrange the conditions a little bit to bail out on wrong mode/state early. Pick-to: 6.7 Task-number: QTBUG-119915 Change-Id: I9d18c78fc2a149a3a9eaaed67c6110979029705b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Don't search more generic icons in Applications and MimeTypes contextsAlexander Volkov2023-12-182-1/+22
| | | | | | | | | | | | | According to the specification https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html#guidelines 1) "the dash “-” character is used to separate levels of specificity in icon names, for all contexts other than MimeTypes" 2) "the “Applications” context should not use this method of falling back to more generic icons" Pick-to: 6.7 6.6 Change-Id: Ia3536141158a4b6c1c4f85db8ad890514cf19e84 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Copy color table in QImage::transform paint pathAllan Sandfeld Jensen2023-12-141-1/+8
| | | | | | | | | 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>
* qt_imageToWinHBITMAP(): properly delete object on errorChristian Ehrlicher2023-12-131-0/+1
| | | | | | | | | | Properly delete the handle created by CreateDIBSection() with DeleteObject() in case of error. Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-18057 Change-Id: Ibf40f6afb255bc5a7d7bf39939f5eb3dfcd19f84 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Do not create icon engine multiple timesDavid Redondo2023-12-131-6/+8
| | | | | | | | | | | | | | | Creating an icon engine is a potentially expensive operation involving many file lookups. In the case where neither QIconLoaderEngine nor the engine from the platform theme is valid, QIconLoader tries to unsuccesfully find the icon in all theme directories, the theme engine is constructed potentially doing some expensive operation and finally a new QIconLoaderEngine is constructed which does all the file lookups again. Instead keep the existing QIconLoaderEngine around if it was already constructed. Pick-to: 6.7 Change-Id: Iace9a3f904730064f44939b2269316484ac6da2e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QIcon: prefer downscaling over upscaling pixmap iconsDavid Schulz2023-12-131-0/+3
| | | | | | | | | | ... 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>
* QStringBuilder: use data_ptr().data() instead of constData()Thiago Macieira2023-12-121-3/+0
| | | | | | | | | | | | | | | | As the comment says, this allows us to skip the check for non-detached strings and for null ones. We know that the one we've just created isn't either, so long as len != 0. All QConcatenable::appendTo() calls do nothing if len == 0, including not calling memcpy() at all. Moreover, because it no longer references the QByteArray::_empty variable, the GCC -Warray-bounds warning should be gone too. Task-number: QTBUG-116763 Pick-to: 6.7 6.6 6.5 Change-Id: Ica7a43f6147b49c187ccfffd179eba2897ce2aff Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Centralize conversion from unpremultiplied to premultiplied image formatAllan Sandfeld Jensen2023-12-122-9/+23
| | | | | | | Makes it possible to add new unpremultiplied formats later. Change-Id: Id998a2674ca9067a0e2a5f85c7baf04bcd9a9912 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QAbstractFileIconEngine: reimplement isNull()Christian Ehrlicher2023-12-091-0/+1
| | | | | | | | | | | | | | QPixmapIconEngine as base class of QAbstractFileIconEngine implements isNull() by checking if there are pixmaps available. As QAbstractFileIconEngine does it's own caching mechanism, that check is failing. Since we can assume that the os returns a valid icon for every file, QAbstractFileIconEngine::isNull() can always return false. Pick-to: 6.6 6.5 Fixes: QTBUG-119797 Task-number: QTBUG-118667 Change-Id: I713a3cda6a4d14bb3dea374b40d8e8219278e5db Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QIconLoader::actualSize(): respect entry.scale on returned sizeChristian Ehrlicher2023-12-071-1/+1
| | | | | | | | | | | | | entryForSize() might return an entry with a scale != 1 (e.g. when requesting the actual size for 32x32 it might return an entry with size=16 and scale=2) but the returned size is not multiplied with this scale so it returns a wrong size and in the case of QTBUG-114849 to a wrong painting rect. Pick-to: 6.6 6.5 Fixes: QTBUG-114849 Change-Id: I311e7401e61425efb20b37d13cc95c4b22d47e76 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QIcon: turn platform engines on by defaultVolker Hilsheimer2023-12-071-9/+19
| | | | | | | | | | | | | | | | | | | | | | They are used when an icon is constructed via QIcon::fromTheme, unless an application-defined theme provides the requested icon. Update the documentation. For now we don't provide a way to "opt out". This might change, depending on the feedback during the Qt 6.7 beta phase. [ChangeLog][QtGui][QIcon] Qt now has implementations of native icon engines for macOS, iOS, Windows 10, Windows 11, and Android. These engines provide access to the native icon libraries and fonts, mapping standard icons to the corresponding native icon asset. Icons from application-defined themes take precedence, but the last-resort fallback icon passed as the second parameter into the QIcon::fromTheme(QString, QIcon) overload is only used if the icon is not available from the native library. See the QIcon documentation for details. Change-Id: I618e5c137c40f8e6309c0e4d4219a5a2759a475d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QIcon: Clean up documentationVolker Hilsheimer2023-12-071-30/+51
| | | | | | | | | | | | | Structure the overview documentation a bit more around the different ways to create a QIcon (from resources or theme). Replace the use of QIcon::pixmap with a call to QIcon::paint in the example widget, and tighten the High-DPI documentation a bit. This does not add any mentioning of the upcoming "native icon library" support. Change-Id: I9cc7eab1fb5d134e5119660b534c2efdb0b03730 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QIcon: add theme icon constantsVolker Hilsheimer2023-12-072-0/+272
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: fall back to QPA engine if themes don't provide the iconVolker Hilsheimer2023-12-071-4/+12
| | | | | | | | | | | | | | | | | | If the QIconLoaderEngine (which respects theme and fallback theme) does not provide the icon, then try the QIconEngine provided by the QPlatformTheme implementation of createIconEngine. If that provides the requested icon, then use it; otherwise keep using an QIconLoaderEngine. Clean up the logic of that code a bit, while maintaining the invariant that we need to return a valid QIconEngine pointer. [ChangeLog][QtGui][QIcon] If neither theme nor fallback theme provide the requested icon, we fall back to the QPA plugin implementation. On platforms where an implementation exists, this will override the explicitly provided fallback (second parameter to QIcon::fromTheme). Change-Id: Idbf9ed049f5e975e1fbcdbb30dbdf6eac08e5827 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QPpmHandler: fix reading ppm filesChristian Ehrlicher2023-11-271-2/+6
| | | | | | | | | | | 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>
* QImageReader: Reduce code redundancyMike Chen2023-11-221-40/+25
| | | | | | | | | | | | | | | Refactor methods to simplify the code and improve readability. Replace calls to initHandler() and checks for handler support with calls to the supportsOption() method directly. Reduces code redundancy and improves the overall structure of the class. Additionally, use supportScaledSize, supportClipRect, and supportScaledClipRect to streamline the conditional logic and make it more understandable. Change-Id: I77d5dab8bcdd0b0eb6d7e9edcf87751aa03b80c7 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add QPixmapIconEngine::isNull()Christian Ehrlicher2023-11-082-1/+6
| | | | | | | | | | | Reimplement the virtual function QIconEngine::isNull() for QPixmapIconEngine. This lets QIcon::isNull() return true when no pixmaps are loaded during QIcon::addFile() e.g. due to a wrong filename. Pick-to: 6.6 6.5 Fixes: QTBUG-118667 Change-Id: I29f2c492e55b60638507fa398ef7af76f4e9ff48 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* qpixmap_win: use qimage rvalue overalods moreAnton Kudryavtsev2023-10-311-1/+1
| | | | | Change-Id: I363b40ad8c797e0e554eca249347b5764d7dcfe8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix smooth scaling of Format_Mono and Format_MonoLSBJoni Poikelin2023-10-261-4/+14
| | | | | | | Fixes: QTBUG-117713 Pick-to: 6.6 6.5 6.2 Change-Id: I2fb071a4d2229da50dfacb0a92c51c3e4ea57a74 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Work around GCC 13's bogus "out of bounds" check to QByteArray::_emptyThiago Macieira2023-10-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Nothing here is empty and even if anything were, QStringBuilder properly handles empty strings. In static member function ‘static void QConcatenable<QByteArrayView>::appendTo(QByteArrayView, char*&)’, inlined from ‘static void QConcatenable<QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> > >::appendTo(const type&, T*&) [with T = char; A = QByteArrayView; B = const char (&)[20]]’ at qstringbuilder.h:398:37, inlined from ‘T QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> >::convertTo() const [with T = QByteArray; A = QByteArrayView; B = const char (&)[20]]’ at qstringbuilder.h:117:54, ... qstringbuilder.h:178:19: error: ‘void* memcpy(void*, const void*, size_t)’ forming offset [1, 5] is out of the bounds [0, 1] of object ‘QByteArray::_empty’ with type ‘const char’ [-Werror=array-bounds=] QStringBuilder::convertTo() creates the target as const qsizetype len = QConcatenable< QStringBuilder<A, B> >::size(*this); T s(len, Qt::Uninitialized); We know len can't be zero because GCC is complaining about a memcpy() when the offset has been changed from 0, meaning QByteArray was given a non-zero size and therefore its data pointer is not &QByteArray::_empty. Fixes: QTBUG-116763 Pick-to: 6.5 6.6 Change-Id: I85599ea5ca7a4b79a8bbfffd178af437984080fb Reviewed-by: Shawn Rutledge (away) <shawn.rutledge@qt.io>
* Doc: Fix warnings and linking issuesTopi Reinio2023-10-091-2/+2
| | | | | | | | | | | | | | | | | | | | Remove or replace links to examples that were removed or moved under manual tests. Replace code snippets that were quoting the now-missing examples. Fix documentation of QSet::removeIf(). Fix typo in documentation macro: Unknown command '\examplecateogry'. Add qtopengl, qtshadertools dependencies to Qt Widgets documentation project to enable correct linking to those topics. Mark all documentation sets in qtbase as free of warnings. Pick-to: 6.6 6.5 Change-Id: I058cd5f2063aa933ea310bceff906f05422a7cb2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* write_pbm_image: use QBAV moreAnton Kudryavtsev2023-10-041-3/+2
| | | | | | | to reduce allocations Change-Id: I99351a8042a315b4b0742567ba77082b576cbece Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Fix QIcon documentationTopi Reinio2023-10-021-17/+10
| | | | | | | | | | | * Move \externalpage topics to external-resources.qdoc, as that command cannot be embedded in other topics. * Fix references to non-existent function fallbackIconTheme(). Pick-to: 6.6 Change-Id: I5d08206c53aea9c2d4c6fddf5d04df187b01ef53 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* qppmhandler: avoid implicit detachAnton Kudryavtsev2023-09-251-1/+1
| | | | | | | | by const method usage Change-Id: If8e4d0c543837917d29361a116b955890b8a279f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix gcc 13 fatal warning: emplace_back() rather than append()Shawn Rutledge2023-09-191-1/+1
| | | | | | | Fixes: QTBUG-116763 Pick-to: 6.6 Change-Id: Ie7c897deb14fcd1ff27277892f0c5a151ff63b41 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>