Commit Graph

234 Commits

Author SHA1 Message Date
Mitch Curtis 23cad8990c Fix gallery example defaulting to Basic instead of the platform default
The example used to default to the Default style, and when that was
renamed to Basic and the default style behavior changed, we forgot to
adapt the style property in the QML Settings instance.

We should now not set any value as a default, and instead ensure that
the style is set on the QSettings in C++.

Pick-to: 6.1 6.0
Change-Id: Ia8654f28ae6adc9171d667c2c5c3603a15251cab
Fixes: QTBUG-91989
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-03-24 09:20:59 +01:00
Mitch Curtis 885abf6147 Fix build of some examples on Windows
ba2da7d745 fixed the build of some
examples when cross-compiling, but for whatever reason it breaks
regular builds on Windows.

This patch makes that fix more specific in the environments it affects.

Fixes: QTBUG-89290
Pick-to: 6.0
Change-Id: I5356a855e3b6f9c27ba05beb9dc11dc32920c6c5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-12-10 10:54:58 +00:00
Joerg Bornemann ba2da7d745 CMake: Make QT_BUILD_EXAMPLES build work with boot2qt
Work around QTBUG-86533 by adding explicit dependencies to
QuickTemplates2.

Change-Id: I293e6db652cbd6c7a699f778c0d45c6c1fd9bdc9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-12-03 17:52:45 +01:00
Andreas Buhr b5b36db63a Fix documentation links to High DPI documentation
The documentation on High DPI was recently rewritten, renaming
several sections. This patch fixes the links which were broken
by this change.

Task-number: QTBUG-88533
Pick-to: 6.0
Change-Id: Iae9f38d722a267ba5b21db6f2ef7394a6c675d4f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-12-01 15:48:55 +01:00
Mitch Curtis 71249db0cb gallery: don't store QQuickStyle::name() in settings on startup
It's no longer empty if not specified, so just skip that step
altogether. Add the desktop styles to the list of selectable styles,
but only on the correct platforms. Only set the style at startup if it
wasn't specified via QT_QUICK_CONTROLS_STYLE. I tried to detect if a
-style application argument was passed, but it doesn't show up in the
list of arguments.

Change-Id: I7c216372580a012693b7a01d138d79c8d46afe66
Fixes: QTBUG-88955
Pick-to: 6.0 6.0.0
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-11-30 15:12:47 +01:00
Venugopal Shivashankar 4fac3dd5b5 Doc: Drop the \excludefromcreator meta tag
The example does not depend on the
Qt Graphical Effects module now.

Pick-to: 6.0 6.0.0
Change-Id: Ia69bc16738f5f52aaea828409ef73bf0c68e371e
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2020-11-24 09:51:01 +00:00
Mitch Curtis e783bb87b8 Remove glow effects from automotive example
For now there is no way to do this without writing them ourselves.
Since the effect was fairly subtle, we simply live without it for now.

Task-number: QTBUG-88202
Change-Id: Ic2556258461f657eddef3a597d928a7a0a7604c4
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-11-19 14:55:29 +01:00
Venugopal Shivashankar d220b4a8d0 Example: Drop "2" against "Qt Quick Controls" text
This should ensure that the examples give the same
message as the documentation. In addition,
dropped a phrase about Qt Quick Controls claiming
that it is designed for mobile and embedded. The
latest version of controls covers the entire spectrum.

Change-Id: Ia856fa47a6e6fc35f80bedc549378a00c7fbbc2a
Pick-to: 5.15
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2020-11-17 09:30:18 +00:00
Mitch Curtis d430281112 Doc: use correct casing for Material style name
Change-Id: Ia2d10b9fd27c8e83bfd8ed8ae021391ba1df50f1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-11-09 12:58:42 +01:00
Venugopal Shivashankar e3a31e9d1e Doc: Fix qdoc warnings
Mostly broken links to types and
properties that are either dropped or
renamed.

