diff options
Diffstat (limited to 'examples')
72 files changed, 1084 insertions, 713 deletions
diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/BluetoothAlarmDialog.qml b/examples/bluetooth/heartrate_game/HeartRateGame/BluetoothAlarmDialog.qml index 3687b1331..16b4d32b3 100644 --- a/examples/bluetooth/heartrate_game/HeartRateGame/BluetoothAlarmDialog.qml +++ b/examples/bluetooth/heartrate_game/HeartRateGame/BluetoothAlarmDialog.qml @@ -52,7 +52,7 @@ Item { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter wrapMode: Text.WordWrap - font.pixelSize: GameSettings.mediumFontSize + font.pixelSize: GameSettings.smallFontSize color: GameSettings.textColor text: root.permissionError ? qsTr("Bluetooth permissions are not granted. Please grant the permissions in the system settings.") @@ -70,8 +70,8 @@ Item { Text { anchors.centerIn: parent color: GameSettings.textColor - font.pixelSize: GameSettings.bigFontSize - text: qsTr("Quit") + font.pixelSize: GameSettings.microFontSize + text: qsTr("QUIT") } } } diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/BottomLine.qml b/examples/bluetooth/heartrate_game/HeartRateGame/BottomLine.qml index caebc307e..80fdaa8cd 100644 --- a/examples/bluetooth/heartrate_game/HeartRateGame/BottomLine.qml +++ b/examples/bluetooth/heartrate_game/HeartRateGame/BottomLine.qml @@ -6,7 +6,6 @@ import QtQuick Rectangle { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom - width: parent.width * 0.85 + width: parent.width height: parent.height * 0.05 - radius: height*0.5 } diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/Connect.qml b/examples/bluetooth/heartrate_game/HeartRateGame/Connect.qml index ca8ef2923..ed5fb63d7 100644 --- a/examples/bluetooth/heartrate_game/HeartRateGame/Connect.qml +++ b/examples/bluetooth/heartrate_game/HeartRateGame/Connect.qml @@ -16,43 +16,39 @@ GamePage { errorMessage: deviceFinder.error infoMessage: deviceFinder.info + iconType: deviceFinder.icon + + Text { + id: viewCaption + anchors { + top: parent.top + topMargin: GameSettings.fieldMargin + connectPage.messageHeight + horizontalCenter: parent.horizontalCenter + } + width: parent.width - GameSettings.fieldMargin * 2 + height: GameSettings.fieldHeight + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + color: GameSettings.textColor + font.pixelSize: GameSettings.smallFontSize + text: qsTr("Found Devices") + } Rectangle { id: viewContainer - anchors.top: parent.top + anchors.top: viewCaption.bottom // only BlueZ platform has address type selection anchors.bottom: connectPage.connectionHandler.requiresAddressType ? addressTypeButton.top : searchButton.top - anchors.topMargin: GameSettings.fieldMargin + connectPage.messageHeight anchors.bottomMargin: GameSettings.fieldMargin anchors.horizontalCenter: parent.horizontalCenter width: parent.width - GameSettings.fieldMargin * 2 color: GameSettings.viewColor radius: GameSettings.buttonRadius - Text { - id: title - width: parent.width - height: GameSettings.fieldHeight - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - color: GameSettings.textColor - font.pixelSize: GameSettings.mediumFontSize - text: qsTr("FOUND DEVICES") - - BottomLine { - height: 1 - width: parent.width - color: "#898989" - } - } - ListView { id: devices - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.top: title.bottom + anchors.fill: parent model: connectPage.deviceFinder.devices clip: true @@ -76,22 +72,22 @@ GamePage { Text { id: device - font.pixelSize: GameSettings.smallFontSize + font.pixelSize: GameSettings.microFontSize text: box.modelData.deviceName anchors.top: parent.top - anchors.topMargin: parent.height * 0.1 - anchors.leftMargin: parent.height * 0.1 + anchors.topMargin: parent.height * 0.15 + anchors.leftMargin: parent.height * 0.15 anchors.left: parent.left color: GameSettings.textColor } Text { id: deviceAddress - font.pixelSize: GameSettings.smallFontSize + font.pixelSize: GameSettings.microFontSize text: box.modelData.deviceAddress anchors.bottom: parent.bottom - anchors.bottomMargin: parent.height * 0.1 - anchors.rightMargin: parent.height * 0.1 + anchors.bottomMargin: parent.height * 0.15 + anchors.rightMargin: parent.height * 0.15 anchors.right: parent.right color: Qt.darker(GameSettings.textColor) } @@ -114,19 +110,19 @@ GamePage { State { name: "public" PropertyChanges { - addressTypeText.text: qsTr("Public Address") + addressTypeText.text: qsTr("PUBLIC ADDRESS") } PropertyChanges { - connectPage.deviceHandler.addressType: DeviceHandler.PUBLIC_ADDRESS + connectPage.deviceHandler.addressType: DeviceHandler.PublicAddress } }, State { name: "random" PropertyChanges { - addressTypeText.text: qsTr("Random Address") + addressTypeText.text: qsTr("RANDOM ADDRESS") } PropertyChanges { - connectPage.deviceHandler.addressType: DeviceHandler.RANDOM_ADDRESS + connectPage.deviceHandler.addressType: DeviceHandler.RandomAddress } } ] @@ -134,8 +130,8 @@ GamePage { Text { id: addressTypeText anchors.centerIn: parent - font.pixelSize: GameSettings.tinyFontSize - color: GameSettings.textColor + font.pixelSize: GameSettings.microFontSize + color: GameSettings.textDarkColor } } @@ -151,9 +147,9 @@ GamePage { Text { anchors.centerIn: parent - font.pixelSize: GameSettings.tinyFontSize + font.pixelSize: GameSettings.microFontSize text: qsTr("START SEARCH") - color: searchButton.enabled ? GameSettings.textColor : GameSettings.disabledTextColor + color: GameSettings.textDarkColor } } } diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/GamePage.qml b/examples/bluetooth/heartrate_game/HeartRateGame/GamePage.qml index 249f94186..2d592cfdb 100644 --- a/examples/bluetooth/heartrate_game/HeartRateGame/GamePage.qml +++ b/examples/bluetooth/heartrate_game/HeartRateGame/GamePage.qml @@ -11,25 +11,65 @@ Item { property real messageHeight: msg.height property bool hasError: errorMessage != "" property bool hasInfo: infoMessage != "" + property int iconType: BluetoothBaseClass.IconNone + + function iconTypeToName(icon: int) : string { + switch (icon) { + case BluetoothBaseClass.IconNone: return "" + case BluetoothBaseClass.IconBluetooth: return "images/bluetooth.svg" + case BluetoothBaseClass.IconError: return "images/alert.svg" + case BluetoothBaseClass.IconProgress: return "images/progress.svg" + case BluetoothBaseClass.IconSearch: return "images/search.svg" + } + } Rectangle { id: msg - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right + anchors { + top: parent.top + left: parent.left + right: parent.right + topMargin: GameSettings.fieldMargin * 0.5 + leftMargin: GameSettings.fieldMargin + rightMargin: GameSettings.fieldMargin + } height: GameSettings.fieldHeight - color: page.hasError ? GameSettings.errorColor : GameSettings.infoColor + radius: GameSettings.buttonRadius + color: page.hasError ? GameSettings.errorColor : "transparent" visible: page.hasError || page.hasInfo + border { + width: 1 + color: page.hasError ? GameSettings.errorColor : GameSettings.infoColor + } + + Image { + id: icon + readonly property int imgSize: GameSettings.fieldHeight * 0.5 + anchors { + left: parent.left + leftMargin: GameSettings.fieldMargin * 0.5 + verticalCenter: parent.verticalCenter + } + visible: source.toString() !== "" + source: page.iconTypeToName(page.iconType) + sourceSize.width: imgSize + sourceSize.height: imgSize + fillMode: Image.PreserveAspectFit + } Text { id: error - anchors.fill: parent + anchors { + fill: parent + leftMargin: GameSettings.fieldMargin + icon.width + rightMargin: GameSettings.fieldMargin + icon.width + } horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter minimumPixelSize: 5 - font.pixelSize: GameSettings.smallFontSize + font.pixelSize: GameSettings.microFontSize fontSizeMode: Text.Fit - color: GameSettings.textColor + color: page.hasError ? GameSettings.textColor : GameSettings.infoColor text: page.hasError ? page.errorMessage : page.infoMessage } } diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/GameSettings.qml b/examples/bluetooth/heartrate_game/HeartRateGame/GameSettings.qml index 0fe854609..4032787ce 100644 --- a/examples/bluetooth/heartrate_game/HeartRateGame/GameSettings.qml +++ b/examples/bluetooth/heartrate_game/HeartRateGame/GameSettings.qml @@ -4,35 +4,49 @@ pragma Singleton import QtQuick -Item { +QtObject { property int wHeight property int wWidth // Colors - readonly property color backgroundColor: "#2d3037" - readonly property color buttonColor: "#202227" - readonly property color buttonPressedColor: "#6ccaf2" - readonly property color disabledButtonColor: "#555555" - readonly property color viewColor: "#202227" - readonly property color delegate1Color: Qt.darker(viewColor, 1.2) - readonly property color delegate2Color: Qt.lighter(viewColor, 1.2) + readonly property color lightGreenColor: "#80ebb6" + readonly property color backgroundColor: "#2c3038" + readonly property color buttonColor: "#2cde85" + readonly property color buttonPressedColor: lightGreenColor + readonly property color disabledButtonColor: "#808080" + readonly property color viewColor: "#262626" + readonly property color delegate1Color: "#262626" + readonly property color delegate2Color: "#404040" readonly property color textColor: "#ffffff" - readonly property color textDarkColor: "#232323" - readonly property color disabledTextColor: "#777777" - readonly property color sliderColor: "#6ccaf2" + readonly property color textDarkColor: "#0d0d0d" + readonly property color textInfoColor: lightGreenColor + readonly property color sliderColor: "#00414a" + readonly property color sliderBorderColor: lightGreenColor + readonly property color sliderTextColor: lightGreenColor readonly property color errorColor: "#ba3f62" - readonly property color infoColor: "#3fba62" + readonly property color infoColor: lightGreenColor + readonly property color titleColor: "#202227" + readonly property color selectedTitleColor: "#19545c" + readonly property color hoverTitleColor: Qt.rgba(selectedTitleColor.r, + selectedTitleColor.g, + selectedTitleColor.b, + 0.25) + readonly property color bottomLineColor: "#e6e6e6" + readonly property color heartRateColor: "#f80067" + + // All the fonts are given for the window of certain size. + // Resizing the window changes all the fonts accordingly + readonly property int defaultSize: 500 + readonly property real fontScaleFactor: Math.min(wWidth, wHeight) / defaultSize // Font sizes - property real microFontSize: hugeFontSize * 0.2 - property real tinyFontSize: hugeFontSize * 0.4 - property real smallTinyFontSize: hugeFontSize * 0.5 - property real smallFontSize: hugeFontSize * 0.6 - property real mediumFontSize: hugeFontSize * 0.7 - property real bigFontSize: hugeFontSize * 0.8 - property real largeFontSize: hugeFontSize * 0.9 - property real hugeFontSize: (wWidth + wHeight) * 0.03 - property real giganticFontSize: (wWidth + wHeight) * 0.04 + readonly property real microFontSize: 16 * fontScaleFactor + readonly property real tinyFontSize: 20 * fontScaleFactor + readonly property real smallFontSize: 24 * fontScaleFactor + readonly property real mediumFontSize: 32 * fontScaleFactor + readonly property real bigFontSize: 36 * fontScaleFactor + readonly property real largeFontSize: 54 * fontScaleFactor + readonly property real hugeFontSize: 128 * fontScaleFactor // Some other values property real fieldHeight: wHeight * 0.08 @@ -41,10 +55,6 @@ Item { property real buttonRadius: buttonHeight * 0.1 // Some help functions - function widthForHeight(h, ss) { - return h / ss.height * ss.width - } - function heightForWidth(w, ss) { return w / ss.width * ss.height } diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/Measure.qml b/examples/bluetooth/heartrate_game/HeartRateGame/Measure.qml index 48e84e762..04ebeb09a 100644 --- a/examples/bluetooth/heartrate_game/HeartRateGame/Measure.qml +++ b/examples/bluetooth/heartrate_game/HeartRateGame/Measure.qml @@ -11,10 +11,15 @@ GamePage { errorMessage: deviceHandler.error infoMessage: deviceHandler.info + iconType: deviceHandler.icon property real __timeCounter: 0 property real __maxTimeCount: 60 - property string relaxText: qsTr("Relax!\nWhen you are ready, press Start. You have %1s time to increase heartrate so much as possible.\nGood luck!").arg(__maxTimeCount) + + readonly property string relaxText: qsTr("Relax!") + readonly property string startText: qsTr("When you are ready,\npress Start.") + readonly property string instructionText: qsTr("You have %1s time to increase heart\nrate as much as possible.").arg(__maxTimeCount) + readonly property string goodLuckText: qsTr("Good luck!") signal showStatsPage @@ -55,6 +60,10 @@ GamePage { Rectangle { id: circle + + readonly property bool hintVisible: !measurePage.deviceHandler.measuring + readonly property real innerSpacing: Math.min(width * 0.05, 25) + anchors.horizontalCenter: parent.horizontalCenter width: Math.min(measurePage.width, measurePage.height - GameSettings.fieldHeight * 4) - 2 * GameSettings.fieldMargin @@ -63,30 +72,127 @@ GamePage { color: GameSettings.viewColor Text { - id: hintText - anchors.centerIn: parent - anchors.verticalCenterOffset: -parent.height * 0.1 + id: relaxTextBox + anchors { + bottom: startTextBox.top + bottomMargin: parent.innerSpacing + horizontalCenter: parent.horizontalCenter + } + width: parent.width * 0.6 + height: parent.height * 0.1 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - width: parent.width * 0.8 - height: parent.height * 0.6 - wrapMode: Text.WordWrap text: measurePage.relaxText - visible: !measurePage.deviceHandler.measuring + visible: circle.hintVisible color: GameSettings.textColor fontSizeMode: Text.Fit - minimumPixelSize: 10 - font.pixelSize: GameSettings.mediumFontSize + font.pixelSize: GameSettings.smallFontSize + font.bold: true } Text { - id: text - anchors.centerIn: parent - anchors.verticalCenterOffset: -parent.height * 0.15 - font.pixelSize: parent.width * 0.45 + id: startTextBox + anchors { + bottom: heart.top + bottomMargin: parent.innerSpacing + horizontalCenter: parent.horizontalCenter + } + width: parent.width * 0.8 + height: parent.height * 0.15 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: measurePage.startText + visible: circle.hintVisible + color: GameSettings.textColor + fontSizeMode: Text.Fit + font.pixelSize: GameSettings.tinyFontSize + } + + Text { + id: measureTextBox + anchors { + bottom: heart.top + horizontalCenter: parent.horizontalCenter + } + width: parent.width * 0.7 + height: parent.height * 0.35 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter text: measurePage.deviceHandler.hr visible: measurePage.deviceHandler.measuring + color: GameSettings.heartRateColor + fontSizeMode: Text.Fit + font.pixelSize: GameSettings.hugeFontSize + font.bold: true + } + + Image { + id: heart + anchors.centerIn: circle + width: parent.width * 0.2 + height: width + fillMode: Image.PreserveAspectFit + source: "images/heart.png" + smooth: true + antialiasing: true + + SequentialAnimation { + id: heartAnim + running: measurePage.deviceHandler.measuring + loops: Animation.Infinite + alwaysRunToEnd: true + PropertyAnimation { + target: heart + property: "scale" + to: 1.4 + duration: 500 + easing.type: Easing.InQuad + } + PropertyAnimation { + target: heart + property: "scale" + to: 1.0 + duration: 500 + easing.type: Easing.OutQuad + } + } + } + + Text { + id: instructionTextBox + anchors { + top: heart.bottom + topMargin: parent.innerSpacing + horizontalCenter: parent.horizontalCenter + } + width: parent.width * 0.8 + height: parent.height * 0.15 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: measurePage.instructionText + visible: circle.hintVisible color: GameSettings.textColor + fontSizeMode: Text.Fit + font.pixelSize: GameSettings.tinyFontSize + } + + Text { + id: goodLuckBox + anchors { + top: instructionTextBox.bottom + topMargin: parent.innerSpacing + horizontalCenter: parent.horizontalCenter + } + width: parent.width * 0.6 + height: parent.height * 0.1 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: measurePage.goodLuckText + visible: circle.hintVisible + color: GameSettings.textColor + fontSizeMode: Text.Fit + font.pixelSize: GameSettings.smallFontSize + font.bold: true } Item { @@ -101,14 +207,22 @@ GamePage { Text { anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter + width: parent.width * 0.35 + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter text: measurePage.deviceHandler.minHR color: GameSettings.textColor - font.pixelSize: GameSettings.hugeFontSize + fontSizeMode: Text.Fit + font.pixelSize: GameSettings.largeFontSize Text { anchors.left: parent.left anchors.bottom: parent.top - font.pixelSize: parent.font.pixelSize * 0.8 + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + width: parent.width + fontSizeMode: Text.Fit + font.pixelSize: GameSettings.mediumFontSize color: parent.color text: "MIN" } @@ -117,51 +231,27 @@ GamePage { Text { anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter + width: parent.width * 0.35 text: measurePage.deviceHandler.maxHR color: GameSettings.textColor - font.pixelSize: GameSettings.hugeFontSize + fontSizeMode: Text.Fit + font.pixelSize: GameSettings.largeFontSize Text { anchors.right: parent.right anchors.bottom: parent.top - font.pixelSize: parent.font.pixelSize * 0.8 + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter + width: parent.width + fontSizeMode: Text.Fit + font.pixelSize: GameSettings.mediumFontSize color: parent.color text: "MAX" } } } - - Image { - id: heart - anchors.horizontalCenter: minMaxContainer.horizontalCenter - anchors.verticalCenter: minMaxContainer.bottom - width: parent.width * 0.2 - height: width - source: "images/heart.png" - smooth: true - antialiasing: true - - SequentialAnimation { - id: heartAnim - running: measurePage.deviceHandler.alive - loops: Animation.Infinite - alwaysRunToEnd: true - PropertyAnimation { - target: heart - property: "scale" - to: 1.2 - duration: 500 - easing.type: Easing.InQuad - } - PropertyAnimation { - target: heart - property: "scale" - to: 1.0 - duration: 500 - easing.type: Easing.OutQuad - } - } - } } Rectangle { @@ -171,21 +261,43 @@ GamePage { width: circle.width height: GameSettings.fieldHeight radius: GameSettings.buttonRadius + border { + width: 1 + color: GameSettings.sliderBorderColor + } Rectangle { - height: parent.height + anchors { + top: parent.top + topMargin: parent.border.width + left: parent.left + leftMargin: parent.border.width + } + height: parent.height - 2 * parent.border.width + width: Math.min(1.0, measurePage.__timeCounter / measurePage.__maxTimeCount) + * (parent.width - 2 * parent.border.width) radius: parent.radius color: GameSettings.sliderColor - width: Math.min( - 1.0, - measurePage.__timeCounter / measurePage.__maxTimeCount) * parent.width + } + + Image { + readonly property int imgSize: GameSettings.fieldHeight * 0.5 + anchors { + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: GameSettings.fieldMargin * 0.5 + } + source: "images/clock.svg" + sourceSize.width: imgSize + sourceSize.height: imgSize + fillMode: Image.PreserveAspectFit } Text { anchors.centerIn: parent - color: "gray" + color: GameSettings.sliderTextColor text: (measurePage.__maxTimeCount - measurePage.__timeCounter).toFixed(0) + " s" - font.pixelSize: GameSettings.bigFontSize + font.pixelSize: GameSettings.smallFontSize } } } @@ -197,16 +309,17 @@ GamePage { anchors.bottomMargin: GameSettings.fieldMargin width: circle.width height: GameSettings.fieldHeight - enabled: !measurePage.deviceHandler.measuring + enabled: measurePage.deviceHandler.alive && !measurePage.deviceHandler.measuring + && measurePage.errorMessage === "" radius: GameSettings.buttonRadius onClicked: measurePage.start() Text { anchors.centerIn: parent - font.pixelSize: GameSettings.tinyFontSize + font.pixelSize: GameSettings.microFontSize text: qsTr("START") - color: startButton.enabled ? GameSettings.textColor : GameSettings.disabledTextColor + color: GameSettings.textDarkColor } } } diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/SplashScreen.qml b/examples/bluetooth/heartrate_game/HeartRateGame/SplashScreen.qml index 2f9ac1b3f..918319d78 100644 --- a/examples/bluetooth/heartrate_game/HeartRateGame/SplashScreen.qml +++ b/examples/bluetooth/heartrate_game/HeartRateGame/SplashScreen.qml @@ -23,7 +23,7 @@ Item { Timer { id: splashTimer interval: 1000 - onTriggered: splashIsReady = true + onTriggered: root.splashIsReady = true } Component.onCompleted: splashTimer.start() diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/Stats.qml b/examples/bluetooth/heartrate_game/HeartRateGame/Stats.qml index 22cdd5365..87487c944 100644 --- a/examples/bluetooth/heartrate_game/HeartRateGame/Stats.qml +++ b/examples/bluetooth/heartrate_game/HeartRateGame/Stats.qml @@ -13,20 +13,45 @@ GamePage { anchors.centerIn: parent width: parent.width - Text { + Rectangle { + id: resultRect anchors.horizontalCenter: parent.horizontalCenter - font.pixelSize: GameSettings.hugeFontSize - color: GameSettings.textColor - text: qsTr("RESULT") - } + width: height + height: statsPage.height / 2 - GameSettings.fieldHeight + radius: height / 2 + color: GameSettings.viewColor - Text { - anchors.horizontalCenter: parent.horizontalCenter - font.pixelSize: GameSettings.giganticFontSize * 3 - color: GameSettings.textColor - text: (statsPage.deviceHandler.maxHR - statsPage.deviceHandler.minHR).toFixed(0) + Column { + anchors.centerIn: parent + + Text { + id: resultCaption + anchors.horizontalCenter: parent.horizontalCenter + width: resultRect.width * 0.8 + height: resultRect.height * 0.15 + horizontalAlignment: Text.AlignHCenter + fontSizeMode: Text.Fit + font.pixelSize: GameSettings.bigFontSize + color: GameSettings.textColor + text: qsTr("RESULT") + } + + Text { + id: resultValue + anchors.horizontalCenter: parent.horizontalCenter + width: resultRect.width * 0.8 + height: resultRect.height * 0.4 + horizontalAlignment: Text.AlignHCenter + fontSizeMode: Text.Fit + font.pixelSize: GameSettings.hugeFontSize + font.bold: true + color: GameSettings.heartRateColor + text: (statsPage.deviceHandler.maxHR - statsPage.deviceHandler.minHR).toFixed(0) + } + } } + Item { height: GameSettings.fieldHeight width: 1 diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/TitleBar.qml b/examples/bluetooth/heartrate_game/HeartRateGame/TitleBar.qml index 016a44358..ccec76089 100644 --- a/examples/bluetooth/heartrate_game/HeartRateGame/TitleBar.qml +++ b/examples/bluetooth/heartrate_game/HeartRateGame/TitleBar.qml @@ -13,42 +13,51 @@ Rectangle { signal titleClicked(int index) height: GameSettings.fieldHeight - color: GameSettings.viewColor + color: GameSettings.titleColor + + Rectangle { + anchors.bottom: parent.bottom + width: parent.width / 3 + height: parent.height + x: titleBar.currentIndex * width + color: GameSettings.selectedTitleColor + + BottomLine { + color: GameSettings.bottomLineColor + } + + Behavior on x { + NumberAnimation { + duration: 200 + } + } + } Repeater { model: 3 - Text { + Rectangle { id: caption required property int index + property bool hoveredOrPressed: mouseArea.pressed || mouseArea.containsMouse width: titleBar.width / 3 height: titleBar.height x: index * width - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - text: titleBar.__titles[index] - font.pixelSize: GameSettings.tinyFontSize - color: titleBar.currentIndex === index ? GameSettings.textColor - : GameSettings.disabledTextColor - + color: (titleBar.currentIndex !== index) && hoveredOrPressed + ? GameSettings.hoverTitleColor : "transparent" + Text { + anchors.fill: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: titleBar.__titles[caption.index] + font.pixelSize: GameSettings.microFontSize + color: GameSettings.textColor + } MouseArea { + id: mouseArea anchors.fill: parent + hoverEnabled: true onClicked: titleBar.titleClicked(caption.index) } } } - - Item { - anchors.bottom: parent.bottom - width: parent.width / 3 - height: parent.height - x: titleBar.currentIndex * width - - BottomLine {} - - Behavior on x { - NumberAnimation { - duration: 200 - } - } - } } diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/images/alert.svg b/examples/bluetooth/heartrate_game/HeartRateGame/images/alert.svg new file mode 100644 index 000000000..c48c10e6b --- /dev/null +++ b/examples/bluetooth/heartrate_game/HeartRateGame/images/alert.svg @@ -0,0 +1,4 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path fill-rule="evenodd" clip-rule="evenodd" d="M12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12C4 7.58172 7.58172 4 12 4ZM12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2Z" fill="white"/> +<path fill-rule="evenodd" clip-rule="evenodd" d="M12 13C11.4477 13 11 12.5523 11 12V8C11 7.44772 11.4477 7 12 7C12.5523 7 13 7.44772 13 8V12C13 12.5523 12.5523 13 12 13ZM12 15C12.5523 15 13 15.4477 13 16C13 16.5523 12.5523 17 12 17C11.4477 17 11 16.5523 11 16C11 15.4477 11.4477 15 12 15Z" fill="white"/> +</svg> diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/images/bluetooth.svg b/examples/bluetooth/heartrate_game/HeartRateGame/images/bluetooth.svg new file mode 100644 index 000000000..6d01b28ff --- /dev/null +++ b/examples/bluetooth/heartrate_game/HeartRateGame/images/bluetooth.svg @@ -0,0 +1,3 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path fill-rule="evenodd" clip-rule="evenodd" d="M11.1869 2.24413C11.4926 2.11749 11.8445 2.18749 12.0785 2.42149L16.5785 6.92149C16.8981 7.24101 16.8981 7.75905 16.5785 8.07857L12.6571 12L16.5785 15.9215C16.8981 16.241 16.8981 16.7591 16.5785 17.0786L12.0785 21.5786C11.8445 21.8126 11.4926 21.8826 11.1869 21.7559C10.8812 21.6293 10.6818 21.331 10.6818 21V13.9753L7.57855 17.0786C7.25903 17.3981 6.74098 17.3981 6.42146 17.0786C6.10194 16.7591 6.10194 16.241 6.42146 15.9215L10.3429 12L6.42146 8.07857C6.10194 7.75905 6.10194 7.24101 6.42146 6.92149C6.74098 6.60197 7.25903 6.60197 7.57855 6.92149L10.6818 10.0248V3.00003C10.6818 2.66911 10.8812 2.37077 11.1869 2.24413ZM12.3182 13.9753L14.8429 16.5L12.3182 19.0248V13.9753ZM12.3182 10.0248V4.9753L14.8429 7.50003L12.3182 10.0248Z" fill="#80EBB6"/> +</svg> diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/images/clock.svg b/examples/bluetooth/heartrate_game/HeartRateGame/images/clock.svg new file mode 100644 index 000000000..655996bab --- /dev/null +++ b/examples/bluetooth/heartrate_game/HeartRateGame/images/clock.svg @@ -0,0 +1,4 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path d="M8 20H16V17C16 15.9 15.6083 14.9583 14.825 14.175C14.0417 13.3917 13.1 13 12 13C10.9 13 9.95833 13.3917 9.175 14.175C8.39167 14.9583 8 15.9 8 17V20ZM12 11C13.1 11 14.0417 10.6083 14.825 9.825C15.6083 9.04167 16 8.1 16 7V4H8V7C8 8.1 8.39167 9.04167 9.175 9.825C9.95833 10.6083 10.9 11 12 11ZM5 22C4.44772 22 4 21.5523 4 21C4 20.4477 4.44772 20 5 20H6V17C6 15.9833 6.2375 15.0292 6.7125 14.1375C7.1875 13.2458 7.85 12.5333 8.7 12C7.85 11.4667 7.1875 10.7542 6.7125 9.8625C6.2375 8.97083 6 8.01667 6 7V4H5C4.44772 4 4 3.55228 4 3C4 2.44772 4.44772 2 5 2H19C19.5523 2 20 2.44772 20 3C20 3.55228 19.5523 4 19 4H18V7C18 8.01667 17.7625 8.97083 17.2875 9.8625C16.8125 10.7542 16.15 11.4667 15.3 12C16.15 12.5333 16.8125 13.2458 17.2875 14.1375C17.7625 15.0292 18 15.9833 18 17V20H19C19.5523 20 20 20.4477 20 21C20 21.5523 19.5523 22 19 22H5Z" fill="#80EBB6"/> +<path d="M17 22H7L7 18C7 15.2386 9.23858 13 12 13C14.7614 13 17 15.2386 17 18V22Z" fill="#80EBB6"/> +</svg> diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/images/heart.png b/examples/bluetooth/heartrate_game/HeartRateGame/images/heart.png Binary files differindex f2b3c0a3e..4ba0f822d 100644 --- a/examples/bluetooth/heartrate_game/HeartRateGame/images/heart.png +++ b/examples/bluetooth/heartrate_game/HeartRateGame/images/heart.png diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/images/progress.svg b/examples/bluetooth/heartrate_game/HeartRateGame/images/progress.svg new file mode 100644 index 000000000..449fe5e73 --- /dev/null +++ b/examples/bluetooth/heartrate_game/HeartRateGame/images/progress.svg @@ -0,0 +1,4 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path fill-rule="evenodd" clip-rule="evenodd" d="M19 11C19 11.5523 19.4477 12 20 12C20.5523 12 21 11.5523 21 11V10.8478C21 8.11075 19.7088 5.53404 17.5163 3.89561C17.0739 3.56501 16.4472 3.65565 16.1166 4.09805C15.786 4.54046 15.8767 5.1671 16.3191 5.4977C18.0064 6.75857 19 8.74149 19 10.8478V11ZM4 12C4.55228 12 5 11.5523 5 11V10.8478C5 8.74149 5.99363 6.75857 7.68091 5.4977C8.12331 5.1671 8.21395 4.54046 7.88335 4.09805C7.55275 3.65565 6.92611 3.56501 6.4837 3.89561C4.29117 5.53404 3 8.11075 3 10.8478V11C3 11.5523 3.44772 12 4 12ZM7.10555 19.5528C7.35253 19.0588 7.95321 18.8586 8.44719 19.1055C10.6837 20.2238 13.3162 20.2238 15.5528 19.1056C16.0467 18.8586 16.6474 19.0588 16.8944 19.5528C17.1414 20.0468 16.9412 20.6474 16.4472 20.8944C13.6476 22.2942 10.3523 22.2942 7.55276 20.8944C7.05878 20.6474 6.85856 20.0467 7.10555 19.5528Z" fill="#80EBB6"/> +<path fill-rule="evenodd" clip-rule="evenodd" d="M13 5C13 5.55228 12.5523 6 12 6C11.4477 6 11 5.55228 11 5C11 4.44772 11.4477 4 12 4C12.5523 4 13 4.44772 13 5ZM15 5C15 6.65685 13.6569 8 12 8C10.3431 8 9 6.65685 9 5C9 3.34315 10.3431 2 12 2C13.6569 2 15 3.34315 15 5ZM5 17C5.55228 17 6 16.5523 6 16C6 15.4477 5.55228 15 5 15C4.44772 15 4 15.4477 4 16C4 16.5523 4.44772 17 5 17ZM5 19C6.65685 19 8 17.6569 8 16C8 14.3431 6.65685 13 5 13C3.34315 13 2 14.3431 2 16C2 17.6569 3.34315 19 5 19ZM19 17C19.5523 17 20 16.5523 20 16C20 15.4477 19.5523 15 19 15C18.4477 15 18 15.4477 18 16C18 16.5523 18.4477 17 19 17ZM19 19C20.6569 19 22 17.6569 22 16C22 14.3431 20.6569 13 19 13C17.3431 13 16 14.3431 16 16C16 17.6569 17.3431 19 19 19Z" fill="#80EBB6"/> +</svg> diff --git a/examples/bluetooth/heartrate_game/HeartRateGame/images/search.svg b/examples/bluetooth/heartrate_game/HeartRateGame/images/search.svg new file mode 100644 index 000000000..9af5fe4d7 --- /dev/null +++ b/examples/bluetooth/heartrate_game/HeartRateGame/images/search.svg @@ -0,0 +1,4 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path fill-rule="evenodd" clip-rule="evenodd" d="M14.2929 14.2929C14.6834 13.9024 15.3166 13.9024 15.7071 14.2929L21.7071 20.2929C22.0976 20.6834 22.0976 21.3166 21.7071 21.7071C21.3166 22.0976 20.6834 22.0976 20.2929 21.7071L14.2929 15.7071C13.9024 15.3166 13.9024 14.6834 14.2929 14.2929Z" fill="#80EBB6"/> +<path fill-rule="evenodd" clip-rule="evenodd" d="M10 4C6.68629 4 4 6.68629 4 10C4 13.3137 6.68629 16 10 16C13.3137 16 16 13.3137 16 10C16 6.68629 13.3137 4 10 4ZM2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10Z" fill="#80EBB6"/> +</svg> diff --git a/examples/bluetooth/heartrate_game/bluetoothbaseclass.py b/examples/bluetooth/heartrate_game/bluetoothbaseclass.py index 6278b0418..7f4c5a5b4 100644 --- a/examples/bluetooth/heartrate_game/bluetoothbaseclass.py +++ b/examples/bluetooth/heartrate_game/bluetoothbaseclass.py @@ -2,18 +2,36 @@ # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause from __future__ import annotations -from PySide6.QtCore import QObject, Property, Signal, Slot +from enum import IntEnum +from PySide6.QtQml import QmlElement, QmlUncreatable +from PySide6.QtCore import QObject, Property, Signal, Slot, QEnum +QML_IMPORT_NAME = "HeartRateGame" +QML_IMPORT_MAJOR_VERSION = 1 + + +@QmlElement +@QmlUncreatable("BluetoothBaseClass is not intended to be created directly") class BluetoothBaseClass(QObject): + @QEnum + class IconType(IntEnum): + IconNone = 0 + IconBluetooth = 1 + IconError = 2 + IconProgress = 3 + IconSearch = 4 + errorChanged = Signal() infoChanged = Signal() + iconChanged = Signal() def __init__(self, parent=None): super().__init__(parent) self.m_error = "" self.m_info = "" + self.m_icon = BluetoothBaseClass.IconType.IconNone @Property(str, notify=errorChanged) def error(self): @@ -35,7 +53,18 @@ class BluetoothBaseClass(QObject): self.m_info = i self.infoChanged.emit() + @Property(int, notify=iconChanged) + def icon(self): + return self.m_icon + + @icon.setter + def icon(self, i): + if self.m_icon != i: + self.m_icon = i + self.iconChanged.emit() + @Slot() def clearMessages(self): self.info = "" self.error = "" + self.icon = BluetoothBaseClass.IconType.IconNone diff --git a/examples/bluetooth/heartrate_game/devicefinder.py b/examples/bluetooth/heartrate_game/devicefinder.py index 5c00e7c94..932f2bb4c 100644 --- a/examples/bluetooth/heartrate_game/devicefinder.py +++ b/examples/bluetooth/heartrate_game/devicefinder.py @@ -5,7 +5,7 @@ import sys from PySide6.QtBluetooth import (QBluetoothDeviceDiscoveryAgent, QBluetoothDeviceInfo) -from PySide6.QtQml import QmlElement +from PySide6.QtQml import QmlElement, QmlUncreatable from PySide6.QtCore import QTimer, Property, Signal, Slot, Qt from bluetoothbaseclass import BluetoothBaseClass @@ -22,6 +22,7 @@ QML_IMPORT_MAJOR_VERSION = 1 @QmlElement +@QmlUncreatable("This class is not intended to be created directly") class DeviceFinder(BluetoothBaseClass): scanningChanged = Signal() @@ -57,6 +58,7 @@ class DeviceFinder(BluetoothBaseClass): qApp.requestPermission(permission, self, self.startSearch) # noqa: F82 1 return elif permission_status == Qt.PermissionStatus.Denied: + self.icon = BluetoothBaseClass.IconType.IconError return elif permission_status == Qt.PermissionStatus.Granted: print("[HeartRateGame] Bluetooth Permission Granted") @@ -75,6 +77,7 @@ class DeviceFinder(BluetoothBaseClass): #! [devicediscovery-2] self.scanningChanged.emit() self.info = "Scanning for devices..." + self.icon = BluetoothBaseClass.IconType.IconProgress #! [devicediscovery-3] @Slot(QBluetoothDeviceInfo) @@ -83,6 +86,7 @@ class DeviceFinder(BluetoothBaseClass): if device.coreConfigurations() & QBluetoothDeviceInfo.LowEnergyCoreConfiguration: self.m_devices.append(DeviceInfo(device)) self.info = "Low Energy device found. Scanning more..." + self.icon = BluetoothBaseClass.IconType.IconProgress #! [devicediscovery-3] self.devicesChanged.emit() #! [devicediscovery-4] @@ -97,6 +101,7 @@ class DeviceFinder(BluetoothBaseClass): self.error = "Writing or reading from the device resulted in an error." else: self.error = "An unknown error has occurred." + self.icon = BluetoothBaseClass.IconType.IconError @Slot() def scanFinished(self): @@ -107,12 +112,20 @@ class DeviceFinder(BluetoothBaseClass): if self.m_devices: self.info = "Scanning done." + self.icon = BluetoothBaseClass.IconType.IconBluetooth else: self.error = "No Low Energy devices found." + self.icon = BluetoothBaseClass.IconType.IconError self.scanningChanged.emit() self.devicesChanged.emit() + @Slot() + def resetMessages(self): + self.error = "" + self.info = "Start search to find devices" + self.icon = BluetoothBaseClass.IconType.IconSearch + @Slot(str) def connectToService(self, address): self.m_deviceDiscoveryAgent.stop() @@ -127,7 +140,7 @@ class DeviceFinder(BluetoothBaseClass): if currentDevice: self.m_deviceHandler.setDevice(currentDevice) - self.clearMessages() + self.resetMessages() @Property(bool, notify=scanningChanged) def scanning(self): diff --git a/examples/bluetooth/heartrate_game/devicehandler.py b/examples/bluetooth/heartrate_game/devicehandler.py index 8599c0296..f10c052be 100644 --- a/examples/bluetooth/heartrate_game/devicehandler.py +++ b/examples/bluetooth/heartrate_game/devicehandler.py @@ -69,31 +69,37 @@ class DeviceHandler(BluetoothBaseClass): self.m_demoTimer.start() self.updateDemoHR() - @Property(int) def addressType(self): if self.m_addressType == QLowEnergyController.RemoteAddressType.RandomAddress: return DeviceHandler.AddressType.RANDOM_ADDRESS return DeviceHandler.AddressType.PUBLIC_ADDRESS - @addressType.setter - def addressType(self, type): + @Slot(int) + def setAddressType(self, type): if type == DeviceHandler.AddressType.PUBLIC_ADDRESS: self.m_addressType = QLowEnergyController.RemoteAddressType.PublicAddress elif type == DeviceHandler.AddressType.RANDOM_ADDRESS: self.m_addressType = QLowEnergyController.RemoteAddressType.RandomAddress + @Slot() + def resetAddressType(self): + self.m_addressType = QLowEnergyController.RemoteAddressType.PublicAddress + @Slot(QLowEnergyController.Error) def controllerErrorOccurred(self, device): self.error = "Cannot connect to remote device." + self.icon = BluetoothBaseClass.IconType.IconError @Slot() def controllerConnected(self): self.info = "Controller connected. Search services..." + self.icon = BluetoothBaseClass.IconType.IconProgress self.m_control.discoverServices() @Slot() def controllerDisconnected(self): self.error = "LowEnergy controller disconnected" + self.icon = BluetoothBaseClass.IconType.IconError def setDevice(self, device): self.clearMessages() @@ -101,6 +107,7 @@ class DeviceHandler(BluetoothBaseClass): if simulator(): self.info = "Demo device connected." + self.icon = BluetoothBaseClass.IconType.IconBluetooth return # Disconnect and delete old connection @@ -152,6 +159,7 @@ class DeviceHandler(BluetoothBaseClass): def serviceDiscovered(self, gatt): if gatt == QBluetoothUuid(QBluetoothUuid.ServiceClassUuid.HeartRate): self.info = "Heart Rate service discovered. Waiting for service scan to be done..." + self.icon = BluetoothBaseClass.IconType.IconProgress self.m_foundHeartRateService = True #! [Filter HeartRate service 1] @@ -159,6 +167,7 @@ class DeviceHandler(BluetoothBaseClass): @Slot() def serviceScanDone(self): self.info = "Service scan done." + self.icon = BluetoothBaseClass.IconType.IconProgress # Delete old service if available if self.m_service: @@ -177,6 +186,8 @@ class DeviceHandler(BluetoothBaseClass): self.m_service.discoverDetails() else: self.error = "Heart Rate Service not found." + self.icon = BluetoothBaseClass.IconType.IconError + #! [Filter HeartRate service 2] # Service functions @@ -185,8 +196,10 @@ class DeviceHandler(BluetoothBaseClass): def serviceStateChanged(self, switch): if switch == QLowEnergyService.RemoteServiceDiscovering: self.info = "Discovering services..." + self.icon = BluetoothBaseClass.IconType.IconProgress elif switch == QLowEnergyService.RemoteServiceDiscovered: self.info = "Service discovered." + self.icon = BluetoothBaseClass.IconType.IconBluetooth hrChar = self.m_service.characteristic( QBluetoothUuid(QBluetoothUuid.CharacteristicType.HeartRateMeasurement)) if hrChar.isValid(): @@ -197,6 +210,7 @@ class DeviceHandler(BluetoothBaseClass): QByteArray.fromHex(b"0100")) else: self.error = "HR Data not found." + self.icon = BluetoothBaseClass.IconType.IconError self.aliveChanged.emit() #! [Find HRM characteristic] @@ -308,3 +322,5 @@ class DeviceHandler(BluetoothBaseClass): + (0.2017 * 24)) / 4.184) * 60 * self.time / 3600 self.statsChanged.emit() + + addressType = Property(int, addressType, setAddressType, freset=resetAddressType) diff --git a/examples/bluetooth/heartrate_game/deviceinfo.py b/examples/bluetooth/heartrate_game/deviceinfo.py index 136bbbacb..60cdb5aaf 100644 --- a/examples/bluetooth/heartrate_game/deviceinfo.py +++ b/examples/bluetooth/heartrate_game/deviceinfo.py @@ -27,7 +27,7 @@ class DeviceInfo(QObject): @Property(str, notify=deviceChanged) def deviceName(self): if simulator(): - return "Demo device" + return "Demo BT device" return self.m_device.name() @Property(str, notify=deviceChanged) diff --git a/examples/bluetooth/heartrate_game/doc/heartrate_game.rst b/examples/bluetooth/heartrate_game/doc/heartrate_game.rst index 9d190d991..1704e32d8 100644 --- a/examples/bluetooth/heartrate_game/doc/heartrate_game.rst +++ b/examples/bluetooth/heartrate_game/doc/heartrate_game.rst @@ -9,3 +9,6 @@ application covers the scanning for Bluetooth Low Energy devices, connecting to a Heart Rate service on the device, writing characteristics and descriptors, and receiving updates from the device once the heart rate has changed. + +The command line option `--simulator` can be used to run the example against a +demo server in case no Bluetooth hardware is available. diff --git a/examples/bluetooth/heartrate_game/heartrate_global.py b/examples/bluetooth/heartrate_game/heartrate_global.py index 384eb93a7..75a0b42b8 100644 --- a/examples/bluetooth/heartrate_game/heartrate_global.py +++ b/examples/bluetooth/heartrate_game/heartrate_global.py @@ -8,7 +8,6 @@ _simulator = False def simulator(): - global _simulator return _simulator diff --git a/examples/bluetooth/heartrate_game/main.py b/examples/bluetooth/heartrate_game/main.py index 00df7de6a..a70b9f349 100644 --- a/examples/bluetooth/heartrate_game/main.py +++ b/examples/bluetooth/heartrate_game/main.py @@ -15,6 +15,7 @@ from PySide6.QtCore import QCoreApplication, QLoggingCategory from connectionhandler import ConnectionHandler from devicefinder import DeviceFinder from devicehandler import DeviceHandler +from bluetoothbaseclass import BluetoothBaseClass # noqa: F401 from heartrate_global import set_simulator diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/app.qml b/examples/qml/tutorials/extending-qml/chapter1-basics/Charts/App.qml index 6feef5633..523dc7128 100644 --- a/examples/qml/tutorials/extending-qml/chapter1-basics/app.qml +++ b/examples/qml/tutorials/extending-qml/chapter1-basics/Charts/App.qml @@ -1,4 +1,4 @@ -// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause import Charts @@ -16,11 +16,7 @@ Item { } Text { - anchors { - bottom: parent.bottom; - horizontalCenter: parent.horizontalCenter; - bottomMargin: 20 - } + anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 20 } text: aPieChart.name } } diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/Charts/qmldir b/examples/qml/tutorials/extending-qml/chapter1-basics/Charts/qmldir new file mode 100644 index 000000000..78602c6b4 --- /dev/null +++ b/examples/qml/tutorials/extending-qml/chapter1-basics/Charts/qmldir @@ -0,0 +1,4 @@ +module Charts +typeinfo chapter1-basics.qmltypes +depends QtQuick +App 254.0 App.qml diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py b/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py index 322bef954..08fa91c14 100644 --- a/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py +++ b/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py @@ -4,11 +4,10 @@ from __future__ import annotations """PySide6 port of the qml/tutorials/extending-qml/chapter1-basics example from Qt v5.x""" -import os from pathlib import Path import sys -from PySide6.QtCore import Property, Signal, QUrl +from PySide6.QtCore import Property, Signal from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor from PySide6.QtQml import QmlElement from PySide6.QtQuick import QQuickPaintedItem, QQuickView @@ -57,8 +56,8 @@ if __name__ == '__main__': view = QQuickView() view.setResizeMode(QQuickView.ResizeMode.SizeRootObjectToView) - qml_file = os.fspath(Path(__file__).resolve().parent / 'app.qml') - view.setSource(QUrl.fromLocalFile(qml_file)) + view.engine().addImportPath(Path(__file__).parent) + view.loadFromModule("Charts", "App") if view.status() == QQuickView.Status.Error: sys.exit(-1) view.show() diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/chapter1-basics.pyproject b/examples/qml/tutorials/extending-qml/chapter1-basics/chapter1-basics.pyproject index 869556bb8..2207b8344 100644 --- a/examples/qml/tutorials/extending-qml/chapter1-basics/chapter1-basics.pyproject +++ b/examples/qml/tutorials/extending-qml/chapter1-basics/chapter1-basics.pyproject @@ -1,3 +1,3 @@ { - "files": ["basics.py", "app.qml"] + "files": ["basics.py", "Charts/App.qml", "Charts/qmldir"] } diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/app.qml b/examples/qml/tutorials/extending-qml/chapter2-methods/Charts/App.qml index d9477e253..6190cbc50 100644 --- a/examples/qml/tutorials/extending-qml/chapter2-methods/app.qml +++ b/examples/qml/tutorials/extending-qml/chapter2-methods/Charts/App.qml @@ -1,4 +1,4 @@ -// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause import Charts @@ -22,11 +22,7 @@ Item { } Text { - anchors { - bottom: parent.bottom; - horizontalCenter: parent.horizontalCenter; - bottomMargin: 20 - } + anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 20 } text: "Click anywhere to clear the chart" } } diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/Charts/qmldir b/examples/qml/tutorials/extending-qml/chapter2-methods/Charts/qmldir new file mode 100644 index 000000000..dad537878 --- /dev/null +++ b/examples/qml/tutorials/extending-qml/chapter2-methods/Charts/qmldir @@ -0,0 +1,4 @@ +module Charts +typeinfo chapter2-methods.qmltypes +depends QtQuick +App 254.0 App.qml diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/chapter2-methods.pyproject b/examples/qml/tutorials/extending-qml/chapter2-methods/chapter2-methods.pyproject index cdf33be7f..b0942a27b 100644 --- a/examples/qml/tutorials/extending-qml/chapter2-methods/chapter2-methods.pyproject +++ b/examples/qml/tutorials/extending-qml/chapter2-methods/chapter2-methods.pyproject @@ -1,3 +1,3 @@ { - "files": ["methods.py", "app.qml"] + "files": ["methods.py", "Charts/App.qml", "Charts/qmldir"] } diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/methods.py b/examples/qml/tutorials/extending-qml/chapter2-methods/methods.py index 238225fd3..02f600d1b 100644 --- a/examples/qml/tutorials/extending-qml/chapter2-methods/methods.py +++ b/examples/qml/tutorials/extending-qml/chapter2-methods/methods.py @@ -4,11 +4,10 @@ from __future__ import annotations """PySide6 port of the qml/tutorials/extending-qml/chapter2-methods example from Qt v5.x""" -import os from pathlib import Path import sys -from PySide6.QtCore import Property, Signal, Slot, Qt, QUrl +from PySide6.QtCore import Property, Signal, Slot, Qt from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor from PySide6.QtQml import QmlElement from PySide6.QtQuick import QQuickPaintedItem, QQuickView @@ -64,8 +63,8 @@ if __name__ == '__main__': view = QQuickView() view.setResizeMode(QQuickView.ResizeMode.SizeRootObjectToView) - qml_file = os.fspath(Path(__file__).resolve().parent / 'app.qml') - view.setSource(QUrl.fromLocalFile(qml_file)) + view.engine().addImportPath(Path(__file__).parent) + view.loadFromModule("Charts", "App") if view.status() == QQuickView.Status.Error: sys.exit(-1) view.show() diff --git a/examples/qml/tutorials/extending-qml/chapter3-bindings/app.qml b/examples/qml/tutorials/extending-qml/chapter3-bindings/Charts/App.qml index f1530516a..0e30ba69b 100644 --- a/examples/qml/tutorials/extending-qml/chapter3-bindings/app.qml +++ b/examples/qml/tutorials/extending-qml/chapter3-bindings/Charts/App.qml @@ -1,4 +1,4 @@ -// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause import Charts @@ -30,11 +30,7 @@ Item { } Text { - anchors { - bottom: parent.bottom; - horizontalCenter: parent.horizontalCenter; - bottomMargin: 20 - } + anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 20 } text: "Click anywhere to change the chart color" } } diff --git a/examples/qml/tutorials/extending-qml/chapter3-bindings/Charts/qmldir b/examples/qml/tutorials/extending-qml/chapter3-bindings/Charts/qmldir new file mode 100644 index 000000000..f2d39dd19 --- /dev/null +++ b/examples/qml/tutorials/extending-qml/chapter3-bindings/Charts/qmldir @@ -0,0 +1,4 @@ +module Charts +typeinfo chapter3-bindings.qmltypes +depends QtQuick +App 254.0 App.qml diff --git a/examples/qml/tutorials/extending-qml/chapter3-bindings/bindings.py b/examples/qml/tutorials/extending-qml/chapter3-bindings/bindings.py index ed332cba7..a3fa77ed9 100644 --- a/examples/qml/tutorials/extending-qml/chapter3-bindings/bindings.py +++ b/examples/qml/tutorials/extending-qml/chapter3-bindings/bindings.py @@ -4,11 +4,10 @@ from __future__ import annotations """PySide6 port of the qml/tutorials/extending-qml/chapter3-bindings example from Qt v5.x""" -import os from pathlib import Path import sys -from PySide6.QtCore import Property, Signal, Slot, QUrl, Qt +from PySide6.QtCore import Property, Signal, Slot, Qt from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor from PySide6.QtQml import QmlElement from PySide6.QtQuick import QQuickPaintedItem, QQuickView @@ -68,8 +67,8 @@ if __name__ == '__main__': view = QQuickView() view.setResizeMode(QQuickView.ResizeMode.SizeRootObjectToView) - qml_file = os.fspath(Path(__file__).resolve().parent / 'app.qml') - view.setSource(QUrl.fromLocalFile(qml_file)) + view.engine().addImportPath(Path(__file__).parent) + view.loadFromModule("Charts", "App") if view.status() == QQuickView.Status.Error: sys.exit(-1) view.show() diff --git a/examples/qml/tutorials/extending-qml/chapter3-bindings/chapter3-bindings.pyproject b/examples/qml/tutorials/extending-qml/chapter3-bindings/chapter3-bindings.pyproject index 6e21f86f9..ebd65a027 100644 --- a/examples/qml/tutorials/extending-qml/chapter3-bindings/chapter3-bindings.pyproject +++ b/examples/qml/tutorials/extending-qml/chapter3-bindings/chapter3-bindings.pyproject @@ -1,3 +1,3 @@ { - "files": ["app.qml", "bindings.py"] + "files": ["bindings.py", "Charts/App.qml", "Charts/qmldir"] } diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/app.qml b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/Charts/App.qml index a5c5ff9fa..eb0a3cdcf 100644 --- a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/app.qml +++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/Charts/App.qml @@ -1,4 +1,4 @@ -// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause import Charts diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/Charts/qmldir b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/Charts/qmldir new file mode 100644 index 000000000..7a7a4188b --- /dev/null +++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/Charts/qmldir @@ -0,0 +1,4 @@ +module Charts +typeinfo chapter4-customPropertyTypes.qmltypes +depends QtQuick +App 254.0 App.qml diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pyproject b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pyproject index af1cfefb7..076f3a825 100644 --- a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pyproject +++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pyproject @@ -1,3 +1,3 @@ { - "files": ["app.qml", "customPropertyTypes.py"] + "files": ["customPropertyTypes.py", "Charts/App.qml", "Charts/qmldir"] } diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/customPropertyTypes.py b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/customPropertyTypes.py index bf24ec3c3..2d03b5cb2 100644 --- a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/customPropertyTypes.py +++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/customPropertyTypes.py @@ -5,11 +5,10 @@ from __future__ import annotations """PySide6 port of the qml/tutorials/extending-qml/chapter4-customPropertyTypes example from Qt v5.x""" -import os from pathlib import Path import sys -from PySide6.QtCore import Property, QUrl +from PySide6.QtCore import Property from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor from PySide6.QtQml import QmlElement from PySide6.QtQuick import QQuickPaintedItem, QQuickView, QQuickItem @@ -72,8 +71,8 @@ if __name__ == '__main__': view = QQuickView() view.setResizeMode(QQuickView.ResizeMode.SizeRootObjectToView) - qml_file = os.fspath(Path(__file__).resolve().parent / 'app.qml') - view.setSource(QUrl.fromLocalFile(qml_file)) + view.engine().addImportPath(Path(__file__).parent) + view.loadFromModule("Charts", "App") if view.status() == QQuickView.Status.Error: sys.exit(-1) view.show() diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/Charts/App.qml b/examples/qml/tutorials/extending-qml/chapter5-listproperties/Charts/App.qml new file mode 100644 index 000000000..c0c3e8268 --- /dev/null +++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/Charts/App.qml @@ -0,0 +1,39 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +pragma ComponentBehavior: Bound +import Charts +import QtQuick + +Item { + width: 300; height: 200 + + PieChart { + id: chart + anchors.centerIn: parent + width: 100; height: 100 + + component Slice: PieSlice { + parent: chart + anchors.fill: parent + } + + slices: [ + Slice { + color: "red" + fromAngle: 0 + angleSpan: 110 + }, + Slice { + color: "black" + fromAngle: 110 + angleSpan: 50 + }, + Slice { + color: "blue" + fromAngle: 160 + angleSpan: 100 + } + ] + } +} diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/Charts/qmldir b/examples/qml/tutorials/extending-qml/chapter5-listproperties/Charts/qmldir new file mode 100644 index 000000000..48ec24349 --- /dev/null +++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/Charts/qmldir @@ -0,0 +1,4 @@ +module Charts +typeinfo chapter5-listproperties.qmltypes +depends QtQuick +App 254.0 App.qml diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/app.qml b/examples/qml/tutorials/extending-qml/chapter5-listproperties/app.qml deleted file mode 100644 index ac99d5a40..000000000 --- a/examples/qml/tutorials/extending-qml/chapter5-listproperties/app.qml +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -import Charts -import QtQuick - -Item { - width: 300; height: 200 - - PieChart { - anchors.centerIn: parent - width: 100; height: 100 - - slices: [ - PieSlice { - anchors.fill: parent - color: "red" - fromAngle: 0; angleSpan: 110 - }, - PieSlice { - anchors.fill: parent - color: "black" - fromAngle: 110; angleSpan: 50 - }, - PieSlice { - anchors.fill: parent - color: "blue" - fromAngle: 160; angleSpan: 100 - } - ] - } -} diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/chapter5-listproperties.pyproject b/examples/qml/tutorials/extending-qml/chapter5-listproperties/chapter5-listproperties.pyproject index a3f89d575..d726432f0 100644 --- a/examples/qml/tutorials/extending-qml/chapter5-listproperties/chapter5-listproperties.pyproject +++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/chapter5-listproperties.pyproject @@ -1,3 +1,3 @@ { - "files": ["app.qml", "listproperties.py"] + "files": ["listproperties.py", "Charts/App.qml", "Charts/qmldir"] } diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/listproperties.py b/examples/qml/tutorials/extending-qml/chapter5-listproperties/listproperties.py index 67d7482ec..c2ea85ff4 100644 --- a/examples/qml/tutorials/extending-qml/chapter5-listproperties/listproperties.py +++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/listproperties.py @@ -4,11 +4,10 @@ from __future__ import annotations """PySide6 port of the qml/tutorials/extending-qml/chapter5-listproperties example from Qt v5.x""" -import os from pathlib import Path import sys -from PySide6.QtCore import Property, QUrl +from PySide6.QtCore import Property from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor from PySide6.QtQml import QmlElement, ListProperty from PySide6.QtQuick import QQuickPaintedItem, QQuickView, QQuickItem @@ -86,8 +85,8 @@ if __name__ == '__main__': view = QQuickView() view.setResizeMode(QQuickView.ResizeMode.SizeRootObjectToView) - qml_file = os.fspath(Path(__file__).resolve().parent / 'app.qml') - view.setSource(QUrl.fromLocalFile(qml_file)) + view.engine().addImportPath(Path(__file__).parent) + view.loadFromModule("Charts", "App") if view.status() == QQuickView.Status.Error: sys.exit(-1) view.show() diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/app.qml b/examples/qml/tutorials/extending-qml/chapter6-plugins/App.qml index 1a4772e15..79a9ce9b3 100644 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/app.qml +++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/App.qml @@ -1,32 +1,39 @@ // Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - +pragma ComponentBehavior: Bound import QtQuick -import Charts 1.0 +import Charts Item { width: 300; height: 200 PieChart { + id: chart anchors.centerIn: parent width: 100; height: 100 + component Slice: PieSlice { + parent: chart + anchors.fill: parent + } + slices: [ - PieSlice { - anchors.fill: parent + Slice { color: "red" - fromAngle: 0; angleSpan: 110 + fromAngle: 0 + angleSpan: 110 }, - PieSlice { - anchors.fill: parent + Slice { color: "black" - fromAngle: 110; angleSpan: 50 + fromAngle: 110 + angleSpan: 50 }, - PieSlice { - anchors.fill: parent + Slice { color: "blue" - fromAngle: 160; angleSpan: 100 + fromAngle: 160 + angleSpan: 100 } ] } } + diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/plugins.png b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/plugins.png Binary files differdeleted file mode 100644 index 8992e89c0..000000000 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/plugins.png +++ /dev/null diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/doc/chapter6-plugins.rst b/examples/qml/tutorials/extending-qml/chapter6-plugins/doc/chapter6-plugins.rst index 2320a8fa1..3677a71f5 100644 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/doc/chapter6-plugins.rst +++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/doc/chapter6-plugins.rst @@ -21,4 +21,4 @@ Running the Example .. code-block:: shell - pyside6-qml examples/qml/tutorials/extending-qml/chapter6-plugins/app.qml -I examples/qml/tutorials/extending-qml/chapter6-plugins/Charts + pyside6-qml examples/qml/tutorials/extending-qml/chapter6-plugins/App.qml -I examples/qml/tutorials/extending-qml/chapter6-plugins/Charts diff --git a/examples/quick/painteditem/doc/painteditem.png b/examples/quick/customitems/painteditem/doc/painteditem.png Binary files differindex 743cd11b5..743cd11b5 100644 --- a/examples/quick/painteditem/doc/painteditem.png +++ b/examples/quick/customitems/painteditem/doc/painteditem.png diff --git a/examples/quick/painteditem/doc/painteditem.rst b/examples/quick/customitems/painteditem/doc/painteditem.rst index 5c3e8935b..5c3e8935b 100644 --- a/examples/quick/painteditem/doc/painteditem.rst +++ b/examples/quick/customitems/painteditem/doc/painteditem.rst diff --git a/examples/quick/painteditem/main.qml b/examples/quick/customitems/painteditem/main.qml index 44be89dc3..44be89dc3 100644 --- a/examples/quick/painteditem/main.qml +++ b/examples/quick/customitems/painteditem/main.qml diff --git a/examples/quick/painteditem/painteditem.py b/examples/quick/customitems/painteditem/painteditem.py index 95390b6ee..95390b6ee 100644 --- a/examples/quick/painteditem/painteditem.py +++ b/examples/quick/customitems/painteditem/painteditem.py diff --git a/examples/quick/painteditem/painteditem.pyproject b/examples/quick/customitems/painteditem/painteditem.pyproject index 0597c2a97..0597c2a97 100644 --- a/examples/quick/painteditem/painteditem.pyproject +++ b/examples/quick/customitems/painteditem/painteditem.pyproject diff --git a/examples/quick/models/objectlistmodel/view.qml b/examples/quick/models/objectlistmodel/view.qml index b7cf68a9b..3cb072dd3 100644 --- a/examples/quick/models/objectlistmodel/view.qml +++ b/examples/quick/models/objectlistmodel/view.qml @@ -2,14 +2,20 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause import QtQuick +import QtQuick.Controls ListView { - width: 100; height: 100 + id: listview + width: 200; height: 320 + required model + ScrollBar.vertical: ScrollBar { } delegate: Rectangle { - color: model.modelData.color - height: 25 - width: 100 - Text { text: model.modelData.name } + width: listview.width; height: 25 + + required color + required property string name + + Text { text: parent.name } } } diff --git a/examples/quick/rendercontrol/rendercontrol_opengl/demo.qml b/examples/quick/rendercontrol/rendercontrol_opengl/demo.qml index 00f6a81e9..ca6ba7b2b 100644 --- a/examples/quick/rendercontrol/rendercontrol_opengl/demo.qml +++ b/examples/quick/rendercontrol/rendercontrol_opengl/demo.qml @@ -2,13 +2,14 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause import QtQuick -import QtQuick.Particles 2.0 +import QtQuick.Particles Rectangle { id: root + property bool keyDown: false gradient: Gradient { - GradientStop { position: 0; color: mouse.pressed ? "lightsteelblue" : "steelblue" } + GradientStop { position: 0; color: mouse.pressed ? "lightsteelblue" : (root.keyDown ? "blue" : "steelblue") } GradientStop { position: 1; color: "black" } } @@ -158,4 +159,7 @@ Rectangle { id: mouse anchors.fill: parent } + + Keys.onPressed: keyDown = true + Keys.onReleased: keyDown = false } diff --git a/examples/quick/scenegraph/openglunderqml/main.qml b/examples/quick/scenegraph/openglunderqml/main.qml index 73bfa3262..5d4e51f76 100644 --- a/examples/quick/scenegraph/openglunderqml/main.qml +++ b/examples/quick/scenegraph/openglunderqml/main.qml @@ -30,7 +30,7 @@ Item { id: label color: "black" wrapMode: Text.WordWrap - text: "The background here is a squircle rendered with raw OpenGL using the 'beforeRender()' signal in QQuickWindow. This text label and its border is rendered using QML" + text: qsTr("The background here is a squircle rendered with raw OpenGL using the 'beforeRender()' signal in QQuickWindow. This text label and its border is rendered using QML") anchors.right: parent.right anchors.left: parent.left anchors.bottom: parent.bottom diff --git a/examples/quick/scenegraph/scenegraph_customgeometry/main.qml b/examples/quick/scenegraph/scenegraph_customgeometry/main.qml index 88431a176..044302428 100644 --- a/examples/quick/scenegraph/scenegraph_customgeometry/main.qml +++ b/examples/quick/scenegraph/scenegraph_customgeometry/main.qml @@ -22,13 +22,13 @@ Item { p2: Qt.point(t, 1 - t) p3: Qt.point(1 - t, t) } - Text { anchors.bottom: line.bottom + x: 20 width: parent.width - 40 wrapMode: Text.WordWrap - text: "This curve is a custom scene graph item, implemented using GL_LINE_STRIP" + text: qsTr("This curve is a custom scene graph item, implemented using line strips") } } diff --git a/examples/quick/window/Splash.qml b/examples/quick/window/Splash.qml index 0a7da219d..698942554 100644 --- a/examples/quick/window/Splash.qml +++ b/examples/quick/window/Splash.qml @@ -24,19 +24,20 @@ Window { Image { id: splashImage source: Images.qtLogo - MouseArea { - anchors.fill: parent - onClicked: Qt.quit() + TapHandler { + onTapped: splash.exit() } } + + function exit() { + splash.visible = false + splash.timeout() + } + //! [timer] Timer { - interval: splash.timeoutInterval; running: true; repeat: false - onTriggered: { - splash.visible = false - splash.timeout() - } + interval: splash.timeoutInterval; running: splash.visible; repeat: false + onTriggered: splash.exit() } //! [timer] - Component.onCompleted: visible = true } diff --git a/examples/quick/window/rc_window.py b/examples/quick/window/rc_window.py index 30b1fbf0a..13dd34325 100644 --- a/examples/quick/window/rc_window.py +++ b/examples/quick/window/rc_window.py @@ -1,290 +1,290 @@ # Resource object code (Python 3) # Created by: object code -# Created by: The Resource Compiler for Qt version 6.5.0 +# Created by: The Resource Compiler for Qt version 6.10.0 # WARNING! All changes made in this file will be lost! from PySide6 import QtCore qt_resource_data = b"\ -\x00\x00\x05\x12\ +\x00\x00\x04\xe8\ /\ / Copyright (C) \ 2021 The Qt Comp\ -any Ltd.\x0d\x0a// SPD\ -X-License-Identi\ -fier: LicenseRef\ --Qt-Commercial O\ -R BSD-3-Clause\x0d\x0a\ -\x0d\x0aimport QtQuick\ -\x0d\x0aimport QtQuick\ -.Controls\x0d\x0a\x0d\x0aCol\ -umn {\x0d\x0a id: r\ -oot\x0d\x0a spacing\ -: 8\x0d\x0a\x0d\x0a Label\ - {\x0d\x0a text\ -: \x22Total number \ -of screens: \x22 + \ -screenInfo.count\ -\x0d\x0a font.b\ -old: true\x0d\x0a }\ -\x0d\x0a\x0d\x0a Flow {\x0d\x0a\ +any Ltd.\x0a// SPDX\ +-License-Identif\ +ier: LicenseRef-\ +Qt-Commercial OR\ + BSD-3-Clause\x0a\x0ai\ +mport QtQuick\x0aim\ +port QtQuick.Con\ +trols\x0a\x0aColumn {\x0a\ + id: root\x0a \ + spacing: 8\x0a\x0a \ + Label {\x0a \ + text: \x22Total nu\ +mber of screens:\ + \x22 + screenInfo.\ +count\x0a fo\ +nt.bold: true\x0a \ + }\x0a\x0a Flow {\x0a\ spacing:\ - 12\x0d\x0a wid\ -th: parent.width\ -\x0d\x0a\x0d\x0a Repe\ -ater {\x0d\x0a \ - id: screenIn\ -fo\x0d\x0a \ -model: (Qt.appli\ + 12\x0a widt\ +h: parent.width\x0a\ +\x0a Repeate\ +r {\x0a \ +id: screenInfo\x0a \ + model\ +: (Qt.applicatio\ +n as Application\ +).screens\x0a \ + Label {\x0a \ + re\ +quired property \ +string name\x0a \ + requ\ +ired property in\ +t virtualX\x0a \ + requi\ +red property int\ + virtualY\x0a \ + requir\ +ed property var \ +modelData // avo\ +id shadowing Lab\ +el.width and hei\ +ght\x0a\x0a \ + lineHeight:\ + 1.5\x0a \ + text: name \ ++ \x22\x5cn\x22 + virtual\ +X + \x22, \x22 + virtu\ +alY + \x22 \x22 + mode\ +lData.width + \x22x\ +\x22 + modelData.he\ +ight\x0a \ + }\x0a }\x0a \ + }\x0a\x0a Componen\ +t.onCompleted: {\ +\x0a var scr\ +eens = (Qt.appli\ cation as Applic\ -ation).screens\x0d\x0a\ - Labe\ -l {\x0d\x0a \ - required pr\ -operty string na\ -me\x0d\x0a \ - required pro\ -perty int virtua\ -lX\x0d\x0a \ - required pro\ -perty int virtua\ -lY\x0d\x0a \ - required pro\ -perty var modelD\ -ata // avoid sha\ -dowing Label.wid\ -th and height\x0d\x0a\x0d\ -\x0a \ - lineHeight: 1.5\ -\x0d\x0a \ - text: name + \x22\ -\x5cn\x22 + virtualX +\ - \x22, \x22 + virtualY\ - + \x22 \x22 + modelDa\ -ta.width + \x22x\x22 +\ - modelData.heigh\ -t\x0d\x0a }\ -\x0d\x0a }\x0d\x0a \ - }\x0d\x0a\x0d\x0a Compon\ -ent.onCompleted:\ - {\x0d\x0a var \ -screens = (Qt.ap\ -plication as App\ -lication).screen\ -s;\x0d\x0a for \ -(var i = 0; i < \ -screens.length; \ -++i)\x0d\x0a \ - console.log(\x22s\ -creen \x22 + screen\ -s[i].name + \x22 ha\ -s geometry \x22 +\x0d\x0a\ - \ - screens[\ -i].virtualX + \x22,\ +ation).screens;\x0a\ + for (var\ + i = 0; i < scre\ +ens.length; ++i)\ +\x0a con\ +sole.log(\x22screen\ \x22 + screens[i].\ -virtualY + \x22 \x22 +\ -\x0d\x0a \ - screen\ -s[i].width + \x22x\x22\ - + screens[i].he\ -ight)\x0d\x0a }\x0d\x0a}\x0d\ -\x0a\ -\x00\x00\x04\x8a\ -\x00\ -\x00\x16\xa7x\xda\xcdXYo\xdbF\x10~7\xe0\xff\ -0a_\xec\x06\xba\x93\x17\x15Fa+H\x1d\xc0A\ -b\xcb\xa8\x03\x14}\xa0\xc9\x91\xb8\xf5\x8a+\xec.-\ -9\xae\xff{\x87\xc7\x92\x94\xb8$\xe5ZnJ\x08\x10\ -\xb9;;\xc77\x07g\xd8\xeb\xc1D,\x1f$\x9b\x07\ -\x1a\x8e&\xc70\xec\x0f\x07p\x1d \x5cj\xdaY,\ -\xdd\xf0\x01.\xb4\xdf=<\xe8\xf5`\xfa\xf5\xc3\xb7\xce\ -\x05\xf30T\xd8\xf9\xe4c\xa8\xd9\x8c\xa1\x1cC\xb6v\ -\x85\xb3\xce\xa5\xee\xd0\xb9\x05J\x8f\xb9\x1c\xbe\x5c\xc1\xd9\ -\xf4Cg\xd4\x99p7Rxxpx\xc0\x16K!\ -5\xf1\xbf\x8c\x98w\xb7\xfd\xdc\x9d\x88PK\xc1UL\ -z\xa9\xbf\xdc\xfe\x85\x9e\x86\xc7\xc3\x03\xa0\x8b\xf9c\x90\ -B\xe8\xf4i)\xc5\x12\xa5~\x00\x89$\xc9\xc7\x99\x1b\ -q=]\xba\x1e\x0b\xe7c\x18\xf4\xb7\xa8\xa6\x0fJ\xe3\ -\xe2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xdc\x15'f\xdc\x9d\ -\xd3\xb4v\xa9\xb3\xca\x0a\x7f\x17\xf7\x1f\xf3\x8a\x92\xbe\xe6\ -\xceYy\xe6\xad\xf5\xd3k\x8c\xca\xb5ymXy$\ -\x04\xe5\xa7\xd0.\xb0\x94\xdc\xd34\xb9+\xdf\x02,~\ -\xff,\x22\x85\xa74r7\x09\xae\xb7\xb2\xe5\x95\x9b\xba\ -\xe4\x84\xdc\x88}o4\xc0f]\xea\x9bX\xa3\x88L\ -#%\x0bLioH\x0c\xb1\x16\xcb\x9c\x94\xee\xeb\x09\ -wwQ\xcb\x88\xdc4\x16P\x09\xc55\xd3Pz\x85\ -\xc5\xa5t.\xca+\xb5)>x\xdfo\x04\xbe\xae\xf1\ -\x9f\xc1\xd1s5=\xae+\xe8\xb0\xbf>>\xbe\x90+\ -|\x99\xa8g\xccH\xcf\x8e4\x8e\xb3\x22\xd0\xe2\x87\x1f\ -\x14g\xce\xb7\xfa\xa0\x18\xf5\x9f\x97\x8c\x5c(<\xaa\x7f\ -\x936\x96u\xb5\xe4\xae\x0aLa\x9f&Oe\xfcD\ -x\xcd\x16(\x22\x93\x1a\x1b\x9fUK\x9f}\xb4\x8c0\ -\x97C\xbf\x7f\x00\xe8k\x05\xe6\ -\x00\x00\x04$\ +name + \x22 has geo\ +metry \x22 +\x0a \ + \ + screens[i].vir\ +tualX + \x22, \x22 + s\ +creens[i].virtua\ +lY + \x22 \x22 +\x0a \ + \ + screens[i].wi\ +dth + \x22x\x22 + scre\ +ens[i].height)\x0a \ + }\x0a}\x0a\ +\x00\x00\x05\x01\ +(\ +\xb5/\xfd`\xff\x16\xbd'\x00\x06p\x912`\x8d:\ +0\x0c\xc3\xc0\x161\x1c\x00\x98G\xc1\xb5\xb6\x93$\xda\ +IN\x11E,I\x22\xd5#\xdck\xe3\x5c\x9d/Y\ +\xc2BlU\xb2\xcdF\x1e\x12Xb\x833\xad\x1c\x83\ +\x00~\x00\x85\x00\x15\xc9\xe1\xec\x8b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 +\x9fRI\xaf\xbc\x99\x1cC\x0eK?\x9e\xdc\x86\xc3$\ +\xfe)\xab-\x01v\xbb\x1e\x8e\xdd\xfbm\x12\xc8\x1b\xf5\ +\xce\x1fym\xd8\x10\x0e\xe5\xd5w\xd1\x05m\x14`\xd5\ +\x0bAo)\xb0c,\x81'H\x81.xsAP\ +=&\xe5\xa0Z\xe0\x828\xa6\xdc\xde\xa0\xeb\x8e\xb1F\ +\xcb\xc0D6_,\x04\xa8y\xe0\xdf\x95\x9f\xfb\xe1\x97\ +\xa3I\xa6\x1f#k)\xf4\xaf\x03m\xd7\xc8AP\x12\ +]\x154_\xbd\x1cU\x0dcv\xb8\xbf\x1a\xc0\xa8\x02\ +\ +\x00\x00\x03\xd5\ /\ / Copyright (C) \ 2021 The Qt Comp\ -any Ltd.\x0d\x0a// SPD\ -X-License-Identi\ -fier: LicenseRef\ --Qt-Commercial O\ -R BSD-3-Clause\x0d\x0a\ -\x0d\x0aimport QtQuick\ -\x0d\x0aimport shared\x0d\ -\x0a\x0d\x0a//! [splash-p\ -roperties]\x0d\x0aWind\ -ow {\x0d\x0a id: sp\ -lash\x0d\x0a color:\ - \x22transparent\x22\x0d\x0a\ - title: \x22Spla\ -sh Window\x22\x0d\x0a \ -modality: Qt.App\ -licationModal\x0d\x0a \ - flags: Qt.Spl\ -ashScreen\x0d\x0a p\ -roperty int time\ -outInterval: 200\ -0\x0d\x0a signal ti\ -meout\x0d\x0a//! [spla\ -sh-properties]\x0d\x0a\ +any Ltd.\x0a// SPDX\ +-License-Identif\ +ier: LicenseRef-\ +Qt-Commercial OR\ + BSD-3-Clause\x0a\x0ai\ +mport QtQuick\x0aim\ +port shared\x0a\x0a//!\ + [splash-propert\ +ies]\x0aWindow {\x0a \ + id: splash\x0a \ + color: \x22transpa\ +rent\x22\x0a title:\ + \x22Splash Window\x22\ +\x0a modality: Q\ +t.ApplicationMod\ +al\x0a flags: Qt\ +.SplashScreen\x0a \ + property int t\ +imeoutInterval: \ +2000\x0a signal \ +timeout\x0a//! [spl\ +ash-properties]\x0a\ //! [screen-prop\ -erties]\x0d\x0a x: \ -(Screen.width - \ -splashImage.widt\ -h) / 2\x0d\x0a y: (\ -Screen.height - \ -splashImage.heig\ -ht) / 2\x0d\x0a//! [sc\ -reen-properties]\ -\x0d\x0a width: spl\ -ashImage.width\x0d\x0a\ - height: spla\ -shImage.height\x0d\x0a\ -\x0d\x0a Image {\x0d\x0a \ - id: splas\ -hImage\x0d\x0a \ -source: Images.q\ -tLogo\x0d\x0a M\ -ouseArea {\x0d\x0a \ - anchors.\ -fill: parent\x0d\x0a \ - onClic\ -ked: Qt.quit()\x0d\x0a\ - }\x0d\x0a }\ -\x0d\x0a //! [timer\ -]\x0d\x0a Timer {\x0d\x0a\ - interval\ -: splash.timeout\ -Interval; runnin\ -g: true; repeat:\ - false\x0d\x0a \ -onTriggered: {\x0d\x0a\ - spla\ -sh.visible = fal\ -se\x0d\x0a \ -splash.timeout()\ -\x0d\x0a }\x0d\x0a \ - }\x0d\x0a //! [tim\ -er]\x0d\x0a Compone\ -nt.onCompleted: \ -visible = true\x0d\x0a\ -}\x0d\x0a\ -\x00\x00\x03\x08\ -\x00\ -\x00\x0a\xb7x\xda\xadV\xdfo\xda0\x10~G\xe2\x7f\ -\xb8\xe5\x09\xb6\x91\x00\xeb\xa6)}\x986\xaam\x95\xd0\ -\xdaB\xa5uZ\xf7`\x92\x03\xac&v\xe48\x144\ -\xf5\x7f\x9f\x9d\x1f\x8d\x01\x0f\x82\xb6\x08\x89\xdc\xf9\xbb\xfb\ ->\xdbg_<\x0fF<\xd9\x08\xbaXJ\xe8\x8c\xba\ -0\xec\x0f\x07p\xbbD\xb8\x91j$N\x08\xdb\xc0X\ -\x86n\xbb\xe5y0\xbd\xbe\xb8\xeb\x8di\x80,\xc5\xde\ -e\x88L\xd29E\xe1C\xe9\x9b\xe0\xbcw#{*\ -.F\x11P\x12\xc1\xd5\x04>M/zoz\xa3\x88\ -d)\xb6[\xed\x16\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f26e\ -\x0ei\xac\xaeMu\x00\xd2\xe3\xb4\xf9\xe6\xe9\x12X\x1b\ -eQ\xec\xe3A\x8e\x84\xae\x95\x19j\x1e\xb99N\x93\ -\xc3/\x0a\xb4+\xf9ge\x86\x9daW\x13C\xc8e\ -\xea\xc51t\xb4\x82\x8e%\x00^\xc2\xf0\xad{\xd6\xb5\ -\x06R\x16,\xbb\x87\xd7#\xe2\x0b\x1a\xa8\xad8Qs\ -\x19v}\xaatK\xdc\xbf\xce \xc4\x95j\x85\xe5\x04\ -\x84\xbe\xdc\x8e\xcb/br\x15\x13\x1dar\x1f\xe2\x22\ -+B#2\x8b\x10VT\xc8\x8c\xe8\x15K\x1f$O\ -\x9aP\xe6\xc0\x8fU\x86\xef\xb6\xe2\xda\x05}mPl\ -\x5c-\xa2n\xab\x94\x9d.\xaa\x0c\xb8\xd3:^\x83!\ -\xa4\x1c\xf8q\x90\xdah\xe4\x07\xa8\xf4\x17\x84k\xeb\xf9\ -%\x951Tl|\xc7\xd0a\x0c\xea\xb1#\xa5P6\ -|\xf8?\xc2\x92\xbd\xef\x8c}}\xfb\x98Z\xa6\xbd\x1d\ -\xfdU\xfc\xa0\xaf\x0e\x8b\xc0@\x12\xb6\x88p+\xc3\xa4\ -\xf2\xee\xb6/\xd5;\xb9\xfa\x16t\x04\x86;=\xaal\ -<\xf6\x1bc\xd0\xdf\x06W\xbd)\x0f\xdakg\xeaO\ -\xfd\xfe\x00\x1e\x91\x1e\xa9\ +erties]\x0a x: (\ +Screen.width - s\ +plashImage.width\ +) / 2\x0a y: (Sc\ +reen.height - sp\ +lashImage.height\ +) / 2\x0a//! [scree\ +n-properties]\x0a \ + width: splashI\ +mage.width\x0a h\ +eight: splashIma\ +ge.height\x0a\x0a I\ +mage {\x0a i\ +d: splashImage\x0a \ + source: I\ +mages.qtLogo\x0a \ + TapHandler \ +{\x0a on\ +Tapped: splash.e\ +xit()\x0a }\x0a\ + }\x0a\x0a funct\ +ion exit() {\x0a \ + splash.visi\ +ble = false\x0a \ + splash.timeo\ +ut()\x0a }\x0a\x0a \ +//! [timer]\x0a \ +Timer {\x0a \ +interval: splash\ +.timeoutInterval\ +; running: splas\ +h.visible; repea\ +t: false\x0a \ + onTriggered: sp\ +lash.exit()\x0a \ +}\x0a //! [timer\ +]\x0a}\x0a\ +\x00\x00\x03\x03\ +(\ +\xb5/\xfd`d\x09\xcd\x17\x00fbg\x1f\x00\xdb6\ +\x8e\x19\x94\xa4Zd_\xd9sQ1d\xb4\x22\x92\x81\ +P\xe2a+\xcaH\xcc\xa5\xff\xed?\x94`\x00\x5c\x00\ +^\x00\xddtf\xe6\x0c\xc6^?&\xcb@j\xefW\ +;\xd9V\xd2\xc3\xcew\xf8\xaf\xfd<\xcf\xb2\x06\xc3H\ +'\x06\x85\x81\xf2\x91\xb0g\xc34\xba\xbc\xed\x19\xbec\ +@\xb5\x87\xbb\xdb\x8e\xf2\xaf=1\x86\x06kK\xcf\x18\ +D\x14\xce'\xdb\xe6g\xf8U\xe3\xe7\xd9\x09\x7f\x87[\ +\x05bD\xe2\x90`\xc1$\xc0\xafJ\xf9}}v\xc2\ +\x1c\x17\xb6\xaej\x98\xc5\xd8g\xffmV\xc5\xd0\xfe\xa2\ +\x04g\x8d\x99\xf7x\xff\xda\x87\xf6i\x5co\xf8}9\ +\xeb6\xaf\x1b=\xbf\x9c\x0d\x8c\x92U\xf2\xbd\x05\x0al\ + U\xfd\xfe\xc7\x82\xe2\xd7\xf6k\xb9Z\x7fYCT\ +\xd6@0\x81/\xef\xd2\xe96\xfdZ^\x7f\xfb\xb3\xf7\ +\xe3\xaeU\x87\xc3\x82;\xd5Oo\xbd\xb5\x97\x03\xb5=\ +\x9f\x9a\x93\x17V\xa6\xd1o\x83\xb4\xa7\x8dq\x07\xe1\x18\ +k\xb7o\xf82\xa2\xc2\x1a\xbd\xec6\xc7q\x8c\x11\x0f\ +D\x87\xf7\xb9\x9b\xd4\x9e\xb6\xaf\x16\xa5uZIc\x02\ +\xb7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+\xf1\xaf\x0f\x82\x0dt\xe6\xa4\x01G@\x07\xa5;^\x0c\ +v\x14\xe4\x90k*\x5c\xfe\x9b\x14o\xd6@9\xd6\xa2\ +\x7f\xb0\x85\x1f\xe7yV2\xe4+\xf4\xcc1S<\x98\ +\x01\x9e<Q]\xa5R\xc8\xc4\x84\x06\x22!\x8f\x0f$\ +\xcc\xec\x19pP\xe8\xed\xc2\x83\xa3\xc1H.\xd7\x80\x85\ +\x91K\xe8\xdc\x9cW\xf2V\x8a\x15\x02\xbeH,\xe0<\ +\x16\x8c\xbbSP\xfb_\xd8)}\x00u\xcc(5\xe0\ +U\x01\ " qt_resource_name = b"\ @@ -316,14 +316,14 @@ qt_resource_struct = b"\ \x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x00\x00\x02\x00\x00\x00\x04\x00\x00\x00\x02\ \x00\x00\x00\x00\x00\x00\x00\x00\ -\x00\x00\x00h\x00\x01\x00\x00\x00\x01\x00\x00\x0d\xcc\ -\x00\x00\x01\x87V\x12\x92R\ -\x00\x00\x00N\x00\x00\x00\x00\x00\x01\x00\x00\x09\xa4\ -\x00\x00\x01\x87V\x12\x92R\ -\x00\x00\x004\x00\x01\x00\x00\x00\x01\x00\x00\x05\x16\ -\x00\x00\x01\x87V\x12\x92R\ +\x00\x00\x00h\x00\x04\x00\x00\x00\x01\x00\x00\x0d\xca\ +\x00\x00\x01\x975l\xc7\xec\ +\x00\x00\x00N\x00\x00\x00\x00\x00\x01\x00\x00\x09\xf1\ +\x00\x00\x01\x998\xf9\x98B\ +\x00\x00\x004\x00\x04\x00\x00\x00\x01\x00\x00\x04\xec\ +\x00\x00\x01\x998\xf9\x98B\ \x00\x00\x00\x12\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x01\x87V\x12\x92R\ +\x00\x00\x01\x975l\xc7\xec\ " def qInitResources(): diff --git a/examples/quick/window/window.qml b/examples/quick/window/window.qml index 47cc5257b..99ff4403e 100644 --- a/examples/quick/window/window.qml +++ b/examples/quick/window/window.qml @@ -7,12 +7,11 @@ import QtQuick.Controls QtObject { id: root property real defaultSpacing: 10 - property SystemPalette palette: SystemPalette { } property var controlWindow: Window { width: col.implicitWidth + root.defaultSpacing * 2 height: col.implicitHeight + root.defaultSpacing * 2 - color: root.palette.window + color: palette.window title: "Control Window" Column { id: col @@ -90,13 +89,13 @@ QtObject { " and has visibility " + parent.visibilityToString(root.testWindow.visibility) } Rectangle { - color: root.palette.text + color: palette.text width: parent.width height: 1 } CurrentScreen { } Rectangle { - color: root.palette.text + color: palette.text width: parent.width height: 1 } @@ -117,35 +116,44 @@ QtObject { anchors.centerIn: parent text: "Second Window" } - MouseArea { - anchors.fill: parent - onClicked: root.testWindow.color = "#e0c31e" + TapHandler { + onTapped: root.testWindow.color = Qt.rgba(0.25 + Math.random() / 2, + 0.65 + Math.random() / 4, + 0.15 + Math.random() / 3) } Button { - anchors.right: parent.right - anchors.top: parent.top - anchors.margins: root.defaultSpacing - text: root.testWindow.visibility === Window.FullScreen ? "exit fullscreen" : "go fullscreen" - width: 150 - onClicked: { - if (root.testWindow.visibility === Window.FullScreen) - root.testWindow.visibility = Window.AutomaticVisibility - else - root.testWindow.visibility = Window.FullScreen + id: fullscreenButton + anchors { + right: parent.right + top: parent.top + margins: root.defaultSpacing } + width: height + checkable: true + Binding on checked { value: root.testWindow.visibility === Window.FullScreen } + onClicked: root.testWindow.visibility = checked ? Window.FullScreen : Window.AutomaticVisibility + text: "âļ" + ToolTip.visible: hovered + ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval + ToolTip.text: root.testWindow.visibility === Window.FullScreen ? qsTr("restore") : qsTr("fill screen") } Button { anchors.left: parent.left anchors.top: parent.top anchors.margins: root.defaultSpacing - text: "X" - width: 30 + text: "â" + width: height + height: fullscreenButton.height onClicked: root.testWindow.close() + ToolTip.visible: hovered + ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval + ToolTip.text: qsTr("close this window") } } } property var splashWindow: Splash { + visible: true onTimeout: root.controlWindow.visible = true } } diff --git a/examples/quick/window/window.qrc b/examples/quick/window/window.qrc index 89d1de1b1..b9ae1d931 100644 --- a/examples/quick/window/window.qrc +++ b/examples/quick/window/window.qrc @@ -1,5 +1,5 @@ <RCC> - <qresource prefix="/window"> + <qresource prefix="window"> <file>window.qml</file> <file>Splash.qml</file> <file>CurrentScreen.qml</file> diff --git a/examples/quick3d/intro/main.qml b/examples/quick3d/intro/main.qml index 648cfcf5c..ab4e6a6de 100644 --- a/examples/quick3d/intro/main.qml +++ b/examples/quick3d/intro/main.qml @@ -42,8 +42,8 @@ Window { position: Qt.vector3d(0, -200, 0) source: "#Cylinder" scale: Qt.vector3d(2, 0.2, 1) - materials: [ DefaultMaterial { - diffuseColor: "red" + materials: [ PrincipledMaterial { + baseColor: "red" } ] } @@ -52,8 +52,8 @@ Window { position: Qt.vector3d(0, 150, 0) source: "#Sphere" - materials: [ DefaultMaterial { - diffuseColor: "blue" + materials: [ PrincipledMaterial { + baseColor: "blue" } ] diff --git a/examples/quickcontrols/filesystemexplorer/FileSystemModule/Main.qml b/examples/quickcontrols/filesystemexplorer/FileSystemModule/Main.qml index 7f7798ed8..36f2ac3b2 100644 --- a/examples/quickcontrols/filesystemexplorer/FileSystemModule/Main.qml +++ b/examples/quickcontrols/filesystemexplorer/FileSystemModule/Main.qml @@ -1,6 +1,5 @@ // Copyright (C) 2023 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - import QtQuick import QtQuick.Controls.Basic import QtQuick.Layouts @@ -22,7 +21,7 @@ ApplicationWindow { visible: true color: Colors.background flags: Qt.Window | Qt.FramelessWindowHint - title: qsTr("File System Explorer Example") + title: qsTr("File System Explorer") function getInfoText() : string { let out = root.currentFilePath diff --git a/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/About.qml b/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/About.qml index 178bf03e4..0d308a2a1 100644 --- a/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/About.qml +++ b/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/About.qml @@ -16,7 +16,7 @@ ApplicationWindow { id: menuBar dragWindow: root - implicitHeight: 27 + implicitHeight: 30 infoText: "About Qt" } diff --git a/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/Editor.qml b/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/Editor.qml index 80f7c04c5..2f995c88c 100644 --- a/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/Editor.qml +++ b/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/Editor.qml @@ -36,6 +36,7 @@ Rectangle { Layout.preferredWidth: fontMetrics.averageCharacterWidth * (Math.floor(Math.log10(textArea.lineCount)) + 1) + 10 Layout.fillHeight: true + Layout.fillWidth: false interactive: false contentY: editorFlickable.contentY diff --git a/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/ResizeButton.qml b/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/ResizeButton.qml index 0df65bf82..5d3b68b35 100644 --- a/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/ResizeButton.qml +++ b/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/ResizeButton.qml @@ -1,6 +1,7 @@ // Copyright (C) 2023 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +import QtQml import QtQuick.Controls import FileSystemModule diff --git a/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/Sidebar.qml b/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/Sidebar.qml index aac530394..f739e0f93 100644 --- a/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/Sidebar.qml +++ b/examples/quickcontrols/filesystemexplorer/FileSystemModule/qml/Sidebar.qml @@ -50,6 +50,8 @@ Rectangle { id: tabBarComponent Layout.fillWidth: true + Layout.fillHeight: false + // ButtonGroup ensures that only one button can be checked at a time. ButtonGroup { buttons: tabBarComponent.contentChildren diff --git a/examples/quickcontrols/filesystemexplorer/FileSystemModule/qmldir b/examples/quickcontrols/filesystemexplorer/FileSystemModule/qmldir index b1f684600..f94e68a8a 100644 --- a/examples/quickcontrols/filesystemexplorer/FileSystemModule/qmldir +++ b/examples/quickcontrols/filesystemexplorer/FileSystemModule/qmldir @@ -1,8 +1,9 @@ module FileSystemModule + Main 1.0 Main.qml About 1.0 qml/About.qml -Editor 1.0 qml/Editor.qml MyMenu 1.0 qml/MyMenu.qml +Editor 1.0 qml/Editor.qml Sidebar 1.0 qml/Sidebar.qml MyMenuBar 1.0 qml/MyMenuBar.qml singleton Colors 1.0 qml/Colors.qml diff --git a/examples/webenginequick/nanobrowser/ApplicationRoot.qml b/examples/webenginequick/nanobrowser/ApplicationRoot.qml index f36249802..ec5716207 100644 --- a/examples/webenginequick/nanobrowser/ApplicationRoot.qml +++ b/examples/webenginequick/nanobrowser/ApplicationRoot.qml @@ -1,22 +1,24 @@ // Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound + import QtQuick import QtWebEngine QtObject { id: root - property QtObject defaultProfilePrototype : WebEngineProfilePrototype { + property WebEngineProfilePrototype defaultProfilePrototype : WebEngineProfilePrototype { storageName: "Profile" Component.onCompleted: { - let fullVersionList = defaultProfilePrototype.instance().clientHints.fullVersionList; + let fullVersionList = root.defaultProfilePrototype.instance().clientHints.fullVersionList; fullVersionList["QuickNanoBrowser"] = "1.0"; - defaultProfilePrototype.instance().clientHints.fullVersionList = fullVersionList; + root.defaultProfilePrototype.instance().clientHints.fullVersionList = fullVersionList; } } - property QtObject otrPrototype : WebEngineProfilePrototype { + property WebEngineProfilePrototype otrPrototype : WebEngineProfilePrototype { } property Component browserWindowComponent: BrowserWindow { @@ -26,18 +28,18 @@ QtObject { onClosing: destroy() } function createWindow(profile) { - var newWindow = browserWindowComponent.createObject(root); + var newWindow = browserWindowComponent.createObject(root) as BrowserWindow; newWindow.currentWebView.profile = profile; profile.downloadRequested.connect(newWindow.onDownloadRequested); return newWindow; } function createDialog(profile) { - var newDialog = browserDialogComponent.createObject(root); + var newDialog = browserDialogComponent.createObject(root) as BrowserDialog; newDialog.currentWebView.profile = profile; return newDialog; } function load(url) { - var browserWindow = createWindow(defaultProfilePrototype.instance()); + var browserWindow = createWindow(root.defaultProfilePrototype.instance()); browserWindow.currentWebView.url = url; } } diff --git a/examples/webenginequick/nanobrowser/BrowserWindow.qml b/examples/webenginequick/nanobrowser/BrowserWindow.qml index 365d77d21..474968b87 100644 --- a/examples/webenginequick/nanobrowser/BrowserWindow.qml +++ b/examples/webenginequick/nanobrowser/BrowserWindow.qml @@ -1,6 +1,8 @@ // Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound + import QtCore import QtQml import QtQuick @@ -12,16 +14,17 @@ import QtWebEngine import BrowserUtils ApplicationWindow { - id: browserWindow - property QtObject applicationRoot - property Item currentWebView: tabBar.currentIndex < tabBar.count ? tabLayout.children[tabBar.currentIndex] : null + id: win + required property QtObject applicationRoot + property WebEngineView currentWebView: tabBar.currentIndex < tabBar.count ? tabLayout.children[tabBar.currentIndex] : null property int previousVisibility: Window.Windowed property int createdTabs: 0 + property bool lastTabClosing: false width: 1300 height: 900 visible: true - title: currentWebView && currentWebView.title + title: win.currentWebView?.title ?? "" // Make sure the Qt.WindowFullscreenButtonHint is set on OS X. Component.onCompleted: flags = flags | Qt.WindowFullscreenButtonHint @@ -31,7 +34,7 @@ ApplicationWindow { } // When using style "mac", ToolButtons are not supposed to accept focus. - property bool platformIsMac: Qt.platform.os == "osx" + property bool platformIsMac: Qt.platform.os === "osx" Settings { id : appSettings @@ -46,6 +49,8 @@ ApplicationWindow { property alias devToolsEnabled: devToolsEnabled.checked property alias pdfViewerEnabled: pdfViewerEnabled.checked property int imageAnimationPolicy: WebEngineSettings.ImageAnimationPolicy.Allow + property alias javascriptCanAccessClipboard: javascriptCanAccessClipboard.checked + property alias javascriptCanPaste: javascriptCanPaste.checked } Action { @@ -65,14 +70,16 @@ ApplicationWindow { Action { shortcut: StandardKey.Refresh onTriggered: { - if (currentWebView) - currentWebView.reload(); + if (win.currentWebView) + win.currentWebView.reload(); } } Action { shortcut: StandardKey.AddTab onTriggered: { - tabBar.createTab(tabBar.count != 0 ? currentWebView.profile : defaultProfilePrototype.instance()); + tabBar.createTab(tabBar.count !== 0 + ? win.currentWebView.profile + : (win.applicationRoot as ApplicationRoot).defaultProfilePrototype.instance()); addressBar.forceActiveFocus(); addressBar.selectAll(); } @@ -80,20 +87,20 @@ ApplicationWindow { Action { shortcut: StandardKey.Close onTriggered: { - currentWebView.triggerWebAction(WebEngineView.RequestClose); + win.currentWebView.triggerWebAction(WebEngineView.RequestClose); } } Action { shortcut: StandardKey.Quit - onTriggered: browserWindow.close() + onTriggered: win.close() } Action { shortcut: "Escape" onTriggered: { - if (currentWebView.state == "FullScreen") { - browserWindow.visibility = browserWindow.previousVisibility; + if (win.currentWebView.state === "FullScreen") { + win.visibility = win.previousVisibility; fullScreenNotification.hide(); - currentWebView.triggerWebAction(WebEngineView.ExitFullScreen); + win.currentWebView.triggerWebAction(WebEngineView.ExitFullScreen); } if (findBar.visible) @@ -102,52 +109,52 @@ ApplicationWindow { } Action { shortcut: "Ctrl+0" - onTriggered: currentWebView.zoomFactor = 1.0 + onTriggered: win.currentWebView.zoomFactor = 1.0 } Action { shortcut: StandardKey.ZoomOut - onTriggered: currentWebView.zoomFactor -= 0.1 + onTriggered: win.currentWebView.zoomFactor -= 0.1 } Action { shortcut: StandardKey.ZoomIn - onTriggered: currentWebView.zoomFactor += 0.1 + onTriggered: win.currentWebView.zoomFactor += 0.1 } Action { shortcut: StandardKey.Copy - onTriggered: currentWebView.triggerWebAction(WebEngineView.Copy) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.Copy) } Action { shortcut: StandardKey.Cut - onTriggered: currentWebView.triggerWebAction(WebEngineView.Cut) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.Cut) } Action { shortcut: StandardKey.Paste - onTriggered: currentWebView.triggerWebAction(WebEngineView.Paste) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.Paste) } Action { shortcut: "Shift+"+StandardKey.Paste - onTriggered: currentWebView.triggerWebAction(WebEngineView.PasteAndMatchStyle) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.PasteAndMatchStyle) } Action { shortcut: StandardKey.SelectAll - onTriggered: currentWebView.triggerWebAction(WebEngineView.SelectAll) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.SelectAll) } Action { shortcut: StandardKey.Undo - onTriggered: currentWebView.triggerWebAction(WebEngineView.Undo) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.Undo) } Action { shortcut: StandardKey.Redo - onTriggered: currentWebView.triggerWebAction(WebEngineView.Redo) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.Redo) } Action { shortcut: StandardKey.Back - onTriggered: currentWebView.triggerWebAction(WebEngineView.Back) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.Back) } Action { shortcut: StandardKey.Forward - onTriggered: currentWebView.triggerWebAction(WebEngineView.Forward) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.Forward) } Action { shortcut: StandardKey.Find @@ -170,16 +177,17 @@ ApplicationWindow { RowLayout { anchors.fill: parent ToolButton { - enabled: currentWebView && (currentWebView.canGoBack || currentWebView.canGoForward) + enabled: win.currentWebView?.canGoBack || win.currentWebView?.canGoForward onClicked: historyMenu.open() text: qsTr("âŧ") Menu { id: historyMenu Instantiator { - model: currentWebView && currentWebView.history.items + model: win.currentWebView?.history?.items MenuItem { + required property var model text: model.title - onTriggered: currentWebView.goBackOrForward(model.offset) + onTriggered: win.currentWebView.goBackOrForward(model.offset) checkable: !enabled checked: !enabled enabled: model.offset @@ -197,23 +205,25 @@ ApplicationWindow { ToolButton { id: backButton - icon.source: "qrc:/icons/go-previous.png" - onClicked: currentWebView.goBack() - enabled: currentWebView && currentWebView.canGoBack - activeFocusOnTab: !browserWindow.platformIsMac + icon.source: "icons/3rdparty/go-previous.png" + onClicked: win.currentWebView.goBack() + enabled: win.currentWebView?.canGoBack ?? false + activeFocusOnTab: !win.platformIsMac } ToolButton { id: forwardButton - icon.source: "qrc:/icons/go-next.png" - onClicked: currentWebView.goForward() - enabled: currentWebView && currentWebView.canGoForward - activeFocusOnTab: !browserWindow.platformIsMac + icon.source: "icons/3rdparty/go-next.png" + onClicked: win.currentWebView.goForward() + enabled: win.currentWebView?.canGoForward ?? false + activeFocusOnTab: !win.platformIsMac } ToolButton { id: reloadButton - icon.source: currentWebView && currentWebView.loading ? "qrc:/icons/process-stop.png" : "qrc:/icons/view-refresh.png" - onClicked: currentWebView && currentWebView.loading ? currentWebView.stop() : currentWebView.reload() - activeFocusOnTab: !browserWindow.platformIsMac + icon.source: win.currentWebView?.loading + ? "icons/3rdparty/process-stop.png" + : "icons/3rdparty/view-refresh.png" + onClicked: win.currentWebView?.loading ? win.currentWebView.stop() : win.currentWebView.reload() + activeFocusOnTab: !win.platformIsMac } TextField { id: addressBar @@ -224,7 +234,7 @@ ApplicationWindow { id: faviconImage width: 16; height: 16 sourceSize: Qt.size(width, height) - source: currentWebView && currentWebView.icon ? currentWebView.icon : '' + source: win.currentWebView?.icon ? win.currentWebView.icon : '' } MouseArea { id: textFieldMouseArea @@ -272,10 +282,10 @@ ApplicationWindow { focus: true Layout.fillWidth: true Binding on text { - when: currentWebView - value: currentWebView.url + when: win.currentWebView + value: win.currentWebView.url } - onAccepted: currentWebView.url = Utils.fromUserInput(text) + onAccepted: win.currentWebView.url = Utils.fromUserInput(text) selectByMouse: true } ToolButton { @@ -319,21 +329,25 @@ ApplicationWindow { id: offTheRecordEnabled text: "Off The Record" checkable: true - checked: currentWebView && currentWebView.profile === otrPrototype.instance() - onToggled: function(checked) { - if (currentWebView) { - currentWebView.profile = checked ? otrPrototype.instance() : defaultProfilePrototype.instance(); + checked: win.currentWebView?.profile === (win.applicationRoot as ApplicationRoot).otrPrototype.instance() + onToggled: function() { + if (win.currentWebView) { + win.currentWebView.profile = offTheRecordEnabled.checked + ? (win.applicationRoot as ApplicationRoot).otrPrototype.instance() + : (win.applicationRoot as ApplicationRoot).defaultProfilePrototype.instance(); } } } MenuItem { id: httpDiskCacheEnabled text: "HTTP Disk Cache" - checkable: currentWebView && !currentWebView.profile.offTheRecord - checked: currentWebView && (currentWebView.profile.httpCacheType === WebEngineProfile.DiskHttpCache) - onToggled: function(checked) { - if (currentWebView) { - currentWebView.profile.httpCacheType = checked ? WebEngineProfile.DiskHttpCache : WebEngineProfile.MemoryHttpCache; + checkable: !win.currentWebView?.profile?.offTheRecord ?? false + checked: win.currentWebView?.profile.httpCacheType === WebEngineProfile.DiskHttpCache + onToggled: function() { + if (win.currentWebView) { + win.currentWebView.profile.httpCacheType = httpDiskCacheEnabled.checked + ? WebEngineProfile.DiskHttpCache + : WebEngineProfile.MemoryHttpCache; } } } @@ -368,7 +382,6 @@ ApplicationWindow { checkable: true checked: WebEngine.settings.pdfViewerEnabled } - Menu { id: imageAnimationPolicy title: "Image Animation Policy" @@ -407,6 +420,18 @@ ApplicationWindow { } } + MenuItem { + id: javascriptCanAccessClipboard + text: "JavaScript can access clipboard" + checkable: true + checked: WebEngine.settings.javascriptCanAccessClipboard + } + MenuItem { + id: javascriptCanPaste + text: "JavaScript can paste" + checkable: true + checked: WebEngine.settings.javascriptCanPaste + } } } } @@ -417,14 +442,14 @@ ApplicationWindow { left: parent.left top: parent.bottom right: parent.right - leftMargin: parent.leftMargin - rightMargin: parent.rightMargin + leftMargin: parent.anchors.leftMargin + rightMargin: parent.anchors.rightMargin } background: Item {} z: -2 from: 0 to: 100 - value: (currentWebView && currentWebView.loadProgress < 100) ? currentWebView.loadProgress : 0 + value: (win.currentWebView?.loadProgress < 100) ? win.currentWebView.loadProgress : 0 } } @@ -442,22 +467,22 @@ ApplicationWindow { id: tabButtonComponent TabButton { - property color frameColor: "#999" - property color fillColor: "#eee" - property color nonSelectedColor: "#ddd" + id: tabButton + property color frameColor: "#999999" + property color fillColor: "#eeeeee" + property color nonSelectedColor: "#dddddd" property string tabTitle: "New Tab" - id: tabButton contentItem: Rectangle { id: tabRectangle - color: tabButton.down ? fillColor : nonSelectedColor + color: tabButton.down ? tabButton.fillColor : tabButton.nonSelectedColor border.width: 1 - border.color: frameColor + border.color: tabButton.frameColor implicitWidth: Math.max(text.width + 30, 80) implicitHeight: Math.max(text.height + 10, 20) - Rectangle { height: 1 ; width: parent.width ; color: frameColor} - Rectangle { height: parent.height ; width: 1; color: frameColor} - Rectangle { x: parent.width - 2; height: parent.height ; width: 1; color: frameColor} + Rectangle { height: 1 ; width: parent.width ; color: tabButton.frameColor} + Rectangle { height: parent.height ; width: 1; color: tabButton.frameColor} + Rectangle { x: parent.width - 2; height: parent.height ; width: 1; color: tabButton.frameColor} Text { id: text anchors.left: parent.left @@ -465,7 +490,7 @@ ApplicationWindow { anchors.leftMargin: 6 text: tabButton.tabTitle elide: Text.ElideRight - color: tabButton.down ? "black" : frameColor + color: tabButton.down ? "black" : tabButton.frameColor width: parent.width - button.background.width } Button { @@ -477,16 +502,16 @@ ApplicationWindow { background: Rectangle { implicitWidth: 12 implicitHeight: 12 - color: button.hovered ? "#ccc" : tabRectangle.color + color: button.hovered ? "#cccccc" : tabRectangle.color Text {text: "x"; anchors.centerIn: parent; color: "gray"} } onClicked: tabButton.closeTab() } } - onClicked: addressBar.text = tabLayout.itemAt(TabBar.index).url; + onClicked: addressBar.text = (tabLayout.itemAt(TabBar.index) as WebEngineView).url; function closeTab() { - tabBar.removeView(TabBar.index); + tabBar.tryCloseView(TabBar.index); } } } @@ -496,10 +521,10 @@ ApplicationWindow { anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right - Component.onCompleted: createTab(defaultProfilePrototype.instance()) + Component.onCompleted: createTab((win.applicationRoot as ApplicationRoot).defaultProfilePrototype.instance()) function createTab(profile, focusOnNewTab = true, url = undefined) { - var webview = tabComponent.createObject(tabLayout, {profile: profile}); + var webview = tabComponent.createObject(tabLayout, {index: tabBar.count , profile: profile}); var newTabButton = tabButtonComponent.createObject(tabBar, {tabTitle: Qt.binding(function () { return webview.title; })}); tabBar.addItem(newTabButton); if (focusOnNewTab) { @@ -511,12 +536,17 @@ ApplicationWindow { return webview; } + function tryCloseView(index) { + tabLayout.children[index].triggerWebAction(WebEngineView.RequestClose); + } + function removeView(index) { if (tabBar.count > 1) { tabBar.removeItem(tabBar.itemAt(index)); tabLayout.children[index].destroy(); } else { - browserWindow.close(); + win.lastTabClosing = true; + win.close(); } } @@ -524,10 +554,11 @@ ApplicationWindow { id: tabComponent WebEngineView { id: webEngineView + property int index; focus: true onLinkHovered: function(hoveredUrl) { - if (hoveredUrl == "") + if (hoveredUrl === "") hideStatusText.start(); else { statusText.text = hoveredUrl; @@ -563,6 +594,12 @@ ApplicationWindow { settings.pdfViewerEnabled: appSettings.pdfViewerEnabled settings.imageAnimationPolicy: appSettings.imageAnimationPolicy settings.screenCaptureEnabled: true + settings.javascriptCanAccessClipboard: appSettings.javascriptCanAccessClipboard + settings.javascriptCanPaste: appSettings.javascriptCanPaste + + onWindowCloseRequested: function() { + tabBar.removeView(webEngineView.index); + } onCertificateError: function(error) { if (!error.isMainFrame) { @@ -578,29 +615,29 @@ ApplicationWindow { if (!request.userInitiated) console.warn("Blocked a popup window."); else if (request.destination === WebEngineNewWindowRequest.InNewTab) { - var tab = tabBar.createTab(currentWebView.profile, true, request.requestedUrl); + var tab = tabBar.createTab(win.currentWebView.profile, true, request.requestedUrl); tab.acceptAsNewWindow(request); } else if (request.destination === WebEngineNewWindowRequest.InNewBackgroundTab) { - var backgroundTab = tabBar.createTab(currentWebView.profile, false); + var backgroundTab = tabBar.createTab(win.currentWebView.profile, false); backgroundTab.acceptAsNewWindow(request); } else if (request.destination === WebEngineNewWindowRequest.InNewDialog) { - var dialog = applicationRoot.createDialog(currentWebView.profile); - dialog.currentWebView.acceptAsNewWindow(request); + var dialog = (win.applicationRoot as ApplicationRoot).createDialog(win.currentWebView.profile); + dialog.win.currentWebView.acceptAsNewWindow(request); } else { - var window = applicationRoot.createWindow(currentWebView.profile); - window.currentWebView.acceptAsNewWindow(request); + var window = (win.applicationRoot as ApplicationRoot).createWindow(win.currentWebView.profile); + window.win.currentWebView.acceptAsNewWindow(request); } } onFullScreenRequested: function(request) { if (request.toggleOn) { webEngineView.state = "FullScreen"; - browserWindow.previousVisibility = browserWindow.visibility; - browserWindow.showFullScreen(); + win.previousVisibility = win.visibility; + win.showFullScreen(); fullScreenNotification.show(); } else { webEngineView.state = ""; - browserWindow.visibility = browserWindow.previousVisibility; + win.visibility = win.previousVisibility; fullScreenNotification.hide(); } request.accept(); @@ -651,7 +688,7 @@ ApplicationWindow { } onLoadingChanged: function(loadRequest) { - if (loadRequest.status == WebEngineView.LoadStartedStatus) + if (loadRequest.status === WebEngineView.LoadStartedStatus) findBar.reset(); } @@ -668,7 +705,7 @@ ApplicationWindow { interval: 0 running: false repeat: false - onTriggered: currentWebView.reload() + onTriggered: win.currentWebView.reload() } } } @@ -682,7 +719,7 @@ ApplicationWindow { anchors.right: parent.right anchors.bottom: parent.bottom onNewWindowRequested: function(request) { - var tab = tabBar.createTab(currentWebView.profile); + var tab = tabBar.createTab(win.currentWebView.profile); request.openIn(tab); } @@ -693,7 +730,7 @@ ApplicationWindow { repeat: false onTriggered: devToolsEnabled.checked = false } - onWindowCloseRequested: function(request) { + onWindowCloseRequested: function() { // Delay hiding for keep the inspectedView set to receive the ACK message of close. hideTimer.running = true; } @@ -744,7 +781,7 @@ ApplicationWindow { Dialog { id: permissionDialog anchors.centerIn: parent - width: Math.min(browserWindow.width, browserWindow.height) / 3 * 2 + width: Math.min(win.width, win.height) / 3 * 2 contentWidth: mainTextForPermissionDialog.width contentHeight: mainTextForPermissionDialog.height standardButtons: Dialog.No | Dialog.Yes @@ -859,13 +896,13 @@ ApplicationWindow { onFindNext: { if (text) - currentWebView && currentWebView.findText(text); + win.currentWebView?.findText(text); else if (!visible) visible = true; } onFindPrevious: { if (text) - currentWebView && currentWebView.findText(text, WebEngineView.FindBackward); + win.currentWebView?.findText(text, WebEngineView.FindBackward); else if (!visible) visible = true; } @@ -898,4 +935,14 @@ ApplicationWindow { } } } + + onClosing: function(closeEvent) { + if (lastTabClosing) { + return; + } + closeEvent.accepted = false + for (var i = 0; i < tabBar.count; i++) { + tabBar.tryCloseView(i); + } + } } diff --git a/examples/webenginequick/nanobrowser/DownloadView.qml b/examples/webenginequick/nanobrowser/DownloadView.qml index b116ab867..ef0c7f5a7 100644 --- a/examples/webenginequick/nanobrowser/DownloadView.qml +++ b/examples/webenginequick/nanobrowser/DownloadView.qml @@ -1,10 +1,10 @@ // Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound + import QtQuick import QtQuick.Controls.Fusion -import QtWebEngine -import QtQuick.Layouts Rectangle { id: downloadView @@ -25,20 +25,26 @@ Rectangle { id: downloadItemDelegate Rectangle { + id: downloadItem width: listView.width height: childrenRect.height anchors.margins: 10 radius: 3 color: "transparent" border.color: "black" + + required property int index + Rectangle { id: progressBar - property real progress: downloadModel.downloads[index] - ? downloadModel.downloads[index].receivedBytes / downloadModel.downloads[index].totalBytes : 0 + property real progress: { + let d = downloadModel.downloads[downloadItem.index] + return d ? d.receivedBytes / d.totalBytes : 0 + } radius: 3 - color: width == listView.width ? "green" : "#2b74c7" + color: width === listView.width ? "green" : "#2b74c7" width: listView.width * progress height: cancelButton.height @@ -54,7 +60,10 @@ Rectangle { } Label { id: label - text: downloadModel.downloads[index] ? downloadModel.downloads[index].downloadDirectory + "/" + downloadModel.downloads[index].downloadFileName : qsTr("") + text: { + let d = downloadModel.downloads[downloadItem.index] + return d ? d.downloadDirectory + "/" + d.downloadFileName : qsTr("") + } anchors { verticalCenter: cancelButton.verticalCenter left: parent.left @@ -64,16 +73,16 @@ Rectangle { Button { id: cancelButton anchors.right: parent.right - icon.source: "qrc:/icons/process-stop.png" + icon.source: "icons/3rdparty/process-stop.png" onClicked: { - var download = downloadModel.downloads[index]; + var download = downloadModel.downloads[downloadItem.index]; download.cancel(); downloadModel.downloads = downloadModel.downloads.filter(function (el) { return el.id !== download.id; }); - downloadModel.remove(index); + downloadModel.remove(downloadItem.index); } } } diff --git a/examples/webenginequick/nanobrowser/FindBar.qml b/examples/webenginequick/nanobrowser/FindBar.qml index 409d8dcff..013f28e88 100644 --- a/examples/webenginequick/nanobrowser/FindBar.qml +++ b/examples/webenginequick/nanobrowser/FindBar.qml @@ -63,46 +63,47 @@ Rectangle { } Label { - text: activeMatch + "/" + numberOfMatches - visible: findTextField.text != "" + text: root.activeMatch + "/" + root.numberOfMatches + visible: findTextField.text !== "" color: "black" } Rectangle { border.width: 1 - border.color: "#ddd" - width: 2 - height: parent.height - anchors.topMargin: 5 - anchors.bottomMargin: 5 + border.color: "#dddddd" + Layout.preferredWidth: 2 + Layout.preferredHeight: parent.height } ToolButton { + id: findBtnLeft text: "<" - enabled: numberOfMatches > 0 + enabled: root.numberOfMatches > 0 onClicked: root.findPrevious() contentItem: Text { color: "black" - text: parent.text + text: findBtnLeft.text } } ToolButton { + id: findBtnRight text: ">" - enabled: numberOfMatches > 0 + enabled: root.numberOfMatches > 0 onClicked: root.findNext() contentItem: Text { color: "black" - text: parent.text + text: findBtnRight.text } } ToolButton { + id: findBtnClose text: "x" onClicked: root.visible = false contentItem: Text { color: "black" - text: parent.text + text: findBtnClose.text } } } diff --git a/examples/webenginequick/nanobrowser/FullScreenNotification.qml b/examples/webenginequick/nanobrowser/FullScreenNotification.qml index 779406432..cdf154c78 100644 --- a/examples/webenginequick/nanobrowser/FullScreenNotification.qml +++ b/examples/webenginequick/nanobrowser/FullScreenNotification.qml @@ -28,8 +28,8 @@ Rectangle { NumberAnimation { duration: 750 onStopped: { - if (opacity == 0) - visible = false; + if (fullScreenNotification.opacity === 0) + fullScreenNotification.visible = false; } } } @@ -37,7 +37,7 @@ Rectangle { Timer { id: reset interval: 5000 - onTriggered: hide() + onTriggered: fullScreenNotification.hide() } anchors.horizontalCenter: parent.horizontalCenter diff --git a/examples/webenginequick/nanobrowser/rc_resources.py b/examples/webenginequick/nanobrowser/rc_resources.py index 990f10274..b517c39a0 100644 --- a/examples/webenginequick/nanobrowser/rc_resources.py +++ b/examples/webenginequick/nanobrowser/rc_resources.py @@ -1,6 +1,6 @@ # Resource object code (Python 3) # Created by: object code -# Created by: The Resource Compiler for Qt version 6.4.0 +# Created by: The Resource Compiler for Qt version 6.10.0 # WARNING! All changes made in this file will be lost! from PySide6 import QtCore @@ -330,13 +330,13 @@ qt_resource_struct = b"\ \x00\x00\x00\x00\x00\x02\x00\x00\x00\x04\x00\x00\x00\x02\ \x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00,\x00\x00\x00\x00\x00\x01\x00\x00\x03\xa6\ -\x00\x00\x01{\xe0\xa8\xe4\xe2\ +\x00\x00\x01\x975l\xc7\xfb\ \x00\x00\x00R\x00\x00\x00\x00\x00\x01\x00\x00\x08\xfe\ -\x00\x00\x01{\xe0\xa8\xe4\xe2\ +\x00\x00\x01\x975l\xc7\xfb\ \x00\x00\x00\x10\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x01{\xe0\xa8\xe4\xe2\ +\x00\x00\x01\x975l\xc7\xfb\ \x00\x00\x00x\x00\x00\x00\x00\x00\x01\x00\x00\x0d\xfa\ -\x00\x00\x01{\xe0\xa8\xe4\xe2\ +\x00\x00\x01\x975l\xc7\xfb\ " def qInitResources(): |