aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick
diff options
context:
space:
mode:
authorOliver Eftevaag <oliver.eftevaag@qt.io>2021-02-09 18:06:54 +0100
committerOliver Eftevaag <oliver.eftevaag@qt.io>2021-02-23 13:49:51 +0100
commit454da9f721addad786f7e21c0a14f26edfef595a (patch)
treed41624b57acd30d9439d086d5b7b2be36633d66c /examples/quick
parenta0cb31ba18424ba2d4a918791401761802f8b6aa (diff)
Update window example to use QtQuickControls2
Replaces the use of custom made components from the shared directory, with QtQuickControls2 components. Fixes: QTBUG-90883 Change-Id: I6e659188aa75bfacf8181689f30580783bf280a2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'examples/quick')
-rw-r--r--examples/quick/window/AllScreens.qml10
-rw-r--r--examples/quick/window/CurrentScreen.qml54
-rw-r--r--examples/quick/window/Splash.qml4
-rw-r--r--examples/quick/window/window.qml28
4 files changed, 48 insertions, 48 deletions
diff --git a/examples/quick/window/AllScreens.qml b/examples/quick/window/AllScreens.qml
index 4050c09870..6f1a829410 100644
--- a/examples/quick/window/AllScreens.qml
+++ b/examples/quick/window/AllScreens.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,14 +48,14 @@
**
****************************************************************************/
-import QtQuick 2.3
-import "../shared" as Shared
+import QtQuick
+import QtQuick.Controls
Column {
id: root
spacing: 8
- Shared.Label {
+ Label {
text: "Total number of screens: " + screenInfo.count
font.bold: true
}
@@ -67,7 +67,7 @@ Column {
Repeater {
id: screenInfo
model: Qt.application.screens
- Shared.Label {
+ Label {
required property string name
required property int virtualX
required property int virtualY
diff --git a/examples/quick/window/CurrentScreen.qml b/examples/quick/window/CurrentScreen.qml
index df5e876b3d..0b6e681aac 100644
--- a/examples/quick/window/CurrentScreen.qml
+++ b/examples/quick/window/CurrentScreen.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.3
-import "../shared" as Shared
+import QtQuick
+import QtQuick.Controls
Item {
id: root
@@ -80,47 +80,47 @@ Item {
y: spacing
//! [screen]
- Shared.Label {
+ Label {
text: "Screen \"" + Screen.name + "\":"
font.bold: true
}
Item { width: 1; height: 1 } // spacer
- Shared.Label { text: "manufacturer" }
- Shared.Label { text: Screen.manufacturer ? Screen.manufacturer : "unknown" }
+ Label { text: "manufacturer" }
+ Label { text: Screen.manufacturer ? Screen.manufacturer : "unknown" }
- Shared.Label { text: "model" }
- Shared.Label { text: Screen.model ? Screen.model : "unknown" }
+ Label { text: "model" }
+ Label { text: Screen.model ? Screen.model : "unknown" }
- Shared.Label { text: "serial number" }
- Shared.Label { text: Screen.serialNumber ? Screen.serialNumber : "unknown" }
+ Label { text: "serial number" }
+ Label { text: Screen.serialNumber ? Screen.serialNumber : "unknown" }
- Shared.Label { text: "dimensions" }
- Shared.Label { text: Screen.width + "x" + Screen.height }
+ Label { text: "dimensions" }
+ Label { text: Screen.width + "x" + Screen.height }
- Shared.Label { text: "pixel density" }
- Shared.Label { text: Screen.pixelDensity.toFixed(2) + " dots/mm (" + (Screen.pixelDensity * 25.4).toFixed(2) + " dots/inch)" }
+ Label { text: "pixel density" }
+ Label { text: Screen.pixelDensity.toFixed(2) + " dots/mm (" + (Screen.pixelDensity * 25.4).toFixed(2) + " dots/inch)" }
- Shared.Label { text: "logical pixel density" }
- Shared.Label { text: Screen.logicalPixelDensity.toFixed(2) + " dots/mm (" + (Screen.logicalPixelDensity * 25.4).toFixed(2) + " dots/inch)" }
+ Label { text: "logical pixel density" }
+ Label { text: Screen.logicalPixelDensity.toFixed(2) + " dots/mm (" + (Screen.logicalPixelDensity * 25.4).toFixed(2) + " dots/inch)" }
- Shared.Label { text: "device pixel ratio" }
- Shared.Label { text: Screen.devicePixelRatio.toFixed(2) }
+ Label { text: "device pixel ratio" }
+ Label { text: Screen.devicePixelRatio.toFixed(2) }
- Shared.Label { text: "available virtual desktop" }
- Shared.Label { text: Screen.desktopAvailableWidth + "x" + Screen.desktopAvailableHeight }
+ Label { text: "available virtual desktop" }
+ Label { text: Screen.desktopAvailableWidth + "x" + Screen.desktopAvailableHeight }
- Shared.Label { text: "position in virtual desktop" }
- Shared.Label { text: Screen.virtualX + ", " + Screen.virtualY }
+ Label { text: "position in virtual desktop" }
+ Label { text: Screen.virtualX + ", " + Screen.virtualY }
- Shared.Label { text: "orientation" }
- Shared.Label { text: root.orientationToString(Screen.orientation) + " (" + Screen.orientation + ")" }
+ Label { text: "orientation" }
+ Label { text: root.orientationToString(Screen.orientation) + " (" + Screen.orientation + ")" }
- Shared.Label { text: "primary orientation" }
- Shared.Label { text: root.orientationToString(Screen.primaryOrientation) + " (" + Screen.primaryOrientation + ")" }
+ Label { text: "primary orientation" }
+ Label { text: root.orientationToString(Screen.primaryOrientation) + " (" + Screen.primaryOrientation + ")" }
//! [screen]
- Shared.Label { text: "10mm rectangle" }
+ Label { text: "10mm rectangle" }
Rectangle {
color: "red"
width: Screen.pixelDensity * 10
diff --git a/examples/quick/window/Splash.qml b/examples/quick/window/Splash.qml
index a6f70a59ef..cc520bd5a4 100644
--- a/examples/quick/window/Splash.qml
+++ b/examples/quick/window/Splash.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.0
+import QtQuick
//! [splash-properties]
Window {
diff --git a/examples/quick/window/window.qml b/examples/quick/window/window.qml
index 499c9935f7..74c4d94984 100644
--- a/examples/quick/window/window.qml
+++ b/examples/quick/window/window.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import "../shared" as Shared
+import QtQuick
+import QtQuick.Controls
QtObject {
id: root
@@ -67,20 +67,20 @@ QtObject {
anchors.margins: root.defaultSpacing
spacing: root.defaultSpacing
property real cellWidth: col.width / 3 - spacing
- Shared.Label { text: "Control the second window:" }
+ Label { text: "Control the second window:" }
Grid {
id: grid
columns: 3
spacing: root.defaultSpacing
width: parent.width
- Shared.Button {
+ Button {
id: showButton
width: col.cellWidth
text: root.testWindow.visible ? "Hide" : "Show"
onClicked: root.testWindow.visible = !root.testWindow.visible
}
//! [windowedCheckbox]
- Shared.CheckBox {
+ CheckBox {
text: "Windowed"
height: showButton.height
width: col.cellWidth
@@ -88,26 +88,26 @@ QtObject {
onClicked: root.testWindow.visibility = Window.Windowed
}
//! [windowedCheckbox]
- Shared.CheckBox {
+ CheckBox {
height: showButton.height
width: col.cellWidth
text: "Full Screen"
Binding on checked { value: root.testWindow.visibility === Window.FullScreen }
onClicked: root.testWindow.visibility = Window.FullScreen
}
- Shared.Button {
+ Button {
id: autoButton
width: col.cellWidth
text: "Automatic"
onClicked: root.testWindow.visibility = Window.AutomaticVisibility
}
- Shared.CheckBox {
+ CheckBox {
height: autoButton.height
text: "Minimized"
Binding on checked { value: root.testWindow.visibility === Window.Minimized }
onClicked: root.testWindow.visibility = Window.Minimized
}
- Shared.CheckBox {
+ CheckBox {
height: autoButton.height
text: "Maximized"
Binding on checked { value: root.testWindow.visibility === Window.Maximized }
@@ -131,7 +131,7 @@ QtObject {
}
return "unknown";
}
- Shared.Label {
+ Label {
id: visibilityLabel
text: "second window is " + (root.testWindow.visible ? "visible" : "invisible") +
" and has visibility " + parent.visibilityToString(root.testWindow.visibility)
@@ -160,7 +160,7 @@ QtObject {
Rectangle {
anchors.fill: parent
anchors.margins: root.defaultSpacing
- Shared.Label {
+ Label {
anchors.centerIn: parent
text: "Second Window"
}
@@ -168,7 +168,7 @@ QtObject {
anchors.fill: parent
onClicked: root.testWindow.color = "#e0c31e"
}
- Shared.Button {
+ Button {
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: root.defaultSpacing
@@ -181,7 +181,7 @@ QtObject {
root.testWindow.visibility = Window.FullScreen
}
}
- Shared.Button {
+ Button {
anchors.left: parent.left
anchors.top: parent.top
anchors.margins: root.defaultSpacing