Task-number: QTBUG-88141
Fixes: QTBUG-88141
Change-Id: I44789cdd1b8560a967b0b3868fd637deef488d88
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2020-11-06 15:06:25 +01:00
Venugopal Shivashankar 749debe64f Doc: Drop the automotive example from Qt Creator welcome screen
The example depends on QtGraphicalEffects which is
not part of the 6.0 release.

Task-number: QTBUG-88202
Change-Id: If266a0965bc3ca288d2ef45e130232cb1571462b
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2020-11-06 12:23:28 +00:00
Volker Hilsheimer cde1a8a10b Get rid of all instance usage of QFontDatabase
All QFontDatabase APIs are static, use them accordingly.

Task-number: QTBUG-88114
Change-Id: Iae40e1354eaa6a6098a9fdbce9e237a9f498cc7d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2020-11-03 16:55:32 +01:00
Volker Hilsheimer ed92e44b61 Add includes to fix build errors in tests and examples
Change-Id: I47dcf16b1d207317985e303c626a121aa307704c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-10-31 16:19:20 +01:00
Mitch Curtis 8622862b00 Fix flatstyle example
Styles must now be proper QML modules; i.e. have a qmldir and be
available in the import path.

Fixes: QTBUG-87848
Change-Id: I07de491be31a24f2b07f68f389600450dc89561c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-30 12:04:22 +01:00
Alexandru Croitor edfb8943fc CMake: Regenerate examples to set the WIN32_EXECUTABLE property
As well as the MACOSX_BUNDLE properties as necessary.

Task-number: QTBUG-87664
Change-Id: I1113701f04a16b05b03fbb1a49f131c84659cdcb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-26 21:20:04 +01:00
Alexandru Croitor a4445cf2f7 CMake: Regenerate examples to use qt_add_executable
Task-number: QTBUG-87661
Change-Id: I0d26db40fdb7bd35c92c8fd970b60ec580acc0e0
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2020-10-20 09:13:34 +02:00
Mårten Nordheim 3a9f84fb37 Update QStringConverter usage
Following fa8d021fa6fcb040fb702b6ffd2deee52a3b748a

Change-Id: Ifa08b5e1bceecb8657ce528eb315c19fa34a1e1f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-09 11:44:18 +02:00
Mitch Curtis 9219e86aa5 Rename "Default" style to "Basic"
[ChangeLog][Styles] The Default style was renamed to Basic to account
for the introduction of the platform styles (macOS, Windows), which
will be used by default (where possible) when no style is specified.

Fixes: QTBUG-85984
Task-number: QTBUG-68814
Task-number: QTBUG-86403
Change-Id: I22b3199c8662e4ee5d55a1be1a51c9856ac62376
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-09-24 13:48:49 +02:00
Volker Hilsheimer 153c0ee3c4 Fix more compiler warnings from deprecated application attributes
Also cleanup documentation, with the exception of the "High-DPI
Support in Qt Quick Controls" page, which needs to be either
removed or rewritten after some fact checking.

Change-Id: I3cdf1f8554f8f26627a9a5f17c2ee0038c933468
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2020-09-16 10:32:15 +02:00
Volker Hilsheimer 0e0f7c0b7b Fix compile warning from deprecated application attributes
AA_DisableHighDpiScaling and AA_UseHighDpiPixmaps have been deprecated.

As of 90358f6042d1fe2db849e17e1b0c875fb0560b20
and 2dc46c09026362cc267b1183faf09fb29479ef93 in qtbase, respectively,
these settings are deprecated and have no effect.

Change-Id: I1eb1f77a64893dd077bd08216d26633d43e1e0e3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-09-15 17:45:04 +02:00
Mitch Curtis bb33370005 Fix examples' usages of styles
After the type registration changes, importing a style explicitly
will cause that style's QML types to be used, so applications
should put style-specific code into file-selected directories if
they need to support multiple styles.

