aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/quickcontrols2/wearable/doc/src/qtquickcontrols2-wearable.qdoc208
-rw-r--r--examples/quickcontrols2/wearable/qml/Alarms/images/alarms.pngbin19340 -> 689 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/images/fitness.pngbin19110 -> 541 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/LauncherPage.qml18
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml2
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/navigation.pngbin0 -> 581 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/route.pngbin19411 -> 0 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/notifications.pngbin19625 -> 683 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/settings.pngbin19715 -> 703 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/weather.pngbin19281 -> 548 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/images/watch.pngbin19015 -> 0 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/images/worldclock.pngbin0 -> 601 bytes
-rw-r--r--examples/quickcontrols2/wearable/wearable.cpp2
-rw-r--r--examples/quickcontrols2/wearable/wearable.qrc4
-rw-r--r--src/imports/controls/ComboBox.qml1
-rw-r--r--src/imports/controls/Popup.qml2
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc4
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-index.qdoc42
-rw-r--r--src/imports/controls/material/ComboBox.qml1
-rw-r--r--src/imports/controls/material/Popup.qml2
-rw-r--r--src/imports/controls/universal/ComboBox.qml1
-rw-r--r--src/imports/controls/universal/Popup.qml2
-rw-r--r--src/imports/controls/universal/SwipeDelegate.qml1
-rw-r--r--src/quicktemplates2/qquickapplicationwindow.cpp14
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp4
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp8
-rw-r--r--src/quicktemplates2/qquickdial.cpp2
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp2
-rw-r--r--src/quicktemplates2/qquickoverlay.cpp2
-rw-r--r--src/quicktemplates2/qquickstackelement.cpp25
-rw-r--r--src/quicktemplates2/qquickstackelement_p_p.h4
-rw-r--r--src/quicktemplates2/qquickstackview.cpp46
-rw-r--r--src/quicktemplates2/qquickstackview_p.cpp28
-rw-r--r--src/quicktemplates2/qquickstackview_p_p.h7
-rw-r--r--src/quicktemplates2/qquickswipedelegate.cpp2
-rw-r--r--src/quicktemplates2/qquickswipeview.cpp1
-rw-r--r--tests/auto/controls/data/tst_stackview.qml20
-rw-r--r--tests/auto/controls/data/tst_swipedelegate.qml207
-rw-r--r--tests/auto/snippets/tst_snippets.cpp15
39 files changed, 403 insertions, 274 deletions
diff --git a/examples/quickcontrols2/wearable/doc/src/qtquickcontrols2-wearable.qdoc b/examples/quickcontrols2/wearable/doc/src/qtquickcontrols2-wearable.qdoc
index 4ae3233c..b56b4c1d 100644
--- a/examples/quickcontrols2/wearable/doc/src/qtquickcontrols2-wearable.qdoc
+++ b/examples/quickcontrols2/wearable/doc/src/qtquickcontrols2-wearable.qdoc
@@ -29,134 +29,144 @@
\example wearable
\title Qt Quick Controls 2 - Wearable Demo
\ingroup qtquickcontrols2-examples
- \brief A QML app using Qt Quick Controls 2 and demonstrating how to create a
- collection of wearable sub-apps using custom QML screens.
+ \brief Demonstrates an application launcher designed for wearable devices.
\image qtquickcontrols2-wearable.png
- The \e {Wearable} demo is a collection of sub-apps. Each sub-app is
- contained within its own .qml file, and integrated into \c LauncherMain.qml.
- The app demonstrates following \l {Qt Quick} features:
+ The \e {Wearable Demo} consists of an application launcher and a collection
+ of small and simple example applications aimed at wearable devices.
- \list
- \li Using custom types to create screens and screen controls.
- \li Using Qt Quick Controls 2 with namespace.
- \li Using layout components such as \l [QML] Column and \l [QML] Row
- \li Using XMLHttpRequest to load data from local files.
- \li Using PathView, \l [QML] Path, PathAttribute, and PathLine types to
- lay out UI elements.
- \endlist
-
- \section1 Creating the Main Window
+ \section1 Structure
- In \c wearable.qml, we use an ApplicationWindow to create the main application
- window:
+ The main .qml file \c wearable.qml consists of an ApplicationWindow, a StackView
+ for a stack-based navigation model, and buttons for interactive navigation.
\quotefromfile wearable/wearable.qml
- \skipto import "qml/Common"
- \printuntil visible
-
- This ApplicationWindow embeds a container that uses StackView for holding
- the launch screen for sub-apps. \c LauncherMain is an initial item on
- the stack view that represents Launcher sub-app. This \c MainContainer also
- has functionality to navigate back to home screen which is enabled when
- additional app screens are loaded in the StackView
-
- \quotefromfile wearable/qml/MainContainer.qml
- \skipto QQC2.StackView {
- \printuntil initialItem: LauncherMain {
-
- In LauncherMain, we use a ListModel type with \l ListElement types defined
- explicitly to hold information about the sub-apps:
- List elements are defined like other QML types except that they contain a
- collection of \e role definitions instead of properties. Roles define both
- how the data is accessed and include the data itself. For each list element,
- we use the \c icon role to specify the launch icon for the feature.
-
- \quotefromfile wearable/qml/LauncherMain.qml
- \skipto ListModel
- \printuntil page: "Settings/SettingsMain.qml"
+ \skipuntil import "qml/Style"
+ \printuntil id: window
+ \dots
+ \skipto header
+ \printuntil id: homeButton
+ \dots 8
+ \skipto onClicked
\printuntil }
+ \printuntil id: backButton
+ \dots 8
+ \skipto onClicked
+ \printuntil id: stackView
+ \dots 8
+ \skipuntil initialItem
+ \printuntil /^\}/
- \section1 Using Custom Types
+ \section1 Styling
- In the app, we use the following custom types that are each defined in a
- separate .qml file:
+ The demo uses a custom \l {Styling Qt Quick Controls 2}{Qt Quick Controls 2 style}
+ embedded into the demo's resources. Since the style is specific to this particular
+ demo, it only needs to implement a few controls. The style also provides a singleton
+ type that contains various styling attributes, such as fonts and colors.
\list
- \li \c WSlider.qml
- \li \c WSwitch.qml
+ \li \c qml/Style/PageIndicator.qml
+ \li \c qml/Style/Slider.qml
+ \li \c qml/Style/Switch.qml
+ \li \c qml/Style/UIStyle.qml
\endlist
- In each \c .qml file that uses the custom types, we add an import statement
- to include a directory called \e Common where the types are located:
+ The style is applied in \c main() in \c wearable.cpp:
- \quotefromfile wearable/qml/Settings/SettingsMain.qml
- \skipto Common
- \printuntil "
+ \snippet wearable/wearable.cpp style
- \section1 Main Screens for Sub-apps
+ The main benefit of using the built-in styling system is that the style selection
+ is fully transparent to the application code. There is no need to import a specific
+ folder that contains the styled controls. This way, the application can be run with
+ other styles too.
- In the demo, we use the following custom screen types that are each
- defined in a separate .qml file:
+ \section1 Custom Type
- \list
- \li \c AlarmsMain.qml
- \li \c FitnessMain.qml
- \li \c NavigationMain.qml
- \li \c NotificationsMain.qml
- \li \c SettingsMain.qml
- \li \c WatchFaceMain.qml
- \li \c WeatherMain.qml
- \li \c LauncherMain.qml
- \endlist
+ The demo application contains a custom button type implemented in \c qml/NaviButton.qml.
+ The navigation button is used as a home and back button in \c wearable.qml. \c NaviButton
+ extends the standard AbstractButton API with properties that control the slide in and slide
+ out transitions and the button image.
- Each sub-app also has its own JavaScript functions file that contains
- routines to help acquire data to be displayed on the screen. It also
- contains functions to help manipulate or convert the data. In some sub-apps
- data acquisition is implemented using XMLHttpRequest to read from local
- files. These files were generated by storing responses from remote servers
- in JSON format. This code can be easily modified to acquire data from remote
- servers.
- Sub-apps are implemented with an assumption of lack of any input capabilities
- of the device and they can be further enhanced based on what input methods
- or communication means are offered by the wearable device under consideration.
- Sub-apps use SwipeView as a container to display a set of pages within the
- app.
-
- \section1 Navigation App
-
- This sub-app displays a walking route from source to destination. This route
- is obtained as a response by invoking an API provided by
- \l {http://www.openstreetmap.org/}. The response is in JSON format and the
- corresponding JavaScript file associated with the app helps interpret the
- response. Currently, it is not possible to specify the source and destination
- from within the app but it can be easily added based on the device's
+ \quotefromfile wearable/qml/NaviButton.qml
+ \skipuntil import "Style"
+ \printuntil id: image
+ \dots 8
+ \skipuntil }
+ \printuntil background:
+ \dots 8
+ \skipto }
+ \printuntil /^\}/
+
+ \section1 Launcher Page
+
+ The application launcher, which is specified as the initial content above, is
+ implemented using a circular PathView in \c LauncherPage.qml. Each application is
+ contained within its own .qml file, which is listed in a ListModel on the launcher
+ page.
+
+ \quotefromfile wearable/qml/LauncherPage.qml
+ \skipto PathView
+ \printuntil signal launched
+ \dots
+ \skipto ListModel
+ \printuntil }
+ \dots 8
+ \printline ListElement
+ \skipto "Settings"
+ \printuntil delegate:
+ \dots 8
+ \skipto onClicked:
+ \printto path:
+ \dots
+ \skipto /^\}/
+ \printline }
+
+ \section1 Applications
+
+ The applications are designed for touch input based on what input methods
+ or communication means are typically offered by wearable devices.
+
+ Most applications have their own JavaScript files that act as dummy
+ application backends. They illustrate fetching external data and help
+ manipulating or converting the data. In the \c Navigation and \c Weather
+ applications, data acquisition is implemented using \l XMLHttpRequest to
+ read from local files. These files were generated by storing responses from
+ remote servers in JSON format. This code can be easily modified to acquire
+ data from real remote servers.
+
+ \section2 Navigation
+
+ This application displays a walking route from source to destination. This
+ route is obtained as a response by invoking an API provided by
+ \l {https://www.openstreetmap.org/}. The response is in JSON format and the
+ corresponding JavaScript file associated with the application helps interpret
+ the response. Currently, it is not possible to specify the source and destination
+ from within the application, but it can be easily added based on the device's
capabilities. For example, user input could be implemented as screens with
input fields, or can be communicated over Bluetooth/Wifi from a paired app
running on another device such as a smart phone or PC.
- \section1 Weather App
+ \section2 Weather
- This sub-app displays weather information for a day including temperature,
- sunrise-sunset info, air pressure, and so on. This information is obtained
+ This application displays weather information such as temperature, sunrise
+ and sunset times, air pressure, and so on. This information is obtained
as a response to invoking \l {https://openweathermap.org/}. The response is
- in JSON format and the corresponding JavaScript file associated
- with the app helps interpret the response. As with the Navigation sub-app
- this app can be modified by adding screens to accept location information to
- obtain weather data for a given location.
+ in JSON format and the corresponding JavaScript file associated with the
+ application helps interpret the response. As with the Navigation application,
+ this application can be modified by adding screens to accept location information
+ to obtain weather data for a given location.
- \section1 WatchFace App
+ \section2 World Clock
- This sub-app displays a world clock for different cities. As of now, the list
- of cities is hard-coded in the app but that can be changed based on the
- input capabilities of the device.
+ This application displays a world clock for different cities. As of now, the
+ list of cities is hard-coded in the application, but that can be changed based
+ on the input capabilities of the device.
- \section1 Other Sub-apps
+ \section2 Others
- Remaining sub-apps are implemented to return static data for now but they
- can be easily modified to process response data obtained from respective
- services.
+ The remaining applications return static data for now, but they can easily be
+ modified to process response data obtained from respective services.
\include examples-run.qdocinc
*/
diff --git a/examples/quickcontrols2/wearable/qml/Alarms/images/alarms.png b/examples/quickcontrols2/wearable/qml/Alarms/images/alarms.png
index 00ec663e..f38b3d4e 100644
--- a/examples/quickcontrols2/wearable/qml/Alarms/images/alarms.png
+++ b/examples/quickcontrols2/wearable/qml/Alarms/images/alarms.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/images/fitness.png b/examples/quickcontrols2/wearable/qml/Fitness/images/fitness.png
index a8789a61..80ec43cc 100644
--- a/examples/quickcontrols2/wearable/qml/Fitness/images/fitness.png
+++ b/examples/quickcontrols2/wearable/qml/Fitness/images/fitness.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/LauncherPage.qml b/examples/quickcontrols2/wearable/qml/LauncherPage.qml
index 6ff118df..34f117c4 100644
--- a/examples/quickcontrols2/wearable/qml/LauncherPage.qml
+++ b/examples/quickcontrols2/wearable/qml/LauncherPage.qml
@@ -68,12 +68,12 @@ PathView {
model: ListModel {
ListElement {
title: qsTr("World Clock")
- icon: "WorldClock/images/watch.png"
+ icon: "WorldClock/images/worldclock.png"
page: "WorldClock/WorldClockPage.qml"
}
ListElement {
title: qsTr("Navigation")
- icon: "Navigation/images/route.png"
+ icon: "Navigation/images/navigation.png"
page: "Navigation/NavigationPage.qml"
}
ListElement {
@@ -104,24 +104,24 @@ PathView {
}
delegate: QQC2.AbstractButton {
+ width: circularView.itemSize
+ height: circularView.itemSize
+
text: model.title
opacity: PathView.itemOpacity
+ padding: 12
contentItem: Image {
source: model.icon
fillMode: Image.Pad
- sourceSize.width: circularView.itemSize
- sourceSize.height: circularView.itemSize
+ sourceSize.width: parent.availableWidth
+ sourceSize.height: parent.availableHeight
}
background: Rectangle {
radius: width / 2
- color: "transparent"
-
border.width: 3
- border.color: parent.PathView.isCurrentItem ?
- "transparent"
- : UIStyle.colorQtGray4
+ border.color: parent.PathView.isCurrentItem ? UIStyle.colorQtPrimGreen : UIStyle.colorQtGray4
}
onClicked: {
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml b/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml
index bdc3e494..185f7986 100644
--- a/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml
@@ -72,7 +72,7 @@ Item {
Image {
anchors.verticalCenter: parent.verticalCenter
- source: "images/route.png"
+ source: "images/navigation.png"
fillMode: Image.PreserveAspectCrop
}
Text {
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/navigation.png b/examples/quickcontrols2/wearable/qml/Navigation/images/navigation.png
new file mode 100644
index 00000000..9b8cb8e6
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/navigation.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/route.png b/examples/quickcontrols2/wearable/qml/Navigation/images/route.png
deleted file mode 100644
index b8ac9d7e..00000000
--- a/examples/quickcontrols2/wearable/qml/Navigation/images/route.png
+++ /dev/null
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/notifications.png b/examples/quickcontrols2/wearable/qml/Notifications/images/notifications.png
index c5c3ffb2..bcbe85ef 100644
--- a/examples/quickcontrols2/wearable/qml/Notifications/images/notifications.png
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/notifications.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/settings.png b/examples/quickcontrols2/wearable/qml/Settings/images/settings.png
index c42f7dc6..093404f9 100644
--- a/examples/quickcontrols2/wearable/qml/Settings/images/settings.png
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/settings.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/weather.png b/examples/quickcontrols2/wearable/qml/Weather/images/weather.png
index 0530d47b..07bf8187 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/images/weather.png
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/weather.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/watch.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/watch.png
deleted file mode 100644
index 299858b7..00000000
--- a/examples/quickcontrols2/wearable/qml/WorldClock/images/watch.png
+++ /dev/null
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/worldclock.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/worldclock.png
new file mode 100644
index 00000000..91a70493
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/worldclock.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/wearable.cpp b/examples/quickcontrols2/wearable/wearable.cpp
index 5f96caf4..c50c95c4 100644
--- a/examples/quickcontrols2/wearable/wearable.cpp
+++ b/examples/quickcontrols2/wearable/wearable.cpp
@@ -56,7 +56,9 @@ int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
+ //! [style]
QQuickStyle::setStyle(QStringLiteral("qrc:/qml/Style"));
+ //! [style]
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/wearable.qml")));
diff --git a/examples/quickcontrols2/wearable/wearable.qrc b/examples/quickcontrols2/wearable/wearable.qrc
index a596fb63..6df0aa93 100644
--- a/examples/quickcontrols2/wearable/wearable.qrc
+++ b/examples/quickcontrols2/wearable/wearable.qrc
@@ -20,8 +20,8 @@
<file>qml/Navigation/images/end.png</file>
<file>qml/Navigation/images/leftturn.png</file>
<file>qml/Navigation/images/marker.png</file>
+ <file>qml/Navigation/images/navigation.png</file>
<file>qml/Navigation/images/rightturn.png</file>
- <file>qml/Navigation/images/route.png</file>
<file>qml/Navigation/images/start.png</file>
<file>qml/Navigation/images/straight.png</file>
<file>qml/Navigation/images/uturn.png</file>
@@ -62,6 +62,6 @@
<file>qml/WorldClock/images/swissnightdial.png</file>
<file>qml/WorldClock/images/swissnighthour.png</file>
<file>qml/WorldClock/images/swissnightminute.png</file>
- <file>qml/WorldClock/images/watch.png</file>
+ <file>qml/WorldClock/images/worldclock.png</file>
</qresource>
</RCC>
diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml
index b19b8e14..83492aef 100644
--- a/src/imports/controls/ComboBox.qml
+++ b/src/imports/controls/ComboBox.qml
@@ -35,7 +35,6 @@
****************************************************************************/
import QtQuick 2.9
-import QtQuick.Window 2.2
import QtQuick.Controls 2.3
import QtQuick.Controls.impl 2.3
import QtQuick.Templates 2.3 as T
diff --git a/src/imports/controls/Popup.qml b/src/imports/controls/Popup.qml
index e97aee52..7a94aaab 100644
--- a/src/imports/controls/Popup.qml
+++ b/src/imports/controls/Popup.qml
@@ -45,7 +45,7 @@ T.Popup {
implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentWidth > 0 ? contentHeight + topPadding + bottomPadding : 0)
+ contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0)
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
index 633fb217..c2b1e640 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
@@ -200,9 +200,9 @@
style will illustrate the elevation with a drop shadow; the higher the
elevation, the larger the shadow.
- The first step is to \l {Creating Qt Quick Projects}{create a new Qt Quick
+ The first step is to \l {Qt Creator: Creating Qt Quick Projects}{create a new Qt Quick
Controls 2 application} in Qt Creator. After that, we
- \l {Creating C++ Classes}{add a C++ type} that stores the elevation. Since
+ \l {Qt Creator: Creating C++ Classes}{add a C++ type} that stores the elevation. Since
the type will be used for every control supported by our style, and because
we may wish to add other attached properties later on, we'll call it
MyStyle. Here is \c MyStyle.h:
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
index 90d0c9d7..99b6c2ea 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
@@ -60,6 +60,48 @@
For more details, see \l {Getting Started with Qt Quick Controls 2}.
+ \section1 Versions
+
+ Qt Quick Controls 2.0 was released in Qt 5.7. Subsequent minor Qt releases
+ increment the import version of the Qt Quick Controls 2 modules by one. The
+ experimental Qt Labs modules use import version 1.0.
+
+ \table
+ \header
+ \li \c Qt
+ \li \l {Qt Quick QML Types}{\c QtQuick}
+ \li \l {Qt Quick Controls 2 QML Types}{\c QtQuick.Controls},\br
+ \l {Qt Quick Templates 2 QML Types}{\c QtQuick.Templates},
+ \li \l {Material Style}{\c QtQuick.Controls.Material},\br
+ \l {Universal Style}{\c QtQuick.Controls.Universal}
+ \li \l {Qt Labs Calendar QML Types}{\c Qt.labs.calendar},\br
+ \l {Qt Labs Platform QML Types}{\c Qt.labs.platform}
+ \row
+ \li 5.7
+ \li 2.7
+ \li 2.0
+ \li 2.0
+ \li 1.0
+ \row
+ \li 5.8
+ \li 2.8
+ \li 2.1
+ \li 2.1
+ \li 1.0
+ \row
+ \li 5.9
+ \li 2.9
+ \li 2.2
+ \li 2.2
+ \li 1.0
+ \row
+ \li ...
+ \li ...
+ \li ...
+ \li ...
+ \li ...
+ \endtable
+
\section1 Important Concepts in Qt Quick Controls 2
\list
diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml
index e86d9f4c..2d2a479e 100644
--- a/src/imports/controls/material/ComboBox.qml
+++ b/src/imports/controls/material/ComboBox.qml
@@ -35,7 +35,6 @@
****************************************************************************/
import QtQuick 2.9
-import QtQuick.Window 2.2
import QtQuick.Controls 2.3
import QtQuick.Templates 2.3 as T
import QtQuick.Controls.Material 2.3
diff --git a/src/imports/controls/material/Popup.qml b/src/imports/controls/material/Popup.qml
index e270b77d..49b39a6c 100644
--- a/src/imports/controls/material/Popup.qml
+++ b/src/imports/controls/material/Popup.qml
@@ -47,7 +47,7 @@ T.Popup {
implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentWidth > 0 ? contentHeight + topPadding + bottomPadding : 0)
+ contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0)
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml
index cf2a7e28..89391613 100644
--- a/src/imports/controls/universal/ComboBox.qml
+++ b/src/imports/controls/universal/ComboBox.qml
@@ -35,7 +35,6 @@
****************************************************************************/
import QtQuick 2.9
-import QtQuick.Window 2.2
import QtQuick.Controls 2.3
import QtQuick.Templates 2.3 as T
import QtQuick.Controls.Universal 2.3
diff --git a/src/imports/controls/universal/Popup.qml b/src/imports/controls/universal/Popup.qml
index 8c0b8d8f..f844d8e1 100644
--- a/src/imports/controls/universal/Popup.qml
+++ b/src/imports/controls/universal/Popup.qml
@@ -44,7 +44,7 @@ T.Popup {
implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentWidth > 0 ? contentHeight + topPadding + bottomPadding : 0)
+ contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0)
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
diff --git a/src/imports/controls/universal/SwipeDelegate.qml b/src/imports/controls/universal/SwipeDelegate.qml
index c737df35..60430d74 100644
--- a/src/imports/controls/universal/SwipeDelegate.qml
+++ b/src/imports/controls/universal/SwipeDelegate.qml
@@ -66,7 +66,6 @@ T.SwipeDelegate {
visible: control.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
- renderType: Text.NativeRendering
opacity: enabled ? 1.0 : 0.2
color: control.Universal.foreground
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp
index d49c9b0e..9b220a2b 100644
--- a/src/quicktemplates2/qquickapplicationwindow.cpp
+++ b/src/quicktemplates2/qquickapplicationwindow.cpp
@@ -638,6 +638,20 @@ void QQuickApplicationWindow::resetFont()
}
+/*!
+ \qmlproperty Locale QtQuick.Controls::ApplicationWindow::locale
+
+ This property holds the locale of the window.
+
+ The default locale depends on the system environment. You can set the
+ default locale by calling QLocale::setDefault(), before loading any QML.
+
+ ApplicationWindow propagates the locale to child controls. If you change
+ the window's locale, that locale propagates to all child controls in the
+ window, overriding the system default locale.
+
+ \sa Control::locale, {LayoutMirroring}{LayoutMirroring}
+*/
QLocale QQuickApplicationWindow::locale() const
{
Q_D(const QQuickApplicationWindow);
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 29fa5e55..786db55b 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -633,9 +633,7 @@ QQuickComboBox::QQuickComboBox(QQuickItem *parent)
QQuickComboBox::~QQuickComboBox()
{
- Q_D(QQuickComboBox);
- delete d->popup;
- d->popup = nullptr;
+ setPopup(nullptr);
}
/*!
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index c707aede..4adf80e0 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -802,14 +802,14 @@ void QQuickControl::resetSpacing()
\qmlproperty Locale QtQuick.Controls::Control::locale
This property holds the locale of the control.
+
It contains locale specific properties for formatting data and numbers.
Unless a special locale has been set, this is either the parent's locale
or the default locale.
- Control propagates explicit locale properties from parent to children.
- If you change a specific property on a control's locale, that property
- propagates to all of the control's children, overriding any system defaults
- for that property.
+ Control propagates the locale from parent to children. If you change the
+ control's locale, that locale propagates to all of the control's children,
+ overriding the system default locale.
\sa mirrored, {LayoutMirroring}{LayoutMirroring}
*/
diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp
index 198bd631..24a8df01 100644
--- a/src/quicktemplates2/qquickdial.cpp
+++ b/src/quicktemplates2/qquickdial.cpp
@@ -521,7 +521,7 @@ void QQuickDial::setPressed(bool pressed)
The default value is \c true.
- \sa value, valueAt()
+ \sa value
*/
bool QQuickDial::live() const
{
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
index a912ba6a..f1971635 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox.cpp
+++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp
@@ -312,7 +312,7 @@ QQuickAbstractButton *QQuickDialogButtonBoxPrivate::createStandardButton(QPlatfo
QQmlContext *creationContext = delegate->creationContext();
if (!creationContext)
creationContext = qmlContext(q);
- QQmlContext *context = new QQmlContext(creationContext);
+ QQmlContext *context = new QQmlContext(creationContext, q);
context->setContextObject(q);
QObject *object = delegate->beginCreate(context);
diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp
index e3910509..c72979ae 100644
--- a/src/quicktemplates2/qquickoverlay.cpp
+++ b/src/quicktemplates2/qquickoverlay.cpp
@@ -80,7 +80,7 @@ static QQuickItem *createDimmer(QQmlComponent *component, QQuickPopup *popup, QQ
QQmlContext *creationContext = component->creationContext();
if (!creationContext)
creationContext = qmlContext(parent);
- QQmlContext *context = new QQmlContext(creationContext);
+ QQmlContext *context = new QQmlContext(creationContext, parent);
context->setContextObject(popup);
item = qobject_cast<QQuickItem*>(component->beginCreate(context));
}
diff --git a/src/quicktemplates2/qquickstackelement.cpp b/src/quicktemplates2/qquickstackelement.cpp
index 2744c3e9..a3bb840e 100644
--- a/src/quicktemplates2/qquickstackelement.cpp
+++ b/src/quicktemplates2/qquickstackelement.cpp
@@ -122,17 +122,30 @@ QQuickStackElement::~QQuickStackElement()
delete context;
}
-QQuickStackElement *QQuickStackElement::fromString(const QString &str, QQuickStackView *view)
+QQuickStackElement *QQuickStackElement::fromString(const QString &str, QQuickStackView *view, QString *error)
{
+ QUrl url(str);
+ if (!url.isValid()) {
+ *error = QStringLiteral("invalid url: ") + str;
+ return nullptr;
+ }
+
QQuickStackElement *element = new QQuickStackElement;
- element->component = new QQmlComponent(qmlEngine(view), QUrl(str), view);
+ element->component = new QQmlComponent(qmlEngine(view), url, view);
element->ownComponent = true;
return element;
}
-QQuickStackElement *QQuickStackElement::fromObject(QObject *object, QQuickStackView *view)
+QQuickStackElement *QQuickStackElement::fromObject(QObject *object, QQuickStackView *view, QString *error)
{
Q_UNUSED(view);
+ QQmlComponent *component = qobject_cast<QQmlComponent *>(object);
+ QQuickItem *item = qobject_cast<QQuickItem *>(object);
+ if (!component && !item) {
+ *error = QQmlMetaType::prettyTypeName(object) + QStringLiteral(" is not supported. Must be Item or Component.");
+ return nullptr;
+ }
+
QQuickStackElement *element = new QQuickStackElement;
element->component = qobject_cast<QQmlComponent *>(object);
element->item = qobject_cast<QQuickItem *>(object);
@@ -152,7 +165,7 @@ bool QQuickStackElement::load(QQuickStackView *parent)
if (status == QQmlComponent::Ready)
load(view);
else if (status == QQmlComponent::Error)
- qWarning() << qPrintable(component->errorString().trimmed());
+ QQuickStackViewPrivate::get(view)->warn(component->errorString().trimmed());
});
return true;
}
@@ -160,13 +173,13 @@ bool QQuickStackElement::load(QQuickStackView *parent)
QQmlContext *creationContext = component->creationContext();
if (!creationContext)
creationContext = qmlContext(parent);
- context = new QQmlContext(creationContext);
+ context = new QQmlContext(creationContext, parent);
context->setContextObject(parent);
QQuickStackIncubator incubator(this);
component->create(incubator, context);
if (component->isError())
- qWarning() << qPrintable(component->errorString().trimmed());
+ QQuickStackViewPrivate::get(parent)->warn(component->errorString().trimmed());
} else {
initialize();
}
diff --git a/src/quicktemplates2/qquickstackelement_p_p.h b/src/quicktemplates2/qquickstackelement_p_p.h
index 9cb11855..2308f47d 100644
--- a/src/quicktemplates2/qquickstackelement_p_p.h
+++ b/src/quicktemplates2/qquickstackelement_p_p.h
@@ -67,8 +67,8 @@ class QQuickStackElement : public QQuickItemViewTransitionableItem, public QQuic
public:
~QQuickStackElement();
- static QQuickStackElement *fromString(const QString &str, QQuickStackView *view);
- static QQuickStackElement *fromObject(QObject *object, QQuickStackView *view);
+ static QQuickStackElement *fromString(const QString &str, QQuickStackView *view, QString *error);
+ static QQuickStackElement *fromObject(QObject *object, QQuickStackView *view, QString *error);
bool load(QQuickStackView *parent);
void incubate(QObject *object);
diff --git a/src/quicktemplates2/qquickstackview.cpp b/src/quicktemplates2/qquickstackview.cpp
index a9922704..155f5f4d 100644
--- a/src/quicktemplates2/qquickstackview.cpp
+++ b/src/quicktemplates2/qquickstackview.cpp
@@ -39,6 +39,7 @@
#include "qquickstackelement_p_p.h"
#include "qquickstacktransition_p_p.h"
+#include <QtCore/qscopedvaluerollback.h>
#include <QtQml/qjsvalue.h>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlinfo.h>
@@ -474,8 +475,9 @@ QQuickItem *QQuickStackView::find(const QJSValue &callback, LoadBehavior behavio
void QQuickStackView::push(QQmlV4Function *args)
{
Q_D(QQuickStackView);
+ QScopedValueRollback<QString> rollback(d->operation, QStringLiteral("push"));
if (args->length() <= 0) {
- qmlWarning(this) << "push: missing arguments";
+ d->warn(QStringLiteral("missing arguments"));
args->setReturnValue(QV4::Encode::null());
return;
}
@@ -488,7 +490,8 @@ void QQuickStackView::push(QQmlV4Function *args)
if (lastArg->isInt32())
operation = static_cast<Operation>(lastArg->toInt32());
- QList<QQuickStackElement *> elements = d->parseElements(args);
+ QStringList errors;
+ QList<QQuickStackElement *> elements = d->parseElements(0, args, &errors);
// Remove any items that are already in the stack, as they can't be in two places at once.
for (int i = 0; i < elements.size(); ) {
QQuickStackElement *element = elements.at(i);
@@ -498,8 +501,13 @@ void QQuickStackView::push(QQmlV4Function *args)
++i;
}
- if (elements.isEmpty()) {
- qmlWarning(this) << "push: nothing to push";
+ if (!errors.isEmpty() || elements.isEmpty()) {
+ if (!errors.isEmpty()) {
+ for (const QString &error : qAsConst(errors))
+ d->warn(error);
+ } else {
+ d->warn(QStringLiteral("nothing to push"));
+ }
args->setReturnValue(QV4::Encode::null());
return;
}
@@ -557,10 +565,11 @@ void QQuickStackView::push(QQmlV4Function *args)
void QQuickStackView::pop(QQmlV4Function *args)
{
Q_D(QQuickStackView);
+ QScopedValueRollback<QString> rollback(d->operation, QStringLiteral("pop"));
int argc = args->length();
if (d->elements.count() <= 1 || argc > 2) {
if (argc > 2)
- qmlWarning(this) << "pop: too many arguments";
+ d->warn(QStringLiteral("too many arguments"));
args->setReturnValue(QV4::Encode::null());
return;
}
@@ -580,7 +589,7 @@ void QQuickStackView::pop(QQmlV4Function *args)
enter = d->findElement(item);
if (!enter) {
if (item != d->currentItem)
- qmlWarning(this) << "pop: unknown argument: " << value->toQString(); // TODO: safe?
+ d->warn(QStringLiteral("unknown argument: ") + value->toQString()); // TODO: safe?
args->setReturnValue(QV4::Encode::null());
d->elements.push(exit); // restore
return;
@@ -708,8 +717,9 @@ void QQuickStackView::pop(QQmlV4Function *args)
void QQuickStackView::replace(QQmlV4Function *args)
{
Q_D(QQuickStackView);
+ QScopedValueRollback<QString> rollback(d->operation, QStringLiteral("replace"));
if (args->length() <= 0) {
- qmlWarning(this) << "replace: missing arguments";
+ d->warn(QStringLiteral("missing arguments"));
args->setReturnValue(QV4::Encode::null());
return;
}
@@ -729,9 +739,15 @@ void QQuickStackView::replace(QQmlV4Function *args)
else if (!firstArg->isInt32())
target = d->findElement(firstArg);
- QList<QQuickStackElement *> elements = d->parseElements(args, target ? 1 : 0);
- if (elements.isEmpty()) {
- qmlWarning(this) << "replace: nothing to push";
+ QStringList errors;
+ QList<QQuickStackElement *> elements = d->parseElements(target ? 1 : 0, args, &errors);
+ if (!errors.isEmpty() || elements.isEmpty()) {
+ if (!errors.isEmpty()) {
+ for (const QString &error : qAsConst(errors))
+ d->warn(error);
+ } else {
+ d->warn(QStringLiteral("nothing to push"));
+ }
args->setReturnValue(QV4::Encode::null());
return;
}
@@ -968,12 +984,16 @@ void QQuickStackView::componentComplete()
QQuickControl::componentComplete();
Q_D(QQuickStackView);
+ QScopedValueRollback<QString> rollback(d->operation, QStringLiteral("initialItem"));
QQuickStackElement *element = nullptr;
+ QString error;
if (QObject *o = d->initialItem.value<QObject *>())
- element = QQuickStackElement::fromObject(o, this);
+ element = QQuickStackElement::fromObject(o, this, &error);
else if (d->initialItem.canConvert<QString>())
- element = QQuickStackElement::fromString(d->initialItem.toString(), this);
- if (d->pushElement(element)) {
+ element = QQuickStackElement::fromString(d->initialItem.toString(), this, &error);
+ if (!error.isEmpty()) {
+ d->warn(error);
+ } else if (d->pushElement(element)) {
emit depthChanged();
d->setCurrentItem(element);
element->setStatus(QQuickStackView::Active);
diff --git a/src/quicktemplates2/qquickstackview_p.cpp b/src/quicktemplates2/qquickstackview_p.cpp
index 89b3c6e3..c6f9291d 100644
--- a/src/quicktemplates2/qquickstackview_p.cpp
+++ b/src/quicktemplates2/qquickstackview_p.cpp
@@ -38,6 +38,7 @@
#include "qquickstackelement_p_p.h"
#include "qquickstacktransition_p_p.h"
+#include <QtQml/qqmlinfo.h>
#include <QtQml/qqmllist.h>
#include <QtQml/private/qv4qmlcontext_p.h>
#include <QtQml/private/qv4qobjectwrapper_p.h>
@@ -53,6 +54,15 @@ QQuickStackViewPrivate::QQuickStackViewPrivate()
{
}
+void QQuickStackViewPrivate::warn(const QString &error)
+{
+ Q_Q(QQuickStackView);
+ if (operation.isEmpty())
+ qmlWarning(q) << error;
+ else
+ qmlWarning(q) << operation << ": " << error;
+}
+
void QQuickStackViewPrivate::setCurrentItem(QQuickStackElement *element)
{
Q_Q(QQuickStackView);
@@ -80,7 +90,7 @@ static bool initProperties(QQuickStackElement *element, const QV4::Value &props,
return false;
}
-QList<QQuickStackElement *> QQuickStackViewPrivate::parseElements(QQmlV4Function *args, int from)
+QList<QQuickStackElement *> QQuickStackViewPrivate::parseElements(int from, QQmlV4Function *args, QStringList *errors)
{
QV4::ExecutionEngine *v4 = args->v4engine();
QV4::Scope scope(v4);
@@ -93,8 +103,9 @@ QList<QQuickStackElement *> QQuickStackViewPrivate::parseElements(QQmlV4Function
if (QV4::ArrayObject *array = arg->as<QV4::ArrayObject>()) {
int len = array->getLength();
for (int j = 0; j < len; ++j) {
+ QString error;
QV4::ScopedValue value(scope, array->getIndexed(j));
- QQuickStackElement *element = createElement(value);
+ QQuickStackElement *element = createElement(value, &error);
if (element) {
if (j < len - 1) {
QV4::ScopedValue props(scope, array->getIndexed(j + 1));
@@ -102,10 +113,13 @@ QList<QQuickStackElement *> QQuickStackViewPrivate::parseElements(QQmlV4Function
++j;
}
elements += element;
+ } else if (!error.isEmpty()) {
+ *errors += error;
}
}
} else {
- QQuickStackElement *element = createElement(arg);
+ QString error;
+ QQuickStackElement *element = createElement(arg, &error);
if (element) {
if (i < argc - 1) {
QV4::ScopedValue props(scope, (*args)[i + 1]);
@@ -113,6 +127,8 @@ QList<QQuickStackElement *> QQuickStackViewPrivate::parseElements(QQmlV4Function
++i;
}
elements += element;
+ } else if (!error.isEmpty()) {
+ *errors += error;
}
}
}
@@ -137,13 +153,13 @@ QQuickStackElement *QQuickStackViewPrivate::findElement(const QV4::Value &value)
return nullptr;
}
-QQuickStackElement *QQuickStackViewPrivate::createElement(const QV4::Value &value)
+QQuickStackElement *QQuickStackViewPrivate::createElement(const QV4::Value &value, QString *error)
{
Q_Q(QQuickStackView);
if (const QV4::String *s = value.as<QV4::String>())
- return QQuickStackElement::fromString(s->toQString(), q);
+ return QQuickStackElement::fromString(s->toQString(), q, error);
if (const QV4::QObjectWrapper *o = value.as<QV4::QObjectWrapper>())
- return QQuickStackElement::fromObject(o->object(), q);
+ return QQuickStackElement::fromObject(o->object(), q, error);
return nullptr;
}
diff --git a/src/quicktemplates2/qquickstackview_p_p.h b/src/quicktemplates2/qquickstackview_p_p.h
index ca610153..26d741f8 100644
--- a/src/quicktemplates2/qquickstackview_p_p.h
+++ b/src/quicktemplates2/qquickstackview_p_p.h
@@ -72,12 +72,14 @@ public:
return view->d_func();
}
+ void warn(const QString &error);
+
void setCurrentItem(QQuickStackElement *element);
- QList<QQuickStackElement *> parseElements(QQmlV4Function *args, int from = 0);
+ QList<QQuickStackElement *> parseElements(int from, QQmlV4Function *args, QStringList *errors);
QQuickStackElement *findElement(QQuickItem *item) const;
QQuickStackElement *findElement(const QV4::Value &value) const;
- QQuickStackElement *createElement(const QV4::Value &value);
+ QQuickStackElement *createElement(const QV4::Value &value, QString *error);
bool pushElements(const QList<QQuickStackElement *> &elements);
bool pushElement(QQuickStackElement *element);
bool popElements(QQuickStackElement *element);
@@ -91,6 +93,7 @@ public:
void setBusy(bool busy);
bool busy;
+ QString operation;
QVariant initialItem;
QQuickItem *currentItem;
QSet<QQuickStackElement*> removing;
diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp
index 7824708a..97a784b6 100644
--- a/src/quicktemplates2/qquickswipedelegate.cpp
+++ b/src/quicktemplates2/qquickswipedelegate.cpp
@@ -237,7 +237,7 @@ QQuickItem *QQuickSwipePrivate::createDelegateItem(QQmlComponent *component)
// the creation context will be null and we have to create it ourselves.
if (!creationContext)
creationContext = qmlContext(control);
- QQmlContext *context = new QQmlContext(creationContext);
+ QQmlContext *context = new QQmlContext(creationContext, control);
context->setContextObject(control);
QQuickItem *item = qobject_cast<QQuickItem*>(component->beginCreate(context));
if (item) {
diff --git a/src/quicktemplates2/qquickswipeview.cpp b/src/quicktemplates2/qquickswipeview.cpp
index 631869ef..d278beb7 100644
--- a/src/quicktemplates2/qquickswipeview.cpp
+++ b/src/quicktemplates2/qquickswipeview.cpp
@@ -182,6 +182,7 @@ void QQuickSwipeView::setInteractive(bool interactive)
}
/*!
+ \since QtQuick.Controls 2.2
\qmlproperty enumeration QtQuick.Controls::SwipeView::orientation
This property holds the orientation.
diff --git a/tests/auto/controls/data/tst_stackview.qml b/tests/auto/controls/data/tst_stackview.qml
index 5afd9687..c56a04de 100644
--- a/tests/auto/controls/data/tst_stackview.qml
+++ b/tests/auto/controls/data/tst_stackview.qml
@@ -339,6 +339,10 @@ TestCase {
ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":69:9: QML StackView: push: nothing to push")
compare(control.push(StackView.Immediate), null)
+ // unsupported type
+ ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":69:9: QML StackView: push: QtObject is not supported. Must be Item or Component.")
+ control.push(Qt.createQmlObject('import QtQml 2.0; QtObject { }', control))
+
// push(item)
var item1 = component.createObject(control, {objectName:"1"})
compare(control.push(item1, StackView.Immediate), item1)
@@ -435,6 +439,10 @@ TestCase {
ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":69:9: QML StackView: replace: nothing to push")
compare(control.replace(StackView.Immediate), null)
+ // unsupported type
+ ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":69:9: QML StackView: replace: QtObject is not supported. Must be Item or Component.")
+ compare(control.replace(Qt.createQmlObject('import QtQml 2.0; QtObject { }', control)), null)
+
// replace(item)
var item1 = component.createObject(control, {objectName:"1"})
compare(control.replace(item1, StackView.Immediate), item1)
@@ -907,14 +915,22 @@ TestCase {
var control = createTemporaryObject(stackView, testCase, {initialItem: component})
verify(control)
+ var error = Qt.resolvedUrl("non-existent.qml") + ":-1 No such file or directory"
+
ignoreWarning("QQmlComponent: Component is not ready")
- ignoreWarning(Qt.resolvedUrl("non-existent.qml") + ":-1 No such file or directory")
+ ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":69:9: QML StackView: push: " + error)
control.push(Qt.resolvedUrl("non-existent.qml"))
ignoreWarning("QQmlComponent: Component is not ready")
- ignoreWarning(Qt.resolvedUrl("non-existent.qml") + ":-1 No such file or directory")
+ ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":69:9: QML StackView: replace: " + error)
control.replace(Qt.resolvedUrl("non-existent.qml"))
+ ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":69:9: QML StackView: push: invalid url: x://[v]")
+ control.push("x://[v]")
+
+ ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":69:9: QML StackView: replace: invalid url: x://[v]")
+ control.replace("x://[v]")
+
control.pop()
}
diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml
index 413b7d53..c24f6962 100644
--- a/tests/auto/controls/data/tst_swipedelegate.qml
+++ b/tests/auto/controls/data/tst_swipedelegate.qml
@@ -119,29 +119,28 @@ TestCase {
}
}
- // Temporary solution to allow qt5 merge to go through; see: QTBUG-59536
-// function test_horizontalAnchors_data() {
-// return [
-// { tag: "background, fill", component: backgroundFillComponent, itemName: "background", warningLocation: ":69:25" },
-// { tag: "background, centerIn", component: backgroundCenterInComponent, itemName: "background", warningLocation: ":76:25" },
-// { tag: "background, left", component: backgroundLeftComponent, itemName: "background", warningLocation: ":83:25" },
-// { tag: "background, right", component: backgroundRightComponent, itemName: "background", warningLocation: ":90:25" },
-// { tag: "contentItem, fill", component: contentItemFillComponent, itemName: "contentItem", warningLocation: ":97:26" },
-// { tag: "contentItem, centerIn", component: contentItemCenterInComponent, itemName: "contentItem", warningLocation: ":104:26" },
-// { tag: "contentItem, left", component: contentItemLeftComponent, itemName: "contentItem", warningLocation: ":111:26" },
-// { tag: "contentItem, right", component: contentItemRightComponent, itemName: "contentItem", warningLocation: ":118:26" }
-// ];
-// }
+ function test_horizontalAnchors_data() {
+ return [
+ { tag: "background, fill", component: backgroundFillComponent, itemName: "background", warningLocation: ":69:25" },
+ { tag: "background, centerIn", component: backgroundCenterInComponent, itemName: "background", warningLocation: ":76:25" },
+ { tag: "background, left", component: backgroundLeftComponent, itemName: "background", warningLocation: ":83:25" },
+ { tag: "background, right", component: backgroundRightComponent, itemName: "background", warningLocation: ":90:25" },
+ { tag: "contentItem, fill", component: contentItemFillComponent, itemName: "contentItem", warningLocation: ":97:26" },
+ { tag: "contentItem, centerIn", component: contentItemCenterInComponent, itemName: "contentItem", warningLocation: ":104:26" },
+ { tag: "contentItem, left", component: contentItemLeftComponent, itemName: "contentItem", warningLocation: ":111:26" },
+ { tag: "contentItem, right", component: contentItemRightComponent, itemName: "contentItem", warningLocation: ":118:26" }
+ ];
+ }
-// function test_horizontalAnchors(data) {
-// var warningMessage = Qt.resolvedUrl("tst_swipedelegate.qml") + data.warningLocation
-// + ": QML : SwipeDelegate: cannot use horizontal anchors with " + data.itemName + "; unable to layout the item."
+ function test_horizontalAnchors(data) {
+ var warningMessage = Qt.resolvedUrl("tst_swipedelegate.qml") + data.warningLocation
+ + ": QML QQuickItem: SwipeDelegate: cannot use horizontal anchors with " + data.itemName + "; unable to layout the item."
-// ignoreWarning(warningMessage);
+ ignoreWarning(warningMessage);
-// var control = createTemporaryObject(data.component, testCase);
-// verify(control.contentItem);
-// }
+ var control = createTemporaryObject(data.component, testCase);
+ verify(control.contentItem);
+ }
Component {
id: greenLeftComponent
@@ -212,90 +211,90 @@ TestCase {
}
}
-// function test_settingDelegates() {
-// var control = createTemporaryObject(swipeDelegateComponent, testCase);
-// verify(control);
-
-// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
-// ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
-// control.swipe.behind = itemComponent;
-
-// // Shouldn't be any warnings when unsetting delegates.
-// control.swipe.left = null;
-// compare(control.swipe.leftItem, null);
-
-// // right is still set.
-// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
-// ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
-// control.swipe.behind = itemComponent;
-
-// control.swipe.right = null;
-// compare(control.swipe.rightItem, null);
-
-// control.swipe.behind = itemComponent;
-
-// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
-// ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
-// control.swipe.left = itemComponent;
-
-// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
-// ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
-// control.swipe.right = itemComponent;
-
-// control.swipe.behind = null;
-// control.swipe.left = greenLeftComponent;
-// control.swipe.right = redRightComponent;
-
-// // Test that the user is warned when attempting to set or unset left or
-// // right item while they're exposed.
-// // First, try the left item.
-// swipe(control, 0.0, 1.0);
-
-// var oldLeft = control.swipe.left;
-// var oldLeftItem = control.swipe.leftItem;
-// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
-// ":168:9: QML SwipeDelegate: left/right/behind properties may only be set when swipe.position is 0")
-// control.swipe.left = null;
-// compare(control.swipe.left, oldLeft);
-// compare(control.swipe.leftItem, oldLeftItem);
-
-// // Try the same thing with the right item.
-// swipe(control, 1.0, -1.0);
-
-// var oldRight = control.swipe.right;
-// var oldRightItem = control.swipe.rightItem;
-// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
-// ":168:9: QML SwipeDelegate: left/right/behind properties may only be set when swipe.position is 0")
-// control.swipe.right = null;
-// compare(control.swipe.right, oldRight);
-// compare(control.swipe.rightItem, oldRightItem);
-
-// // Return to the default position.
-// swipe(control, -1.0, 0.0);
-
-// tryCompare(control.background, "x", 0, 1000);
-
-// // Try the same thing with the behind item.
-// control.swipe.left = null;
-// verify(!control.swipe.left);
-// verify(!control.swipe.leftItem);
-// control.swipe.right = null;
-// verify(!control.swipe.right);
-// verify(!control.swipe.rightItem);
-// control.swipe.behind = greenLeftComponent;
-// verify(control.swipe.behind);
-// verify(!control.swipe.behindItem);
-
-// swipe(control, 0.0, 1.0);
-
-// var oldBehind = control.swipe.behind;
-// var oldBehindItem = control.swipe.behindItem;
-// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
-// ":168:9: QML SwipeDelegate: left/right/behind properties may only be set when swipe.position is 0")
-// control.swipe.behind = null;
-// compare(control.swipe.behind, oldBehind);
-// compare(control.swipe.behindItem, oldBehindItem);
-// }
+ function test_settingDelegates() {
+ var control = createTemporaryObject(swipeDelegateComponent, testCase);
+ verify(control);
+
+ ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
+ ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
+ control.swipe.behind = itemComponent;
+
+ // Shouldn't be any warnings when unsetting delegates.
+ control.swipe.left = null;
+ compare(control.swipe.leftItem, null);
+
+ // right is still set.
+ ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
+ ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
+ control.swipe.behind = itemComponent;
+
+ control.swipe.right = null;
+ compare(control.swipe.rightItem, null);
+
+ control.swipe.behind = itemComponent;
+
+ ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
+ ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
+ control.swipe.left = itemComponent;
+
+ ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
+ ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
+ control.swipe.right = itemComponent;
+
+ control.swipe.behind = null;
+ control.swipe.left = greenLeftComponent;
+ control.swipe.right = redRightComponent;
+
+ // Test that the user is warned when attempting to set or unset left or
+ // right item while they're exposed.
+ // First, try the left item.
+ swipe(control, 0.0, 1.0);
+
+ var oldLeft = control.swipe.left;
+ var oldLeftItem = control.swipe.leftItem;
+ ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
+ ":168:9: QML SwipeDelegate: left/right/behind properties may only be set when swipe.position is 0")
+ control.swipe.left = null;
+ compare(control.swipe.left, oldLeft);
+ compare(control.swipe.leftItem, oldLeftItem);
+
+ // Try the same thing with the right item.
+ swipe(control, 1.0, -1.0);
+
+ var oldRight = control.swipe.right;
+ var oldRightItem = control.swipe.rightItem;
+ ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
+ ":168:9: QML SwipeDelegate: left/right/behind properties may only be set when swipe.position is 0")
+ control.swipe.right = null;
+ compare(control.swipe.right, oldRight);
+ compare(control.swipe.rightItem, oldRightItem);
+
+ // Return to the default position.
+ swipe(control, -1.0, 0.0);
+
+ tryCompare(control.background, "x", 0, 1000);
+
+ // Try the same thing with the behind item.
+ control.swipe.left = null;
+ verify(!control.swipe.left);
+ verify(!control.swipe.leftItem);
+ control.swipe.right = null;
+ verify(!control.swipe.right);
+ verify(!control.swipe.rightItem);
+ control.swipe.behind = greenLeftComponent;
+ verify(control.swipe.behind);
+ verify(!control.swipe.behindItem);
+
+ swipe(control, 0.0, 1.0);
+
+ var oldBehind = control.swipe.behind;
+ var oldBehindItem = control.swipe.behindItem;
+ ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
+ ":168:9: QML SwipeDelegate: left/right/behind properties may only be set when swipe.position is 0")
+ control.swipe.behind = null;
+ compare(control.swipe.behind, oldBehind);
+ compare(control.swipe.behindItem, oldBehindItem);
+ }
function test_defaults() {
var control = createTemporaryObject(swipeDelegateComponent, testCase);
diff --git a/tests/auto/snippets/tst_snippets.cpp b/tests/auto/snippets/tst_snippets.cpp
index f870ec7d..cca85b0c 100644
--- a/tests/auto/snippets/tst_snippets.cpp
+++ b/tests/auto/snippets/tst_snippets.cpp
@@ -92,7 +92,7 @@ void tst_Snippets::initTestCase()
Q_DECLARE_METATYPE(QList<QQmlError>)
-static void loadAndShow(QQuickView *view, const QString &source)
+static void loadSnippet(QQuickView *view, const QString &source)
{
qRegisterMetaType<QList<QQmlError> >();
QSignalSpy warnings(view->engine(), SIGNAL(warnings(QList<QQmlError>)));
@@ -112,18 +112,13 @@ static void loadAndShow(QQuickView *view, const QString &source)
QVERIFY(view->rootObject());
QVERIFY(warnings.isEmpty());
-
- view->show();
- view->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(view));
}
void tst_Snippets::verify()
{
QFETCH(QString, input);
- loadAndShow(&view, input);
- QGuiApplication::processEvents();
+ loadSnippet(&view, input);
}
void tst_Snippets::verify_data()
@@ -140,7 +135,11 @@ void tst_Snippets::screenshots()
QFETCH(QString, input);
QFETCH(QString, output);
- loadAndShow(&view, input);
+ loadSnippet(&view, input);
+
+ view.show();
+ view.requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QSharedPointer<QQuickItemGrabResult> result = view.contentItem()->grabToImage();
QSignalSpy spy(result.data(), SIGNAL(ready()));