aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2impl/qquickiconlabel.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove "2" from Qt Quick Controls directoriesMitch Curtis2022-12-011-614/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Qt Quick Controls 2 was named that way because it was a follow-up to Qt Quick Controls 1.x. Now that Qt Quick Controls 1 is no longer supported, we don't need to have "2" in the name. Work on this was already started for the documentation in 1abdfe5d5a052f2298b7bf657513dfa7e0c66a56. By doing this renaming a few weeks before feature freeze, it won't affect the release but still results in as little time possible spent manually fixing conflicts in cherry-picks from non-LTS releases as a result of the renaming. This patch does the following: - Renames directories. - Adapts CMakeLists.txt and other files to account for the new paths. A follow-up patch will handle documentation. It does not touch library names or other user-facing stuff, as that will have to be done in Qt 7. Task-number: QTBUG-95413 Change-Id: I170d8db19033ee71e495ff0c5c1a517a41ed7634 Reviewed-by: Mitch Curtis <[email protected]>
* Use SPDX license identifiersLucie Gérard2022-06-111-38/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <[email protected]>
* QuickControls2Impl: includemocsMarc Mutz2022-04-291-0/+2
| | | | | | | | | | | 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. Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-102948 Change-Id: If6f459ba6b7403a1703551fba571b0e1bdcf3b82 Reviewed-by: Mårten Nordheim <[email protected]>
* QQuickIcon: Resolve source URL relative to outermost property ownerYuya Nishihara2022-02-181-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 Pick-to: 6.2 6.3 Change-Id: Ibdd07118e79f1e1f36e1faea0289150eca734e27 Reviewed-by: Mitch Curtis <[email protected]>
* QQuickIconLabelPrivate: de-inline dtorMarc Mutz2022-01-251-0/+2
| | | | | | | | | | Pins the vtable to a single TU. See task for more details: Task-number: QTBUG-45582 Change-Id: I56bbc64fd632f1528714a3a48420cb7248888078 Reviewed-by: Fabian Kosmale <[email protected]>
* Use up-to date LGPL license headerKai Köhne2021-11-291-11/+14
| | | | | | | | Remove usages of outdated LGPL3 header that references LICENSES.LGPLv3 instead of LICENSES.LGPL3. Change-Id: If7a90ec18331a68491c5a740f131a5e7b3f37df4 Reviewed-by: Volker Hilsheimer <[email protected]>
* 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 <[email protected]> Reviewed-by: Mitch Curtis <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* Register C++ types declarativelyMitch Curtis2020-08-261-0/+642
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 <[email protected]>