[ChangeLog][Important Behavior Changes] Due to the recent type
registration changes, importing a style explicitly (e.g.
"import QtQuick.Controls.Material") now registers that style's
QML types in addition to making its API (attached, singleton, etc.)
available. For this reason, it is now advised to have style-specific
code in a separate QML file and use file selectors if your application
supports more than one style. If your style only supports one style,
importing that style explicitly will work as expected.
For example, if you use Material.foreground in your QML code and your
application supports more than one style, you should refactor the code
that uses the binding into its own file; e.g.
+Material/MyComponent.qml.

Fixes: QTBUG-86263
Change-Id: I38e40ff4f20f61218550ad73945dafb912193466
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-09-10 12:31:45 +02:00
Mitch Curtis f872cdde21 Fix qdoc errors
Change-Id: I83f21bd6b780daa545c57d050d0f7562e8c0a4ff
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2020-09-03 15:12:43 +02:00
Mitch Curtis 501bc44bb0 Use qmlRegisterModuleImport() to register styles
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>
2020-08-26 11:46:07 +02:00
Mitch Curtis d451cab0c8 Remove all version numbers from QML imports
As of Qt 6, the latest version will be used by default. This saves us a
lot of effort in terms of version bumps.

Task-number: QTBUG-82922
Change-Id: I74eba8185ec3ccc75bc293d4b2ea87d59e2d9928
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-26 11:46:00 +02:00
Shawn Rutledge 0672882cab Support Markdown in the TextEditor example, including local paths
The example still loads an HTML file from resources by default, but now
it's possible to give either a relative or absolute file path on the
command line to load an html, markdown or plain text file. Alternatively
you can use the file dialog to load any of these types. We assume that
any resources (such as images) with relative paths are to be loaded from
the directory where the source text file is.

Pick-to: 5.15
Change-Id: I37bc2d6aa2306016453770dc2fd66efa41a16618
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2020-08-10 16:20:06 +02:00
Karsten Heimrich 602bffd346 Port QtQuickControls2 from QTextCodec to QString{Converter|Decoder}
Task-number: QTBUG-75665
Change-Id: Ib66a260dc3bfc39e2e50c38db56ca72b8186a4ac
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-17 15:09:27 +02:00
Mitch Curtis 31fbd97b0e ApplicationWindow: remove deprecated overlay API
[ChangeLog][Controls][ApplicationWindow] The deprecated overlay
properties and attached API were removed. Use the Overlay attached type
instead.

Task-number: QTBUG-84715
Change-Id: I0781ea55ea502ffe5277385e82492291724d2090
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-06-08 15:44:27 +02:00
Alexandru Croitor b343fb40d7 CMake: Fix duplicate "gallery" target name
This fixes top-level builds that include qtquickcontrols2 to
configure successfully.

Change-Id: Ia90669ac66c65fc20e16ecbf15507f17a19053d8
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-06-04 22:27:43 +02:00
Mitch Curtis 0e18524a84 Remove Qt Labs Calendar
This is getting its own repository as part of the move to the
marketplace.

Task-number: QTBUG-84172
Pick-to: 5.15
Change-Id: I2f963c298d6ef95e0832f95aa1e1ea809f4867a2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-28 08:09:33 +02:00
Mitch Curtis 5a61d637e0 Reduce dependencies on QtGraphicalEffects
- Make QtGraphicalEffects optional in tests
- Mention that QtGraphicalEffects is required for relevant examples

Change-Id: I3ac7d06add931e0a10c3df7edc4e458ba5519c75
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-05-13 09:47:09 +02:00
Mitch Curtis 456d26e97e Remove bindings to parent in delegates
Until we've decided whether to a) document that properties of parent
should not be bound to in delegates or b) fix the warning that results
from doing so after 8c72e634b3,
we can pre-emptively clean up a few places where it happens.

Task-number: QTBUG-81976
Task-number: QTBUG-82393
Task-number: QTBUG-82989
Pick-to: 5.15
Change-Id: I1e610613f6016ec1b9cf9ca33cdfb15d384731a8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-05-11 15:57:59 +02:00
Samuli Piippo 014736755e Add special case for escaping quotes
<command-line>: warning: missing terminating " character
<command-line>: error: stray ‘\’ in program

