diff --git a/examples/TaoQuickShow/Image.qrc b/examples/TaoQuickShow/Image.qrc index c4b2c4f..a100867 100644 --- a/examples/TaoQuickShow/Image.qrc +++ b/examples/TaoQuickShow/Image.qrc @@ -56,5 +56,6 @@ Image/Button/download_gray.png Image/Button/download_red.png Image/Button/download_white.png + Image/Common/wizard.png diff --git a/examples/TaoQuickShow/Image/Common/wizard.png b/examples/TaoQuickShow/Image/Common/wizard.png new file mode 100644 index 0000000..aeae900 Binary files /dev/null and b/examples/TaoQuickShow/Image/Common/wizard.png differ diff --git a/examples/TaoQuickShow/Qml/Page/Home.qml b/examples/TaoQuickShow/Qml/Page/Home.qml index 9dd83fd..12603d0 100644 --- a/examples/TaoQuickShow/Qml/Page/Home.qml +++ b/examples/TaoQuickShow/Qml/Page/Home.qml @@ -2,6 +2,7 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import TaoQuick 1.0 Item { + id: homeItem anchors.centerIn: parent CusLabel { text: qsTr("TaoQuick provides a set of controls that can be used to build complete interfaces in Qt Quick.") + trans.transString @@ -10,4 +11,37 @@ Item { wrapMode: Label.Wrap anchors.centerIn: parent } + property bool hasWizard: true + function showWizard() { + var pRoot = homeItem + while (pRoot.parent !== null) { + pRoot = pRoot.parent + } + wizardComp.createObject(pRoot) +// wizardComp.createObject(pRoot, {x: pRoot.x, y: pRoot.y, width: pRoot.width, height: pRoot.height}) + } + Component { + id: wizardComp + CusWizard { + id: wizard + anchors.fill: parent + currentIndex: 0 + count: 2 + onWizardFinished: { + destroy(wizard) + } + CusWizardPage { + z: 1 + visible: wizard.currentIndex === 0 + wizardText: qsTr("titleRect can control window") + focusRect: Qt.rect(0,0, wizard.parent.width, 80) + } + CusWizardPage { + z: 1 + visible: wizard.currentIndex === 1 + wizardText: qsTr("middle rect for control") + focusRect: Qt.rect(200,200, 200, 200) + } + } + } } diff --git a/examples/TaoQuickShow/Qml/Pane/RightPane.qml b/examples/TaoQuickShow/Qml/Pane/RightPane.qml index 852c6fc..77cb1a4 100644 --- a/examples/TaoQuickShow/Qml/Pane/RightPane.qml +++ b/examples/TaoQuickShow/Qml/Pane/RightPane.qml @@ -2,22 +2,37 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import TaoQuick 1.0 Loader { + id: rootLoader property string homeUrl: qmlPath + "Page/Home.qml" source: homeUrl - CusButton_ImageColorOverlay { + Column { + spacing: 10 anchors { right: parent.right - bottom: parent.bottom + verticalCenter: parent.verticalCenter } - width: 32 - height: 32 - visible: isDebug && source && source != homeUrl - btnImgNormal: imgPath + "Common/view.png" - tipText: qsTr("View Source Code") - onClicked: { - Qt.openUrlExternally(source) + CusButton_ImageColorOverlay { + width: 32 + height: 32 + visible: rootLoader.item && typeof rootLoader.item.hasWizard !== "undefined" && rootLoader.item.hasWizard === true + btnImgNormal: imgPath + "Common/wizard.png" + tipText: qsTr("Wizard") + trans.transString + onClicked: { + rootLoader.item.showWizard() + } + } + CusButton_ImageColorOverlay { + width: 32 + height: 32 + visible: isDebug && source && source != homeUrl + btnImgNormal: imgPath + "Common/view.png" + tipText: qsTr("View Source Code") + trans.transString + onClicked: { + Qt.openUrlExternally(source) + } } } + } diff --git a/examples/TaoQuickShow/Qml/main.qml b/examples/TaoQuickShow/Qml/main.qml index 11b34d9..d6b6332 100644 --- a/examples/TaoQuickShow/Qml/main.qml +++ b/examples/TaoQuickShow/Qml/main.qml @@ -6,7 +6,7 @@ import "./Pane" import "./Dialog" //import Qt.labs.platform 1.1 CusBackground { - id: rootItem + id: rootBackground width: 1440 height: 960 CusImage { diff --git a/examples/TaoQuickShow/Trans/language_zh.json b/examples/TaoQuickShow/Trans/language_zh.json index 9238620..3c7aecd 100644 --- a/examples/TaoQuickShow/Trans/language_zh.json +++ b/examples/TaoQuickShow/Trans/language_zh.json @@ -436,6 +436,11 @@ { "key": "visibledCount: %1", "value": "可见数量: %1" + }, + { + "key": "Wizard", + "value": "向导" } + ] } diff --git a/src/TaoQuick/imports/TaoQuick/Images/arrow-down.png b/src/TaoQuick/imports/TaoQuick/Images/arrow-down.png new file mode 100644 index 0000000..d002ee4 Binary files /dev/null and b/src/TaoQuick/imports/TaoQuick/Images/arrow-down.png differ diff --git a/src/TaoQuick/imports/TaoQuick/Images/arrow-left.png b/src/TaoQuick/imports/TaoQuick/Images/arrow-left.png new file mode 100644 index 0000000..5877f9a Binary files /dev/null and b/src/TaoQuick/imports/TaoQuick/Images/arrow-left.png differ diff --git a/src/TaoQuick/imports/TaoQuick/Images/arrow-right.png b/src/TaoQuick/imports/TaoQuick/Images/arrow-right.png new file mode 100644 index 0000000..736fffc Binary files /dev/null and b/src/TaoQuick/imports/TaoQuick/Images/arrow-right.png differ diff --git a/src/TaoQuick/imports/TaoQuick/Images/arrow-up.png b/src/TaoQuick/imports/TaoQuick/Images/arrow-up.png new file mode 100644 index 0000000..d9eb813 Binary files /dev/null and b/src/TaoQuick/imports/TaoQuick/Images/arrow-up.png differ diff --git a/src/TaoQuick/imports/TaoQuick/Qml/CusWizard/CusWizard.qml b/src/TaoQuick/imports/TaoQuick/Qml/CusWizard/CusWizard.qml new file mode 100644 index 0000000..0b05175 --- /dev/null +++ b/src/TaoQuick/imports/TaoQuick/Qml/CusWizard/CusWizard.qml @@ -0,0 +1,28 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 +import ".." +import "../.." + +Item { + signal wizardFinished() + property string totlaString: qsTr("Wizard %1/%2 >").arg(currentIndex + 1).arg(count) + MouseArea { + anchors.fill: parent + hoverEnabled: true + onClicked: { + currentIndex++ + if (currentIndex >= count) { + wizardFinished() + } + } + } + property int count: 0 + property int currentIndex: 0 + CusLabel { + z: 3 + anchors.centerIn: parent + text: totlaString + font.pixelSize: 20 + color: "white" + } +} diff --git a/src/TaoQuick/imports/TaoQuick/Qml/CusWizard/CusWizardPage.qml b/src/TaoQuick/imports/TaoQuick/Qml/CusWizard/CusWizardPage.qml new file mode 100644 index 0000000..614fe9b --- /dev/null +++ b/src/TaoQuick/imports/TaoQuick/Qml/CusWizard/CusWizardPage.qml @@ -0,0 +1,144 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 + import QtGraphicalEffects 1.0 +import ".." +import "../.." + +Item { + id: pageItem + anchors.fill: parent + property rect focusRect + property string wizardText + + property color maskColor: "black" + property real maskOpacity: 0.75 + Item { + id: focusItem + x: focusRect.x + y: focusRect.y + width: focusRect.width + height: focusRect.height + RadialGradient { + anchors.fill: parent + gradient: Gradient { + GradientStop { position: 0.0; color: "transparent" } + GradientStop { position: 0.8; color: maskColor } + } + opacity: maskOpacity + } + } + Row { + id: leftRow + spacing: 10 + visible: focusRect.x < 5 + anchors { + left: focusItem.right + leftMargin: 5 + verticalCenter: focusItem.verticalCenter + } + CusImage { + source: CusConfig.imagePathPrefix + "arrow-left.png" + + anchors.verticalCenter: parent.verticalCenter + } + CusLabel { + width: 300 + text: wizardText + anchors.verticalCenter: parent.verticalCenter + } + } + Row { + id: rightRow + spacing: 10 + layoutDirection: Qt.RightToLeft + visible: focusRect.x + focusRect.width > pageItem.width - 5 + anchors { + right: focusItem.left + rightMargin: 5 + verticalCenter: focusItem.verticalCenter + } + CusImage { + source: CusConfig.imagePathPrefix + "arrow-right.png" + anchors.verticalCenter: parent.verticalCenter + } + CusLabel { + width: 300 + text: wizardText + anchors.verticalCenter: parent.verticalCenter + } + } + Column { + id: downColumn + spacing: 10 + visible: !leftRow.visible && !rightRow.visible && focusRect.y > pageItem.height / 2 + anchors { + bottom: focusItem.top + bottomMargin: 5 + horizontalCenter: focusItem.horizontalCenter + } + CusLabel { + width: 300 + text: wizardText + anchors.horizontalCenter: parent.horizontalCenter + } + CusImage { + source: CusConfig.imagePathPrefix + "arrow-down.png" + anchors.horizontalCenter: parent.horizontalCenter + } + } + Column { + id: upColumn + spacing: 10 + visible: !leftRow.visible && !rightRow.visible && !downColumn + anchors { + top: focusItem.bottom + topMargin: 5 + horizontalCenter: focusItem.horizontalCenter + } + CusImage { + source: CusConfig.imagePathPrefix + "arrow-up.png" + anchors.horizontalCenter: parent.horizontalCenter + } + CusLabel { + width: 300 + text: wizardText + anchors.horizontalCenter: parent.horizontalCenter + } + } + //left + Rectangle { + x: 0 + y: 0 + width: focusRect.x + height: parent.height + color: maskColor + opacity: maskOpacity + } + //right + Rectangle { + x: focusRect.x + focusRect.width + y: 0 + width: pageItem.width - x + height: parent.height + color: maskColor + opacity: maskOpacity + } + //top + Rectangle { + x: focusRect.x + width: focusRect.width + y: 0 + height: focusRect.y + color: maskColor + opacity: maskOpacity + } + //bottom + Rectangle { + x: focusRect.x + width: focusRect.width + y: focusRect.y + focusRect.height + height: pageItem.height - y + color: maskColor + opacity: maskOpacity + } +} diff --git a/src/TaoQuick/imports/TaoQuick/TaoQuick.qrc b/src/TaoQuick/imports/TaoQuick/TaoQuick.qrc index a659129..2e5ffd5 100644 --- a/src/TaoQuick/imports/TaoQuick/TaoQuick.qrc +++ b/src/TaoQuick/imports/TaoQuick/TaoQuick.qrc @@ -40,6 +40,8 @@ Qml/CusTable/CusTableHeader.qml Qml/CusTable/CusTableRow.qml Qml/CusTable/CusTableView.qml + Qml/CusWizard/CusWizard.qml + Qml/CusWizard/CusWizardPage.qml Qml/Effect/CusEffectCommon.qml Qml/Effect/CusShaderToy.qml Qml/Effect/Animation/ABoard.qml @@ -78,6 +80,10 @@ Qml/Misc/CusResizeBorder.qml Qml/Misc/CusShortCutKeys.qml Qml/Misc/CusTemplateDragBorder.qml + Images/arrow-down.png + Images/arrow-left.png + Images/arrow-right.png + Images/arrow-up.png Images/Check.png Images/ComboBox_Down.png Images/ellipsis.png diff --git a/src/TaoQuick/imports/TaoQuick/designer/TaoQuick.metainfo b/src/TaoQuick/imports/TaoQuick/designer/TaoQuick.metainfo index e6cac1e..7e5414c 100644 --- a/src/TaoQuick/imports/TaoQuick/designer/TaoQuick.metainfo +++ b/src/TaoQuick/imports/TaoQuick/designer/TaoQuick.metainfo @@ -517,6 +517,48 @@ MetaInfo { Property { name: "height"; type: "int"; value: 80 } } } + Type { + name: "TaoQuick.Qml.CusWizard.CusWizard" + icon: "images/CusWizard.png" + + ItemLibraryEntry { + name: "CusWizard" + category: "TaoQuick - CusWizard" + libraryIcon: "images/CusWizard.png" + version: "1.0" + requiredImport: "TaoQuick" + Property { name: "width"; type: "int"; value: 120 } + Property { name: "height"; type: "int"; value: 80 } + } + } + Type { + name: "TaoQuick.Qml.CusWizard.CusWizardBackground" + icon: "images/CusWizardBackground.png" + + ItemLibraryEntry { + name: "CusWizardBackground" + category: "TaoQuick - CusWizard" + libraryIcon: "images/CusWizardBackground.png" + version: "1.0" + requiredImport: "TaoQuick" + Property { name: "width"; type: "int"; value: 120 } + Property { name: "height"; type: "int"; value: 80 } + } + } + Type { + name: "TaoQuick.Qml.CusWizard.CusWizardPage" + icon: "images/CusWizardPage.png" + + ItemLibraryEntry { + name: "CusWizardPage" + category: "TaoQuick - CusWizard" + libraryIcon: "images/CusWizardPage.png" + version: "1.0" + requiredImport: "TaoQuick" + Property { name: "width"; type: "int"; value: 120 } + Property { name: "height"; type: "int"; value: 80 } + } + } Type { name: "TaoQuick.Qml.Effect.CusShaderToy" icon: "images/CusShaderToy.png" diff --git a/src/TaoQuick/imports/TaoQuick/qmldir b/src/TaoQuick/imports/TaoQuick/qmldir index e6d75ae..d83baa7 100644 --- a/src/TaoQuick/imports/TaoQuick/qmldir +++ b/src/TaoQuick/imports/TaoQuick/qmldir @@ -37,6 +37,8 @@ singleton CusTableConstant 1.0 Qml/CusTable/CusTableConstant.qml CusTableHeader 1.0 Qml/CusTable/CusTableHeader.qml CusTableRow 1.0 Qml/CusTable/CusTableRow.qml CusTableView 1.0 Qml/CusTable/CusTableView.qml +CusWizard 1.0 Qml/CusWizard/CusWizard.qml +CusWizardPage 1.0 Qml/CusWizard/CusWizardPage.qml ABoard 1.0 Qml/Effect/Animation/ABoard.qml ACircle 1.0 Qml/Effect/Animation/ACircle.qml ACleavage 1.0 Qml/Effect/Animation/ACleavage.qml