1
0
mirror of https://github.com/jaredtao/TaoQuick.git synced 2025-01-19 20:22:56 +08:00

add some Wizard file

This commit is contained in:
jared 2020-10-28 00:33:18 +08:00
parent 5e6df1a993
commit c80f79a909
15 changed files with 287 additions and 10 deletions

View File

@ -56,5 +56,6 @@
<file>Image/Button/download_gray.png</file>
<file>Image/Button/download_red.png</file>
<file>Image/Button/download_white.png</file>
<file>Image/Common/wizard.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -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)
}
}
}
}

View File

@ -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)
}
}
}
}

View File

@ -6,7 +6,7 @@ import "./Pane"
import "./Dialog"
//import Qt.labs.platform 1.1
CusBackground {
id: rootItem
id: rootBackground
width: 1440
height: 960
CusImage {

View File

@ -436,6 +436,11 @@
{
"key": "visibledCount: %1",
"value": "可见数量: %1"
},
{
"key": "Wizard",
"value": "向导"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

View File

@ -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"
}
}

View File

@ -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
}
}

View File

@ -40,6 +40,8 @@
<file>Qml/CusTable/CusTableHeader.qml</file>
<file>Qml/CusTable/CusTableRow.qml</file>
<file>Qml/CusTable/CusTableView.qml</file>
<file>Qml/CusWizard/CusWizard.qml</file>
<file>Qml/CusWizard/CusWizardPage.qml</file>
<file>Qml/Effect/CusEffectCommon.qml</file>
<file>Qml/Effect/CusShaderToy.qml</file>
<file>Qml/Effect/Animation/ABoard.qml</file>
@ -78,6 +80,10 @@
<file>Qml/Misc/CusResizeBorder.qml</file>
<file>Qml/Misc/CusShortCutKeys.qml</file>
<file>Qml/Misc/CusTemplateDragBorder.qml</file>
<file>Images/arrow-down.png</file>
<file>Images/arrow-left.png</file>
<file>Images/arrow-right.png</file>
<file>Images/arrow-up.png</file>
<file>Images/Check.png</file>
<file>Images/ComboBox_Down.png</file>
<file>Images/ellipsis.png</file>

View File

@ -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"

View File

@ -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