aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Use qmlRegisterModuleImport() to register stylesMitch Curtis2020-08-265-310/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch completes the cumulative work done in previous patches. - Uses qmlRegisterModuleImport() to register styles. This has some added requirements: - Each style must now be a QML module -- that is, it must have a qmldir file. - As a result of the above, the module must be available within the QML import path in order to be found. - The various forms of accepted style names have been reduced down to one ("Material", "MyStyle", etc). See below for an explanation of why. - The following API in QQuickStyle is removed: addStylePath(), availableStyles(), path(), stylePathList(). These no longer make sense now that we reuse the existing QML import system. - Adds the tst_qquickstyleselector auto test back as "styleimports". qmlRegisterModuleImport() vs resolvedUrl() Previously we would use QQuickStyleSelector to select individual QML files based on which style was set. We'd do this once when QtQuick.Controls was first imported. With Qt 6, and the requirement that each style be a proper QML module, qmlRegisterModuleImport() was introduced. This allows us to "link" one import with another. For an example of what this looks like in practice, suppose the style was set to "MyStyle", and the fallback to "Material". The "QtQuick.Controls" import will be linked to "MyStyle", "MyStyle" to "QtQuick.Controls.Material", and as a final fallback (for controls like Action which only the Default style implements), "QtQuick.Controls.Material" to "QtQuick.Controls.Default". This is the same behavior as in Qt 5 (see qquickstyleselector.cpp): // 1) requested style (e.g. "MyStyle", included in d->selectors) // 2) fallback style (e.g. "Material", included in d->selectors) // 3) default style (empty selector, not in d->selectors) This is a necessary step to enable compilation of QML to C++. Reducing the set of accepted style names The problem In QtQuickControls2Plugin() we need to call QQuickStylePrivate::init(baseUrl()) in order to detect if the style is a custom style in QQuickStyleSpec::resolve() (by checking if the style path starts with the base URL). In Qt 5, init() is called in QtQuickControls2Plugin::registerTypes(), but in Qt 6 that's too late, because we need to call qmlRegisterModuleImport() in the constructor. qmlRegisterModuleImport() itself requires the style to have already been set in order to create the correct import URI ("QtQuick.Controls.X" for built-in styles, "MyCustomStyle" for custom styles). The solution By reducing the valid forms for style names down to one: ./myapp -style MyStyle we solve the problem of needing baseUrl() to determine if the style is a custom style or not, but needing to call it too early (since we now call qmlRegisterModuleImport() in QtQuickControls2Plugin(), which itself requires the style to have already been set). baseUrl() can't have been set before the constructor is finished. All of the various forms for _setting_ a style are still valid; environment variables, qtquickcontrols2.conf, etc. [ChangeLog][Important Behavior Changes] Custom styles must now have a qmldir that lists the files that the style implements. For example, for a style that only implements Button: --- module MyStyle Button 1.0 Button.qml --- In addition, there is now only one valid, case-sensitive form for style names: "Material", "MyStyle", etc. These changes are done to help enable the compilation of QML code to C++, as well as improve tooling capabilities. [ChangeLog][Important Behavior Changes] The following API was removed: - QQuickStyle::addStylePath() - QQuickStyle::availableStyles() - QQuickStyle::path() - QQuickStyle::stylePathList() - QT_QUICK_CONTROLS_STYLE_PATH This API is no longer necessary and/or able to be provided now that styles are treated as regular QML modules. Task-number: QTBUG-82922 Change-Id: I3b281131903c7c3c1cf0616eb7486a872dccd730 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Register C++ types declarativelyMitch Curtis2020-08-2635-4003/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Move Default style out into its own pluginMitch Curtis2020-08-263-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In upcoming patches, we start registering C++ types declaratively. A condition of doing so requires that each .pro corresponds to one QML module. This conflicts with the QtQuick.Controls import, which currently does quite a lot: - Registers (and selects) QML files for the style that was set - Registers private C++ utility types (such as IconLabel) that are useful for all styles under the QtQuick.Controls.impl import - Registers private C++ types that are only useful for the Default style (such as BusyIndicatorImpl). The reason it does so much can probably be explained by the intended usage of Qt Quick Controls 2; when you do import QtQuick.Controls 2.0 you get access to the QML types (e.g. Button) that the style you're using provides. So if you're using the Material style, you'll get a Material style button. API-wise, the button is identical to any other button, because the types in QtQuick.Templates are what we advertise as the public API. If we didn't have this functionality, users would need to import specific style imports to use controls, and the convenience of being able to simply start the application with a different style by e.g. passing an application argument would be lost. To support declarative registration of types while also supporting the existing use cases, we split out the Default-style-specific stuff into a QtQuick.Controls.Default import. Task-number: QTBUG-82922 Change-Id: Ib4f1620cae78d7acdc13d9ac0752a020bc22f3ea Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Stop using resolvedUrl() to resolve QML filesMitch Curtis2020-08-266-365/+9
| | | | | | | | | | | | | | | | | | | | This is necessary to move away from imperative type registration of QML files (i.e. qmlRegisterType()). A later patch will use qmlRegisterModuleImport() to register the QtQuick.Controls import with the style set by the user, which will require each style to have a qmldir listing the files that it provides. Note that some plugins still register QML files, but these registrations will have to stay for now until we can split out "impl" plugins in later patches where those files can be registered. tst_qquickstyleselector will be added back in some other form in a follow-up patch. Task-number: QTBUG-82922 Change-Id: I8182533d9912ed493efda6eb91c69fc064af07ee Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Adapt to renaming of QQmlMetaType::isModule()Ulf Hermann2020-06-301-2/+4
| | | | | | Change-Id: I2db7915377caec6c80e04979a5813c605ae33e09 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Add ; to Q_UNUSEDLars Schmertmann2020-06-301-1/+1
| | | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I92ef02ede041d3965151165a479a1ea0549cc0f9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use QList instead of QVectorJarek Kobus2020-06-091-1/+1
| | | | | | Task-number: QTBUG-84469 Change-Id: Ic36741d2bcaec8d5e5dc96638b7122f8ce51bdb2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* CMake: Regenerate configure.cmake filesAlexandru Croitor2020-06-041-5/+12
| | | | | | | This will show the usual configure summary reports. Change-Id: I38dcbbed8e20e382be5c4271e2d6f90de100d180 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Adapt to geometryChanged => geometryChange renamingMitch Curtis2020-04-248-14/+14
| | | | | | Task-number: QTBUG-82994 Change-Id: Iaf530d2a6f4dc92641d0c10e16e7b931f90646ac Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2020-03-175-10/+62
|\ | | | | | | Change-Id: Ieb9bcfba9651d646509afd065ce2389ef74448cc
| * Adapt to plugin unloading changesMitch Curtis2020-03-124-4/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of c2081016e in qtdeclarative, plugins are no longer unloaded on macOS, and QQmlExtensionPlugin::unregisterTypes() should be used instead. This patch: - Moves everything that was done in destructors to unregisterTypes(). - Ensures that the style selector is destroyed in QQuickStylePlugin::unregisterTypes() so that previous styles that were set do not stick around after qmlClearTypeRegistrations() is called. This ensures that runtime style-switching continues to work. - Adds more logging output to make it easier to diagnose issues in the future. - Adds more code comments to ease maintenance. Change-Id: Ibbfeba4501d6ba0d5a257dcceace3498904a816e Fixes: QTBUG-82811 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * Fix build failures as a result of QMetaType changes in qtbaseAlexandru Croitor2020-03-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | moc now stores the QMetaType of properties as a result of 46f407126ef3e94d59254012cdc34d6a4ad2faf2 in qtbase, which requires full type information about the property type inside the moc generated source file. Many of the property types were forward-declared, and this resulted in build errors like "invalid application of 'sizeof' to an incomplete type 'QQuickTransition'" Make sure to explicitly include the moc files inside the counterpart .cpp files, so that full information is available from included headers. Fixes: QTBUG-82774 Change-Id: I5971713864992398daed72ce9f6ab866668cf8e1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * Merge remote-tracking branch 'origin/5.15' into devSimon Hausmann2020-03-101-3/+10
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/imports/controls/qtquickcontrols2plugin.cpp Change-Id: Ifc09ea9f71fdba119fe8eed99f0bdcb402444f27
| | * Use Qt::SplitBehavior in preference to QString::SplitBehaviorEdward Welbourne2020-03-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The Qt version was added in 5.14 "for use as eventual replacement for QString::SplitBehavior." Move another step closer to that goal. Change-Id: I3ed1abd00bf54da654c9ccade427f5756b99b595 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| | * Follow QML2_IMPORT_PATH in path searchDavid Edmundson2020-01-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When searching for styles we include QLibraryInfo::Qml2ImportsPath so it makes sense to continue that to also include the runtime QML2_IMPORT_PATH when searching for QQC2 themes. It used to be included, but in 5.14 this behavior changed as a result of 7db4df2deca52a30b4c068abd4683a1720cf281e, so this line is restored. Change-Id: I185b29b323d870fc724e655104eaf42034707738 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| | * Look for the fallback style in all of the style pathsAndy Shaw2020-01-271-1/+7
| | | | | | | | | | | | | | | | | | | | | Fixes: QTBUG-81216 Change-Id: I9d3efeec7f9ec2beda24ff74e39d04104f5eb967 Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * | Fix build with latest qtdeclarativeSimon Hausmann2020-02-131-2/+2
| |/ | | | | | | | | | | | | | | | | | | Commit 789929f939a60462373beae37ab4373809095cff in qtdeclarative introduced QTypeRevision and changed internal API that's used here. Change-Id: I994084a26ac15a1795fd5d5add46113e3571402f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * Include the Android specific path for the importsAndy Shaw2019-11-151-2/+7
| | | | | | | | | | | | | | | | | | | | | | androiddeployqt will put all the files originally in the assets into a rcc file now instead of having them copied over as before. Therefore the styles need to be searched for in that path to see if they exist. Fixes: QTBUG-79952 Change-Id: Ief8fc59257d3b329dd8b5b28190433e1b1a7f12d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeLeander Beernaert2019-11-255-5/+6
|\| | | | | | | Change-Id: I61919fabd4a3a07ed374f2c3c1fae2d589d6e124
| * Adapt Tumbler after ListView changesv5.14.0-beta2Mitch Curtis2019-10-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After 2d9cf3ef, ListView now changes the currentIndex for some unknown reason. The changes clearly didn't cause any failures in Qt Quick's auto tests, but some Tumbler auto tests fail. Presumably, the failures are due to TumblerView's intimate usage of Qt Quick's C++ API, where it creates either a PathView or a ListView on demand internally. From what I could see, the currentIndex change was caused by this code: if (FxViewItem *snapItem = d->snapItemAt(d->highlight->position())) { if (snapItem->index >= 0 && snapItem->index != d->currentIndex) d->updateCurrent(snapItem->index); } So I worked around the issue by delaying the call to setHighlightRangeMode() until after the delegate has been created. I also tried moving the call to setSnapMode() (which seems very relevant given the context), but it caused test failures. Change-Id: I7017760c21193dc6ce8181669ba7cf047b18dfba Fixes: QTBUG-79150 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * Minor performance improvements suggested by clang-tidyAlbert Astals Cid2019-10-074-4/+4
| | | | | | | | | | | | | | | | * Add const & to function parameters * Add const & to variables assigned from functions that return const & Change-Id: Ibf35e54ffb78f164493222125411f2ba279cb861 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Regenerate projects to be in syncAlexandru Croitor2019-11-151-3/+2
| | | | | | | | | | | | Change-Id: I3a57449c9025e22414b8337fcffdeb0f4d769af2 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2019-10-151-9/+9
|\| | | | | | | | | | | Removed dependencies.yaml. Change-Id: I1e2b3f486e9ace4bc8dc0419a64848990b3a6b39
| * Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-09-061-9/+9
| |\ | | | | | | | | | Change-Id: Ie9314e1a5daa20cee9d95a3c42873dbe515b3333
| | * Doc: Replace the "Qt Quick Controls 2" instancesVenugopal Shivashankar2019-08-221-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Now that Controls 1 is deprecated, it's ideal to use "Qt Quick Controls" instead of "Qt Quick Controls 2". Task-number: QTBUG-70333 Change-Id: Ie745db4b61071ddb5e06150d4e739cda74c59f41 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | | Update QtQuickControls2 project filesLeander Beernaert2019-10-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Re-run pro2cmake on all the project files. Change-Id: I8d349cf34d6cc8e26c76193d9ef220fa85b16bb8 Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | | Merge remote-tracking branch 'origin/wip/qt6' into wip/cmakeAlexandru Croitor2019-08-151-1/+1
|\| | | | | | | | | | | Change-Id: I62feb82fcf389bf83c92f83e2ed1a6783d3179ba
| * | Fix compilation with explicit QChar(*int*) ctorsMarc Mutz2019-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QChar ctors from integral non-char types are under consideration for adding explicit. Fix users of these ctors ahead of the change. Change-Id: I2d8f5276fe448ac2a3b3332e1b3773556ef9c676 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | Initial CMake conversion for QtQuickControls2Leander Beernaert2019-08-062-0/+94
|/ / | | | | | | | | | | | | | | The CMake setup only covers everything under the src directory. Tests and examples will follow in separate patches. Change-Id: Ic4dbf6efa3128d0eea3af99117ba87690cb51077 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* / Fix deprecation warning about qmlAttachedPropertiesObject()Friedemann Kleint2019-05-271-2/+2
|/ | | | | | | | Fix: quickattachedobject.cpp:52:103: warning: ‘QObject* QtQml::qmlAttachedPropertiesObject(int*, const QObject*, const QMetaObject*, bool)’ is deprecated [-Wdeprecated-declarations] Change-Id: I3579dfd0c45849c70403b6cd573493f0022c8ddd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQuickIcon: Add support to cache a pixmapMikhail Svetkin2019-01-221-0/+2
| | | | | | | [ChangeLog][Controls] Added cache property to icon. Change-Id: I9b3410e74ab8962d039939a8e005a2aff8e026cb Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add logging categories for Tumbler and TumblerViewMitch Curtis2018-12-171-0/+15
| | | | | | | | Both types are complex, so it helps having logging that can simply be turned on or off to aid debugging. Change-Id: Id90a8b48b949d17710e8e0882531a497e80aae8b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix QQuickIconLabel's baselineOffsetMitch Curtis2018-12-031-0/+3
| | | | | | | | | Set it to the bottom of the text if there is text. Change-Id: I03e14ec587e0868e1f2104dd464591b243ea9264 Fixes: QTBUG-71554 Reviewed-by: Pierre-Yves Siret <gr3cko@gmail.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix compilation with qreal=floatFriedemann Kleint2018-11-261-1/+2
| | | | | | | | Introduce casts where required. Fixes: QTBUG-71952 Change-Id: I63a99d6918bc00367439e967e3c45a733b41c482 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-081-1/+2
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I483081703594a8398d51a23c6d2266ac0ae9dfb0
| * QQuickIconImage: prevent color from being applied twiceMitch Curtis2018-07-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QQuickIconImage::componentComplete() calls QQuickIconImagePrivate::updateIcon(), which loads the icon's image via QQuickImageBase::load(). That eventually calls QQuickImageBase::requestFinished(), which calls QQuickIconImage::pixmapChange(). That then calls QQuickIconImagePrivate::updateFillMode(), which can in turn cause QQuickIconImage::pixmapChange() to be called again, causing recursion. This recursion resulted in icon.color being applied twice. We already have a recursion check in place in QQuickIconImagePrivate::updateFillMode(), so we can reuse that in QQuickIconImage::pixmapChange() to know whether or not we should apply the color to the image. Task-number: QTBUG-69506 Change-Id: I5cd9edaa524c7ceb9c41c53a9efefcc4c647e246 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-171-0/+63
|\| | | | | | | | | | | | | | | | | Conflicts: src/quickcontrols2/qquickstyle.cpp src/quicktemplates2/qquickscrollview.cpp tests/auto/qquickstyle/tst_qquickstyle.cpp Change-Id: I9afddf07a956f43cf0445e91b8d1a02f167b6bd5
| * Fix qrc paths in QT_QUICK_CONTROLS_STYLE_PATHMitch Curtis2018-07-161-2/+60
| | | | | | | | | | | | | | | | | | Parse the environment variable manually when the platform's list separator is ':', to avoid issues with qrc paths (which start with ':') not working. Task-number: QTBUG-68219 Change-Id: Ic71d49da5a72a37bc1d2e7b19fbf1de71b3917f3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Merge "Merge remote-tracking branch 'origin/5.11' into dev" into ↵Liang Qi2018-06-251-3/+3
|\ \ | | | | | | | | | refs/staging/dev
| * | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-06-251-3/+3
| |\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/controls/imagine/TextArea.qml src/imports/controls/imagine/TextField.qml tests/auto/controls/data/tst_tumbler.qml Change-Id: I25a8228a4299fb7a53db70b7223663a1637ed933
| | * Fix Tumbler not respecting currentIndex changes in onModelChangedMitch Curtis2018-06-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The use case in the referenced bug report looks something like this: Tumbler { model: 4 // ... onModelChanged: { currentIndex = model - 2; } } The problem was that setting currentIndex in onModelChanged would cause the wrap to change to true, which in turn caused the internal view to change to PathView. This would cause the currentIndex to be set to 0 on successive model changes (i.e ++model). By keeping track of whether or not the user set the currentIndex during a model change, we can ignore changes in the internal view's currentIndex and restore the user's currentIndex afterwards. Task-number: QTBUG-68737 Change-Id: I25738f36cf58a331d1b8e50b5029b4aa1dd27db5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | | QQuickStyle::addStylePath(): fix support for qrc pathsMitch Curtis2018-06-251-0/+2
|/ / | | | | | | | | | | | | | | The code lacked handling for the "qrc" scheme. Task-number: QTBUG-68222 Change-Id: Ia0dfdb748b8bdb40c893375b9de77bd8c05986b6 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | QQuickAttachedObject: use pimplJ-P Nurmi2018-05-232-67/+81
| | | | | | | | | | | | | | | | Preparing for making the functionality public for use in 3rdparty styles. Task-number: QTBUG-67062 Change-Id: I301c4567bdc75b5520d0ac11b91df04dda954227 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Create and init QQuickTheme from QtQuickControls2PluginJ-P Nurmi2018-05-222-55/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of creating and setting the QQuickTheme instance from each style plugin (e.g. QtQuickControls2MaterialStylePlugin), create the QQuickTheme instance in QtQuickControls2Plugin when the style is being resolved, and just pass the instance to be initialized by the style plugin(s). This avoids the problem that QQuickTheme API was virtual, and sub-classes created from plugins would have vtables destroyed before the QQuickTheme was destroyed. Task-number: QTBUG-67062 Task-number: QTBUG-68087 Change-Id: I19e9ced5296b708c2668c30163389cb3da6be7cf Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Rename QQuickTheme::current to instanceJ-P Nurmi2018-05-161-3/+3
| | | | | | | | | | | | | | | | Avoid giving a wrong impression that the theme instance could be changed on the fly. Change-Id: Ifb5078422385d2f15da6a416d89cc9d6f46b0f40 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickStylePlugin: use pimplJ-P Nurmi2018-05-162-17/+29
| | | | | | | | | | | | Task-number: QTBUG-67062 Change-Id: I3f7d81cbb4a0d8366b98eacf9cdbd64013b6ec47 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Move font/palette reading to QQuickStylePrivateJ-P Nurmi2018-05-163-83/+83
| | | | | | | | | | | | | | | | Instead of moving the code back and forth between different plugins, promote it to QQuickStylePrivate so it can be used from any plugin. Change-Id: Ifb80923750ff531676dc3347dacf0aff8c026fdb Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Fix external styles in static buildsJ-P Nurmi2018-05-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression caused by d2897a6c. For example, running a statically built Gallery example with the Material style resulted to: QQmlApplicationEngine failed to load component qrc:/gallery.qml:58 Type ApplicationWindow unavailable file:///path/to/QtQuick/Controls.2/Material/qmldir:-1 module "QtQuick.Controls.Material" plugin "qtquickcontrols2materialstyleplugin" not found Even if we install .qml files in static builds (so that people can copy them as a starting point from a Qt for iOS installation), those files must not be loaded in static builds. Previously this case was handled by the QT_STATIC guard in the former typeUrl(), but the special case was missed while taking QQuickStyleSelector into use for the internal types in d2897a6c. Change-Id: Ie4d7956c7eccb0f4e67b6f3a2b5368437636fa78 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickStylePlugin: prepare for Qt Quick CompilerJ-P Nurmi2018-05-122-14/+22
| | | | | | | | | | | | | | | | | | | | Don't hardcode the URL (QRC in static vs. FS in dynamic), but make use of QQuickFileSelector so the appropriate URL gets chosen "for free". This way, we can later add Qt Quick Compiler support for the internal QML files, such as CheckIndicator.qml. Change-Id: Ie1c55f3d82fbf92d0116966b354298338ef5ace6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>