Change-Id: Iab23419a707a105a9789b8d7af3740e320d54119
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-31 12:52:32 +03:00
Alexandru Croitor e558d0794b CMake: Regenerate projects
Change-Id: Ifd6b2289de6465a010f5f2a32789221767b4d5be
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-17 14:39:47 +00:00
Alexandru Croitor f52b95a96c Merge remote-tracking branch 'origin/dev' into wip/cmake
Change-Id: Ieb9bcfba9651d646509afd065ce2389ef74448cc
2020-03-17 09:54:04 +01:00
Alexandru Croitor 92dc998f6d Fix build failures as a result of QMetaType changes in qtbase
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>
2020-03-12 15:48:31 +01:00
Simon Hausmann 3f3e82fb05 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	src/imports/controls/qtquickcontrols2plugin.cpp

Change-Id: Ifc09ea9f71fdba119fe8eed99f0bdcb402444f27
2020-03-10 14:24:28 +01:00
Mitch Curtis b7bbde88d0 Gallery: simplify the code for the help feature
Use existing data from the model rather than adding new properties.

Change-Id: I77f9b079d4ceefd1a0b9936b4250c2470c68836e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-02-12 14:21:42 +01:00
Qt Forward Merge Bot 271fd0924e Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I4b20284eb05b6277c758a1ab5579b803db9a84ca
2020-02-08 03:04:16 +01:00
Friedemann Kleint 492586930b Gallery example: Add "Help" menu and shortcut
Add a property "control" identifying the control to be demo-ed
to the page and add a help shortcut and menu item displaying
its help.

Change-Id: Ic3c7c31f5a44fccd57ee018fd3681dc6bdffee58
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2020-01-10 10:04:09 +01:00
Liang Qi ec686af14f Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	.qmake.conf
	tests/auto/controls/data/tst_combobox.qml

Change-Id: I8471cdac4397f77a8e58140d58c6b50d3c437928
2019-12-30 11:44:50 +01:00
Mitch Curtis bcdd38074b clang-tidy: fix cppcoreguidelines-pro-type-member-init
Ensure that all members are initialized and remove an unused member.

Change-Id: Ibfb3ea86b7791cd6f8683b68e7cd3bc4256b33f7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-12-12 15:41:00 +01:00
Leander Beernaert 2bd4f5cd58 Merge remote-tracking branch 'origin/dev' into wip/cmake
Change-Id: I61919fabd4a3a07ed374f2c3c1fae2d589d6e124
2019-11-25 12:45:06 +00:00
Qt Forward Merge Bot 7207586f1a Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I647fa31fafdaea46c341c515f97b7f793ddf4b31
2019-11-16 03:01:14 +01:00
Alexandru Croitor 5e6bf7e22e Regenerate projects to be in sync
Change-Id: I3a57449c9025e22414b8337fcffdeb0f4d769af2
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-15 12:22:59 +00:00
Qt Forward Merge Bot 6cc7a3cf11 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I80f13e604dd492954c742e0ddaa7efa393776a62
2019-11-09 03:07:11 +01:00
Qt Forward Merge Bot cb182fb50e Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ib14b8c77cefe7aaf5b11483d9a30b2ef05314598
2019-11-09 03:07:01 +01:00
Mitch Curtis 17cc497f16 Run optipng on all images
find . -name "*.png" -exec optipng -o 7 -strip all {} \;

Change-Id: I2238b2dd38813d33ed48d79817f872f922cfa28d
Fixes: QTBUG-79275
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2019-11-04 13:31:34 +02:00
Qt Forward Merge Bot 20fe7e673f Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ida6e83517802b1e970f755b2e2128b77f08a8d11
2019-11-02 03:04:43 +01:00
Mitch Curtis e748ad35b5 texteditor: update links in html file
Change-Id: I7e3bd670039d181fb562967c5e9d3830f63d46a3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-24 11:08:56 +02:00
Qt Forward Merge Bot e96bd2160c Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I770f99d20878ddf16ab3f4b1a5422e7192622f64
2019-10-19 03:01:14 +02:00