diff --git a/examples/TaoQuickShow/Qml.qrc b/examples/TaoQuickShow/Qml.qrc index d5aac53..b0c96fc 100644 --- a/examples/TaoQuickShow/Qml.qrc +++ b/examples/TaoQuickShow/Qml.qrc @@ -5,20 +5,16 @@ Qml/Page/ContentPage.qml Qml/Page/TitlePage.qml Qml/Page/NotifyBox.qml - Qml/Splash.qml - Qml/MainPage.qml Qml/Page/ContentData.qml Qml/Page/AboutDialog.qml - Qml/Page/Biz/Background.qml - Qml/Page/Biz/LangBtn.qml - Qml/Page/Biz/SkinBtn.qml - Qml/TBusyIndicator.qml - Qml/Page/Biz/CompDetail.qml - Qml/Page/Biz/CompCard.qml - Qml/Page/Biz/TText.qml - Qml/Page/Biz/CircleText.qml - Qml/Page/Biz/CloseBtn.qml - Qml/Page/Biz/CompBtn.qml - Qml/Page/Biz/BackBtn.qml + Qml/Biz/BackBtn.qml + Qml/Biz/CircleText.qml + Qml/Biz/CloseBtn.qml + Qml/Biz/CompBtn.qml + Qml/Biz/CompCard.qml + Qml/Biz/CompDetail.qml + Qml/Biz/LangBtn.qml + Qml/Biz/SkinBtn.qml + Qml/Biz/TText.qml diff --git a/examples/TaoQuickShow/Qml/Biz/BackBtn.qml b/examples/TaoQuickShow/Qml/Biz/BackBtn.qml new file mode 100644 index 0000000..74f55d4 --- /dev/null +++ b/examples/TaoQuickShow/Qml/Biz/BackBtn.qml @@ -0,0 +1,10 @@ +import QtQuick 2.9 + +import TaoQuick 1.0 + +CusButton_Image { + width: 48 + height: 48 + + btnImgUrl: imgPath + (containsMouse ? "Common/left_hovered.png" : "Common/left.png") +} diff --git a/examples/TaoQuickShow/Qml/Page/Biz/CircleText.qml b/examples/TaoQuickShow/Qml/Biz/CircleText.qml similarity index 100% rename from examples/TaoQuickShow/Qml/Page/Biz/CircleText.qml rename to examples/TaoQuickShow/Qml/Biz/CircleText.qml diff --git a/examples/TaoQuickShow/Qml/Page/Biz/CloseBtn.qml b/examples/TaoQuickShow/Qml/Biz/CloseBtn.qml similarity index 100% rename from examples/TaoQuickShow/Qml/Page/Biz/CloseBtn.qml rename to examples/TaoQuickShow/Qml/Biz/CloseBtn.qml diff --git a/examples/TaoQuickShow/Qml/Page/Biz/CompBtn.qml b/examples/TaoQuickShow/Qml/Biz/CompBtn.qml similarity index 81% rename from examples/TaoQuickShow/Qml/Page/Biz/CompBtn.qml rename to examples/TaoQuickShow/Qml/Biz/CompBtn.qml index 2d2305b..933198d 100644 --- a/examples/TaoQuickShow/Qml/Page/Biz/CompBtn.qml +++ b/examples/TaoQuickShow/Qml/Biz/CompBtn.qml @@ -3,11 +3,9 @@ import QtQuick 2.9 import TaoQuick 1.0 -TTextBtn { +CusButton { id: root textColor: gConfig.textColor - textItem.font.pixelSize: gConfig.fontPixel - textItem.font.family: gConfig.fontFamily Image { anchors { diff --git a/examples/TaoQuickShow/Qml/Page/Biz/CompCard.qml b/examples/TaoQuickShow/Qml/Biz/CompCard.qml similarity index 100% rename from examples/TaoQuickShow/Qml/Page/Biz/CompCard.qml rename to examples/TaoQuickShow/Qml/Biz/CompCard.qml diff --git a/examples/TaoQuickShow/Qml/Page/Biz/CompDetail.qml b/examples/TaoQuickShow/Qml/Biz/CompDetail.qml similarity index 100% rename from examples/TaoQuickShow/Qml/Page/Biz/CompDetail.qml rename to examples/TaoQuickShow/Qml/Biz/CompDetail.qml diff --git a/examples/TaoQuickShow/Qml/Page/Biz/LangBtn.qml b/examples/TaoQuickShow/Qml/Biz/LangBtn.qml similarity index 97% rename from examples/TaoQuickShow/Qml/Page/Biz/LangBtn.qml rename to examples/TaoQuickShow/Qml/Biz/LangBtn.qml index 2f6e1ba..18b0ed4 100644 --- a/examples/TaoQuickShow/Qml/Page/Biz/LangBtn.qml +++ b/examples/TaoQuickShow/Qml/Biz/LangBtn.qml @@ -26,6 +26,7 @@ CusButton_Image { text: qsTr(modelData) backgroundColor: trans.currentLang === modelData ? gConfig.themeColor :( containsMouse ? "lightgray" : pop.barColor) textColor: gConfig.textColor + borderWidth: 0 radius: 4 onClicked: { // pop.hide() diff --git a/examples/TaoQuickShow/Qml/Page/Biz/SkinBtn.qml b/examples/TaoQuickShow/Qml/Biz/SkinBtn.qml similarity index 100% rename from examples/TaoQuickShow/Qml/Page/Biz/SkinBtn.qml rename to examples/TaoQuickShow/Qml/Biz/SkinBtn.qml diff --git a/examples/TaoQuickShow/Qml/Page/Biz/TText.qml b/examples/TaoQuickShow/Qml/Biz/TText.qml similarity index 84% rename from examples/TaoQuickShow/Qml/Page/Biz/TText.qml rename to examples/TaoQuickShow/Qml/Biz/TText.qml index 8e646c6..0e0b182 100644 --- a/examples/TaoQuickShow/Qml/Page/Biz/TText.qml +++ b/examples/TaoQuickShow/Qml/Biz/TText.qml @@ -1,6 +1,7 @@ import QtQuick 2.0 import QtQuick.Controls 2.0 -Text { +import TaoQuick 1.0 +BasicText { font { pixelSize: gConfig.fontPixel family: gConfig.fontFamily diff --git a/examples/TaoQuickShow/Qml/MainPage.qml b/examples/TaoQuickShow/Qml/MainPage.qml deleted file mode 100644 index b482302..0000000 --- a/examples/TaoQuickShow/Qml/MainPage.qml +++ /dev/null @@ -1,35 +0,0 @@ -import QtQuick 2.9 -import "./Page" - -import TaoQuick 1.0 - - -Item { - anchors.fill: parent - ContentData { - id: gConfig - objectName: "gConfig" - } - AboutDialog { - id: aboutDialog - } - TitlePage { - id: titlePage - width: rootView.width - height: 60 - color: gConfig.themeColor - } - ContentPage { - id: contentPage - color: gConfig.background - anchors { - top: titlePage.bottom - bottom: parent.bottom - left: titlePage.left - right: titlePage.right - } - } - NotifyBox { - id: notifyBox - } -} diff --git a/examples/TaoQuickShow/Qml/Page/AboutDialog.qml b/examples/TaoQuickShow/Qml/Page/AboutDialog.qml index 07fd7dc..c7ce310 100644 --- a/examples/TaoQuickShow/Qml/Page/AboutDialog.qml +++ b/examples/TaoQuickShow/Qml/Page/AboutDialog.qml @@ -17,9 +17,13 @@ Popup { color: gConfig.themeColor border.width: 1 border.color: gConfig.reserverColor - TMoveArea { + MoveArea { anchors.fill: parent control: root + onMove: { + root.x += xOffset + root.y += yOffset + } } Image { id: img @@ -28,13 +32,13 @@ Popup { anchors.verticalCenter: parent.verticalCenter source: imgPath + "logo/milk.png" } - TTextBtn { + CusButton { id: closeBtn text: qsTr("Close") width: 80 height: 38 radius: 8 - color: containsPress ? Qt.darker(gConfig.background, 1.2) : (containsMouse ? Qt.lighter(gConfig.background, 1.2) : gConfig.background) + backgroundColor: containsPress ? Qt.darker(gConfig.background, 1.2) : (containsMouse ? Qt.lighter(gConfig.background, 1.2) : gConfig.background) textColor: gConfig.textColor anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom diff --git a/examples/TaoQuickShow/Qml/Page/Biz/BackBtn.qml b/examples/TaoQuickShow/Qml/Page/Biz/BackBtn.qml deleted file mode 100644 index 5ef8074..0000000 --- a/examples/TaoQuickShow/Qml/Page/Biz/BackBtn.qml +++ /dev/null @@ -1,10 +0,0 @@ -import QtQuick 2.9 - -import TaoQuick 1.0 - -TImageBtn { - width: 48 - height: 48 - - imageUrl: imgPath + (containsMouse ? "Common/left_hovered.png" : "Common/left.png") -} diff --git a/examples/TaoQuickShow/Qml/Page/Biz/Background.qml b/examples/TaoQuickShow/Qml/Page/Biz/Background.qml deleted file mode 100644 index 4fb526b..0000000 --- a/examples/TaoQuickShow/Qml/Page/Biz/Background.qml +++ /dev/null @@ -1,8 +0,0 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.2 -import TaoQuick 1.0 - - -Rectangle { - id: root -} diff --git a/examples/TaoQuickShow/Qml/Page/ContentPage.qml b/examples/TaoQuickShow/Qml/Page/ContentPage.qml index 338b39c..5d78725 100644 --- a/examples/TaoQuickShow/Qml/Page/ContentPage.qml +++ b/examples/TaoQuickShow/Qml/Page/ContentPage.qml @@ -2,7 +2,7 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import TaoQuick 1.0 -import "Biz" +import "../Biz" Background { id: background readonly property string defaultTitle: "Component List" diff --git a/examples/TaoQuickShow/Qml/Page/TitlePage.qml b/examples/TaoQuickShow/Qml/Page/TitlePage.qml index a47d2c2..77917d2 100644 --- a/examples/TaoQuickShow/Qml/Page/TitlePage.qml +++ b/examples/TaoQuickShow/Qml/Page/TitlePage.qml @@ -1,7 +1,7 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import TaoQuick 1.0 -import "./Biz" +import "../Biz" Rectangle { Row { anchors.left: parent.left diff --git a/examples/TaoQuickShow/Qml/Splash.qml b/examples/TaoQuickShow/Qml/Splash.qml deleted file mode 100644 index e3ad6dd..0000000 --- a/examples/TaoQuickShow/Qml/Splash.qml +++ /dev/null @@ -1,18 +0,0 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.2 -Item { - width: 1024 - height: 768 - opacity: 1.0 - Behavior on opacity { - NumberAnimation { duration: 500 } - } - TBusyIndicator { - id: control - running: true - anchors.centerIn: parent - width: 160 - height: 160 - durationPerCycle: 2000 - } -} diff --git a/examples/TaoQuickShow/Qml/TBusyIndicator.qml b/examples/TaoQuickShow/Qml/TBusyIndicator.qml deleted file mode 100644 index d5673e2..0000000 --- a/examples/TaoQuickShow/Qml/TBusyIndicator.qml +++ /dev/null @@ -1,62 +0,0 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.2 - -BusyIndicator { - id: control - width: 64 - height: 64 - property color busyColor: "#008b8b" - property int busyRadius: 5 - property int busyCount: 6 - property int durationPerCycle: 1500 - - contentItem: Item { - width: control.width - height: control.height - Item { - id: item - width: parent.width - height: parent.height - opacity: control.running ? 1 : 0 - - Behavior on opacity { - OpacityAnimator { - duration: 250 - } - } - - RotationAnimator { - target: item - running: control.visible && control.running - from: 0 - to: 360 - loops: Animation.Infinite - duration: durationPerCycle - } - - Repeater { - id: repeater - model: busyCount - - Rectangle { - x: item.width / 2 - width / 2 - y: item.height / 2 - height / 2 - implicitWidth: busyRadius * 2 - implicitHeight: busyRadius * 2 - radius: busyRadius - color: busyColor - transform: [ - Translate { - y: -Math.min(item.width, item.height) * 0.5 + busyRadius - }, - Rotation { - angle: index / repeater.count * 360 - origin.x: busyRadius - origin.y: busyRadius - } - ] - } - } - } - } -} diff --git a/examples/TaoQuickShow/Qml/main.qml b/examples/TaoQuickShow/Qml/main.qml index 2d6c753..98d9544 100644 --- a/examples/TaoQuickShow/Qml/main.qml +++ b/examples/TaoQuickShow/Qml/main.qml @@ -1,6 +1,5 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 -import QtGraphicalEffects 1.0 import TaoQuick 1.0 import "./Page" @@ -8,16 +7,24 @@ Item { id: rootItem width: 1440 height: 900 + ContentData { id: gConfig + objectName: "gConfig" + } + AboutDialog { + id: aboutDialog } - TitlePage { id: title width: parent.width height: 60 color: gConfig.themeColor } + NotifyBox { + id: notifyBox + } + Rectangle { id: content width: parent.width @@ -32,22 +39,5 @@ Item { top: parent.top } } - CusButton_Blue { - text: qsTr("hello") - x: 80 - y: 200 - width: 120 - height: 30 - } - CusButton_Blue { - anchors.centerIn: parent - text: qsTr("Chinese") - } - } - - DropShadow { - source: rootItem - radius: 8 - color: "#007acc" } } diff --git a/src/TaoQuick/imports/TaoQuick/Qml/Basic/MoveArea.qml b/src/TaoQuick/imports/TaoQuick/Qml/Basic/MoveArea.qml index c8e4eda..ec2ab79 100644 --- a/src/TaoQuick/imports/TaoQuick/Qml/Basic/MoveArea.qml +++ b/src/TaoQuick/imports/TaoQuick/Qml/Basic/MoveArea.qml @@ -7,12 +7,14 @@ MouseArea { property int lastX: 0 property int lastY: 0 property var control: parent //导出一个control属性,指定要拖动的目标, 默认就用parent好了。注意目标要有x和y属性并且可修改 - hoverEnabled: true signal move(real xOffset, real yOffset) onContainsPressChanged: { if (containsPress) { + cursorShape = Qt.SizeAllCursor lastX = mouseX lastY = mouseY + } else { + cursorShape = Qt.ArrowCursor } } onPositionChanged: { diff --git a/src/TaoQuick/imports/TaoQuick/Qml/CusButton/CusButton.qml b/src/TaoQuick/imports/TaoQuick/Qml/CusButton/CusButton.qml index fe0f1d4..39ca050 100644 --- a/src/TaoQuick/imports/TaoQuick/Qml/CusButton/CusButton.qml +++ b/src/TaoQuick/imports/TaoQuick/Qml/CusButton/CusButton.qml @@ -13,7 +13,7 @@ Button { property alias tipTimeout: toolTip.timeout property bool containsMouse: hovered - property bool containsPressed: pressed + property bool containsPress: pressed property color backgroundColorNormal property color backgroundColorHovered property color backgroundColorPressed