aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2impl
Commit message (Collapse)AuthorAgeFilesLines
* Fix emission of QQuickPaddedRectangle::topPaddingChangedJoerg Bornemann2022-07-131-1/+1
| | | | | | | | | | | | | | | ...when setting the padding property. The topPaddingChanged signal is to be emitted if padding changed and no separate topPadding has been specified. Unlike the other *PaddingChanged signals, it was emitted if topPadding *was* specified. Fixes: QTBUG-104865 Change-Id: I8585c4b3f7aa70030b5c6e195516e1aba73e5c46 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit a08eb13e7a19f86119b9dcdb5ac3e72062fe7edc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* FileDialog: make selectedFile writableMitch Curtis2022-06-042-1/+13
| | | | | | | | | | | | | This allows setting an initially selected file. [ChangeLog][QtQuickDialogs] FileDialog's selectedFile property can now be set to an initially selected file. Fixes: QTBUG-101975 Change-Id: I399f9379e1ac54917edbc31f9029d5522a914340 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 8353f841414238e62710532f83713fb231727b2f) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add TUs for QML_FOREIGNs and namespaces to enable includemocsMarc Mutz2022-05-102-1/+47
| | | | | | | | | | | | | There is never any implementation of QML_FOREIGN Q_GADGETs, or Q_ENUMs, so just compiling their moc-files in mocs_compilation.cpp would be fine. But at some point we want automoc to throw an error when mocs_compilation.cpp isn't empty, so add TUs nonetheless. Task-number: QTBUG-102948 Change-Id: Ie4167badc730e09d51429c961915da5990c7b51a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 6738fe1ee736835251d8c2fb06bdae54e7087edb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add missing include guards to qtquickcontrols2foreign_p.hMarc Mutz2022-05-101-0/+4
| | | | | | | | | Detected by includemocs. Change-Id: Ic432dbba6a292c4f6887b3b3c3b543d044f55283 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit e0af2a1645ed2049c6237a4aa68245517fd89ba6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QuickControls2Impl: includemocsMarc Mutz2022-05-0713-0/+26
| | | | | | | | | | | | Including moc files directly into their classes' TU tends to improve codegen and enables extended compiler warnings, e.g. about unused private functions or fields. Task-number: QTBUG-102948 Change-Id: If6f459ba6b7403a1703551fba571b0e1bdcf3b82 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 5d6ca34b2638cd567e633361c991ba95228c206c) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QQuickIcon: Resolve source URL relative to outermost property ownerYuya Nishihara2022-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original attempt, deb238586a "QQuickIcon: Resolve URL relative to current element," works fine for IconLabel itself, but not for Buttons containing IconLabel. // <style>/Button.qml T.Button { id: control icon: // owner: control contentItem: IconLabel { icon: control.icon // owner: this, but should be control } } // user code Button { icon.source: "a.png" } Since IconLabel is an implementation detail of the Button, IconLabel.icon owner needs to point to the Button so the user-specified icon.source can be resolved relative to the user code, not to the <style>/ directory. This patch fixes the problem by explicitly resolving the source URL on setIcon() and propagating the resolved icon object to the inner items. If the relative URL has already been resolved by e.g. Button, the inner IconLabel never resolves the URL again to itself. The problem could be addressed by initializing icon owner only once by Action/Button constructor, but that would lead to dangling owner pointer as icon object could be copied anywhere. So I've added resolvedSource data member in place of the owner pointer. Button { id: dangling } Button { id: victim; icon: dangling.icon } // owner: dangling Component.onCompleted: dangling.destroy() // ... would SEGV (or use after free) if victim.icon.source modified. Fixes: QTBUG-95587 Change-Id: Ibdd07118e79f1e1f36e1faea0289150eca734e27 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit dfc16e40ab43e8062b93c566e4316efe4d4f10a0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Auto-test-export QQuickIconLabelPrivateMarc Mutz2022-01-291-1/+1
| | | | | | | | | | It's used in tst_qquickiconlabel.cpp, thus breaking ubsan builds unless exported. Change-Id: I44192fafc7cfcc57e6eccaf0d7df37b510e6d290 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 7e3b966bf88c2316516f24b0800d4edcf705d5b9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Replace currentFile(s) with selectedFile(s)Mitch Curtis2022-01-051-2/+7
| | | | | | | | | | | | | | | | | | | selectedFile can represent the currently-selected file (if the platform supports it), and so we can free up "currentFolder" for FolderDialog now that it means the folder that is being displayed, rather than the folder that is currently selected. [ChangeLog][QtQuickDialogs] FileDialog's currentFile and currentFiles properties have been deprecated. The selectedFile and selectedFiles properties now refer to the currently selected file(s), as well as the final selection. Fixes: QTBUG-98562 Task-number: QTBUG-87798 Change-Id: Ic66481332338f21169a9f63617cf4db4be83265d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 13399bd54d084ed837ec061ca9315dbd173f3b48) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use up-to date LGPL license headerKai Köhne2021-11-2932-352/+448
| | | | | | | | Remove usages of outdated LGPL3 header that references LICENSES.LGPLv3 instead of LICENSES.LGPL3. Change-Id: If7a90ec18331a68491c5a740f131a5e7b3f37df4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Move Q_DECLARE_PUBLIC to the public sectionThiago Macieira2021-11-272-2/+2
| | | | | | | This is now required to use QObjectPrivate::connect. Change-Id: Iccb47e5527544b6fbd75fffd16b8bd87f0818ad5 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* FileDialog: show dirs first on non-macOS platformsMitch Curtis2021-11-051-0/+6
| | | | | | | macOS shows files amongst directories instead of after them. Change-Id: Ib21918611eed59936dccd694540bc426752729fe Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add (private) PlatformTheme singletonMitch Curtis2021-11-053-0/+136
| | | | | | | | | | Exposes platform theme hints to QML so that styles have a more accurate way of checking for platform-specific behavior than: Qt.platform.os === "foo" Change-Id: I5588671005aae0751c5e473f36e0b2ba86be8998 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Migrate to autogenerated cpp exports in qqc2Alexey Edelev2021-11-0316-26/+17
| | | | | | | | | | Replace the hardcoded cpp exports with a generated one in qqc2. Task-number: QTBUG-90492 Change-Id: I8435b127a78eb924639bbb68f8b87f20dc715943 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Avoid unnecessary color format conversionJiDe Zhang2021-10-291-4/+7
| | | | | | | | | | | | If a color is not the rgb format, when QColor::red() QColor::blue() QColor::green() is used continuously to obtain the values of different channels, three times color conversions will occur. Therefore, use QColor::toRgb() before that to ensure that only one conversion is performed at most. Not only rgb, the conversion of other formats is the same. Change-Id: Ia969e1ca6f1524ad5d7e8dec915bcbc407875c66 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickIcon: Resolve URL relative to current elementFabian Kosmale2021-09-201-2/+3
| | | | | | | | | | | | | | | | | | If a user passes a relative URL to icon, they probably expect the URL to be handled relative to the current file (like in Qt 5). We restore this behavior by doing the URL resolution in the current QML context. Unfortunately, as a gadget, QQuickIcon does not have its own context. Thus, we need to store (and set) a pointer to its "owner", so that we can retrieve the context for the binding that causes the URL to be set. We adjust the three classes which currently use QQuickIcon to set the owner in their setIcon methods. Task-number: QTBUG-95587 Pick-to: 6.2 Change-Id: Icd1f2ddf65ae7d09ff787a50a01f1db78c571abf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Don't qDeleteAll on std::vector<std::unique_ptr<...>>Ulf Hermann2021-09-201-2/+1
| | | | | | | | The type of QIconLoader::entries has changed. Change-Id: Ic7db865cc6a26049d60378f325af9afd65eb2ea7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix memory leak in Qt Quick Controls iconEirik Aavitsland2021-09-072-0/+8
| | | | | | | | | | | The implementation of the icon property uses the internal QThemeIconInfo struct from qtbase. That is low level and expects the user to handle memory deallocation, and this was missing. Fixes: QTBUG-93050 Pick-to: 6.2 Change-Id: Ied6488aa8871c246d3781a3db47f40130dc19bcc Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* CMake: Fix controls packages to have correct Qt package dependenciesAlexandru Croitor2021-08-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | | The Qt6QuickControls2 package did not get a Dependencies.cmake file generated to call find_package(Qt6Quick) because Quick was removed from the PUBLIC_LIBRARIES section of the Qt module definition. Same for the other controls Qt modules and their dependencies. Those were incorrectly removed with the idea that they were plugin targets which don't have public dependencies, but that's not the case, they are Qt modules, not plugins. Restore the public library dependencies, so that transitive find_package'ing works. Amends 9c30798a439e6a87b574472aca7a4e15107c6221 Pick-to: 6.2 Fixes: QTBUG-95532 Change-Id: Ie2cb69cdde5585e90a5ce97a6d3666a647daef40 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove unnecessary type registrtion function declarationsUlf Hermann2021-07-161-2/+0
| | | | | | | | For auto-generated plugins we don't need the declarations. Pick-to: 6.2 Change-Id: I0250703e7c81debc6bc6ca526722c43b8a8058c8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* CMake: Don't give plugins PUBLIC usage requirementsJoerg Bornemann2021-07-091-4/+0
| | | | | | | | | | | | | | | | | | | | | | | The pro2cmake.py conversion script faithfully reproduced the .pro files for the plugins, which specified the libraries as public. But in CMake, the implications of this are that public usage requirements should then be propagated to consumers. We don't expect any consumers, since a plugin is created as a MODULE library in CMake, so for Windows we don't even have an import library to link with. The only exception to this is for static builds where plugins are created as STATIC libraries instead, but only in certain controlled situations do we then link to plugins. Even then, usage requirements are not expected to propagate to the consumers, so these relationships should always be specified as private. As a drive-by fix, remove Qt::Foo dependencies that are already implied by Qt::FooPrivate. Pick-to: 6.2 Task-number: QTBUG-90819 Change-Id: I3f33766612367520e09e599f03ac06d43613aa81 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Update to latest qml CMake APICraig Scott2021-06-051-23/+7
| | | | | | | | | | | | | | The new qml CMake API places a closer relationship between the backing target and the plugin target. Both are typically created together and they share a lot of common details. Instead of creating them in different parts of the source tree, they are now specified together. The src/imports area has effectively been absorbed into the other corresponding subdirectories below src with this change. Task-number: QTBUG-91621 Change-Id: I9bd32e9eb78c198ccc9db04e2829303cac323502 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Remove GENERATE_METATYPES usageMaximilian Goldstein2021-04-271-1/+0
| | | | | | | We now generate metatypes by default and every instance of GENERATE_METATYPES now causes a warning. Change-Id: I691d0a3973c47cab666bd4ca948b2afe047ee13f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Fix qml module version to use the repo project versionAlexandru Croitor2021-04-151-1/+1
| | | | | | | | | | | Use PROJECT_VERSION instead of CMAKE_PROJECT_VERSION, so that the repo project version is used in a top-level build, rather than the version of the qt5 project. Pick-to: 6.1 6.0 Task-number: QTBUG-92861 Change-Id: Ifd12d6309f358b9b72372a5c069141ecb7322bc7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove QMake project filesJoerg Bornemann2021-02-111-54/+0
| | | | | | | | | | This includes removal of the corresponding .prev_CMakeLists.txt files. Pick-to: 6.1 Task-number: QTBUG-88742 Change-Id: I4247294258629c92e80914518e9208019090c815 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-10-071-2/+2
| | | | | | | | Modify special case locations to use the new API as well. Task-number: QTBUG-86815 Change-Id: I4a690095fcd4b1141550de86b6820ae2dd579429 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Fix CMake buildMitch Curtis2020-08-261-0/+64
| | | | | | Task-number: QTBUG-82922 Change-Id: I75f4a553a6bb260f77bfa791f12fa42e80131e09 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Bump import version to 6.0Mitch Curtis2020-08-261-1/+1
| | | | | | Task-number: QTBUG-82922 Change-Id: I2eb924eaaaddbe75d342f59f5fb3cd30c4a84fef Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Register C++ types declarativelyMitch Curtis2020-08-2631-0/+4124
Adapt to the new way of registering C++ types. The types need to be seen at compile time so that code can be generated that invokes them. This patch: - Adds QML_* macros where applicable. - Adapts the build system files to the new way of registering modules. - Splits up the QtQuick.Controls[.*].impl files into their own plugins, as we can only register one QML module per .pro file. - Removes C++ type registration calls in every plugin. - Moves private types from src/quickcontrols2/quickcontrols2.pro to src/quickcontrols2/impl/quickcontrols2-impl.pro. Some of these types need to be exposed to QML, but quickcontrols2.pro is already in use to declare the QtQuick.Controls import (and also provides the public C++ QQuickStyle API), and the new QML_IMPORT_NAME/VERSION syntax only allows one module per project. As some of the types that need to be exposed to QML are also referenced by some C++ code (e.g. tests, etc.), we just move all of the private types to the new library. Follow-up patches will register the QML types declaratively. Task-number: QTBUG-82922 Change-Id: Iaf9ee106237d61701d57a8896f3822304c8151a6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>