mirror of
https://github.com/jaredtao/TaoQuick.git
synced 2025-01-19 20:22:56 +08:00
update main
This commit is contained in:
parent
f558495069
commit
133fdbf0c3
@ -57,7 +57,7 @@ or you can install TaoQuick to QTDIR.
|
||||
2. import in you qml
|
||||
```
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
```
|
||||
|
||||
![](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview/TaoQuick-use.png)
|
||||
|
@ -68,7 +68,7 @@ TaoQuick库将被安装到{QTDIR}/qml/TaoQuick/ 路径下。
|
||||
2. 在你的Qml中写上这两句,就完成了TaoQuick的导入
|
||||
```
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
```
|
||||
|
||||
![](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview/TaoQuick-use.png)
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
Image {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
Image {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
Image {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
Image {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
Image {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
ASlowEnter {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
Image {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
Image {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
Image {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
Image {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
Image {
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
TDialog {
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
@ -2,7 +2,7 @@
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
@ -2,7 +2,7 @@
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
|
||||
Item {
|
||||
id: r
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
property color btnColor: "#06b7ed"
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
|
||||
TShaderToy {
|
||||
id: r
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
id: r
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
id: r
|
||||
anchors.fill: parent
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
|
||||
Item {
|
||||
id: base
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
|
||||
TShaderToy {
|
||||
anchors.fill: parent
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
|
||||
TShaderToy {
|
||||
anchors.fill: parent
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
|
||||
TShaderToy {
|
||||
anchors.fill: parent
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
|
||||
TShaderToy {
|
||||
anchors.fill: parent
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
Rectangle {
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||
import "./Page"
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
|
||||
Popup {
|
||||
id: root
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
TImageBtn {
|
||||
width: 48
|
||||
height: 48
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
@ -1,10 +1,10 @@
|
||||
import QtQuick 2.9
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
TImageBtn {
|
||||
|
||||
CusButton_Image {
|
||||
width: 20
|
||||
height: 20
|
||||
|
||||
imageUrl: imgPath + (containsMouse ? "Window/close_white.png" : "Window/close_gray.png")
|
||||
btnImgUrl: imgPath + (containsMouse ? "Window/close_white.png" : "Window/close_gray.png")
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
|
||||
TTextBtn {
|
||||
id: root
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
width: 200
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
radius: 4
|
||||
|
@ -1,12 +1,11 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
TImageBtn {
|
||||
imageUrl: imgPath + (containsMouse ? "Window/lang_white.png" : "Window/lang_gray.png")
|
||||
|
||||
CusButton_Image {
|
||||
btnImgUrl: imgPath + (containsMouse ? "Window/lang_white.png" : "Window/lang_gray.png")
|
||||
onClicked: {
|
||||
// notifyBox.notify("change language")
|
||||
pop.show()
|
||||
}
|
||||
TPopup {
|
||||
@ -20,11 +19,12 @@ TImageBtn {
|
||||
anchors.margins: 2
|
||||
model: trans.languages
|
||||
clip: true
|
||||
delegate: TTextBtn {
|
||||
delegate: CusButton {
|
||||
id: dBtn
|
||||
width: langListView.width
|
||||
height: 36
|
||||
text: qsTr(modelData)
|
||||
color: trans.currentLang === modelData ? gConfig.themeColor :( containsMouse ? "lightgray" : pop.barColor)
|
||||
backgroundColor: trans.currentLang === modelData ? gConfig.themeColor :( containsMouse ? "lightgray" : pop.barColor)
|
||||
textColor: gConfig.textColor
|
||||
radius: 4
|
||||
onClicked: {
|
||||
|
@ -1,10 +1,10 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
TImageBtn {
|
||||
|
||||
imageUrl: imgPath + (containsMouse ? "Window/skin_white.png" : "Window/skin_gray.png")
|
||||
CusButton_Image {
|
||||
|
||||
btnImgUrl: imgPath + (containsMouse ? "Window/skin_white.png" : "Window/skin_gray.png")
|
||||
onClicked: {
|
||||
skinBox.show()
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
import "Biz"
|
||||
Background {
|
||||
id: background
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
|
||||
ListView {
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
|
@ -1,8 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/TaoQuick"
|
||||
import "Biz"
|
||||
import "./Biz"
|
||||
Rectangle {
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
@ -22,33 +21,27 @@ Rectangle {
|
||||
property bool isMaxed: view.isMax
|
||||
Row {
|
||||
id: controlButtons
|
||||
height: 20
|
||||
height: 32
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 12
|
||||
spacing: 10
|
||||
TImageBtn {
|
||||
width: 20
|
||||
height: 20
|
||||
imageUrl: imgPath + (containsMouse ? "Window/minimal_white.png" : "Window/minimal_gray.png")
|
||||
anchors.rightMargin: 20
|
||||
spacing: 20
|
||||
CusButton_Image {
|
||||
btnImgUrl: imgPath + (containsMouse ? "Window/minimal_white.png" : "Window/minimal_gray.png")
|
||||
onClicked: {
|
||||
view.showMinimized()
|
||||
}
|
||||
}
|
||||
TImageBtn {
|
||||
width: 20
|
||||
height: 20
|
||||
CusButton_Image {
|
||||
visible: !isMaxed
|
||||
imageUrl: imgPath + (containsMouse ? "Window/max_white.png" : "Window/max_gray.png")
|
||||
btnImgUrl: imgPath + (containsMouse ? "Window/max_white.png" : "Window/max_gray.png")
|
||||
onClicked: {
|
||||
view.showMaximized()
|
||||
}
|
||||
}
|
||||
TImageBtn {
|
||||
width: 20
|
||||
height: 20
|
||||
CusButton_Image {
|
||||
visible: isMaxed
|
||||
imageUrl: imgPath + (containsMouse ? "Window/normal_white.png" : "Window/normal_gray.png")
|
||||
btnImgUrl: imgPath + (containsMouse ? "Window/normal_white.png" : "Window/normal_gray.png")
|
||||
onClicked: {
|
||||
view.showNormal()
|
||||
}
|
||||
@ -61,37 +54,45 @@ Rectangle {
|
||||
}
|
||||
Rectangle {
|
||||
id: splitLine
|
||||
height: 16
|
||||
height: parent.height * 0.6
|
||||
width: 1
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: controlButtons.left
|
||||
anchors.rightMargin: 10
|
||||
}
|
||||
Row {
|
||||
height: 20
|
||||
id: toolRow
|
||||
height: 32
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: splitLine.left
|
||||
anchors.rightMargin: 10
|
||||
spacing: 10
|
||||
anchors.rightMargin: 20
|
||||
spacing: 20
|
||||
SkinBtn {
|
||||
width: 20
|
||||
height: 20
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
LangBtn {
|
||||
width: 20
|
||||
height: 20
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
TImageBtn {
|
||||
width: 20
|
||||
height: 20
|
||||
CusButton_Image {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
imageUrl: imgPath + (containsMouse ? "Window/about_white.png" : "Window/about_gray.png")
|
||||
btnImgUrl: imgPath + (containsMouse ? "Window/about_white.png" : "Window/about_gray.png")
|
||||
onClicked: {
|
||||
aboutDialog.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
property alias blankItem: blankItem
|
||||
Item {
|
||||
id: blankItem
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: toolRow.left
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
Component.onCompleted: {
|
||||
view.setTitleItem(blankItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,58 +2,52 @@ import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtGraphicalEffects 1.0
|
||||
import TaoQuick 1.0
|
||||
import "./Page"
|
||||
|
||||
Rectangle {
|
||||
id: rootView
|
||||
Item {
|
||||
id: rootItem
|
||||
width: 1440
|
||||
height: 900
|
||||
color: "lightblue"
|
||||
// Component.onCompleted: {
|
||||
// appInfo.splashShow = false;
|
||||
// }
|
||||
// Splash {
|
||||
// id: splash
|
||||
// anchors.centerIn: parent
|
||||
// }
|
||||
// Loader {
|
||||
// id: loader
|
||||
// source: "MainPage.qml"
|
||||
// asynchronous: true
|
||||
// opacity: 0
|
||||
// anchors{
|
||||
// fill: parent
|
||||
// margins: 2
|
||||
// }
|
||||
// Behavior on opacity {
|
||||
// NumberAnimation { duration: 800 }
|
||||
// }
|
||||
// onLoaded: {
|
||||
// timer.start()
|
||||
// }
|
||||
// }
|
||||
// Timer {
|
||||
// id: timer
|
||||
// interval: 800
|
||||
// repeat: false
|
||||
// triggeredOnStart: false
|
||||
// onTriggered: {
|
||||
// loader.opacity = 1
|
||||
// splash.visible = false
|
||||
// }
|
||||
// }
|
||||
CusButton_Blue {
|
||||
text: "hello"
|
||||
x: 80
|
||||
y: 200
|
||||
width: 120
|
||||
height: 30
|
||||
ContentData {
|
||||
id: gConfig
|
||||
}
|
||||
TFPS {
|
||||
y: 10
|
||||
x: 10
|
||||
|
||||
TitlePage {
|
||||
id: title
|
||||
width: parent.width
|
||||
height: 60
|
||||
color: gConfig.themeColor
|
||||
}
|
||||
CusButton_Blue {
|
||||
anchors.centerIn: parent
|
||||
text: qsTr("Chinese")
|
||||
Rectangle {
|
||||
id: content
|
||||
width: parent.width
|
||||
anchors {
|
||||
top: title.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
color: gConfig.background
|
||||
TFPS {
|
||||
anchors {
|
||||
right: parent.right
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ void ComponentsMgr::loadFolder(const QString& folder)
|
||||
#else
|
||||
comps.push_back("qrc" + subInfo.absoluteFilePath());
|
||||
#endif
|
||||
qWarning() << "comp" << comps.back();
|
||||
// qWarning() << "comp" << comps.back();
|
||||
compNames.push_back(subInfo.fileName());
|
||||
}
|
||||
module["comps"] = QJsonArray::fromStringList(comps);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "TaoView.h"
|
||||
#include "TaoFrameLessView.h"
|
||||
|
||||
#include <QCursor>
|
||||
#include <QGuiApplication>
|
||||
@ -54,26 +54,32 @@ static bool isFullWin(QQuickView *win)
|
||||
return win->windowState() == Qt::WindowFullScreen;
|
||||
}
|
||||
|
||||
TaoView::TaoView(QWindow *parent)
|
||||
TaoFrameLessView::TaoFrameLessView(QWindow *parent)
|
||||
: QQuickView(parent)
|
||||
{
|
||||
setFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint);
|
||||
setFlags(Qt::CustomizeWindowHint | Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint);
|
||||
setResizeMode(SizeRootObjectToView);
|
||||
setColor(QColor(Qt::transparent));
|
||||
setMinimumSize({1440, 960});
|
||||
setMinimumSize({1024, 700});
|
||||
resize(1440, 960);
|
||||
|
||||
//WS_THICKFRAME 带回Areo效果
|
||||
#if WIN32
|
||||
DWORD style = ::GetWindowLong(HWND(winId()), GWL_STYLE);
|
||||
style |= WS_MINIMIZEBOX | WS_THICKFRAME | WS_CAPTION;
|
||||
style |= WS_THICKFRAME;
|
||||
::SetWindowLong(HWND(winId()), GWL_STYLE, style);
|
||||
#endif
|
||||
|
||||
setIsMax(isMaxWin(this));
|
||||
connect(this, &QWindow::windowStateChanged, this, [&](Qt::WindowState state) { setIsMax(state == Qt::WindowMaximized); });
|
||||
}
|
||||
|
||||
TaoView::~TaoView() {}
|
||||
|
||||
void TaoView::moveToScreenCenter()
|
||||
TaoFrameLessView::~TaoFrameLessView() {}
|
||||
void TaoFrameLessView::setTitleItem(QQuickItem *item)
|
||||
{
|
||||
m_titleItem = item;
|
||||
}
|
||||
void TaoFrameLessView::moveToScreenCenter()
|
||||
{
|
||||
auto geo = screen()->availableGeometry();
|
||||
int w = width();
|
||||
@ -83,7 +89,7 @@ void TaoView::moveToScreenCenter()
|
||||
update();
|
||||
}
|
||||
|
||||
void TaoView::setIsMax(bool isMax)
|
||||
void TaoFrameLessView::setIsMax(bool isMax)
|
||||
{
|
||||
if (m_isMax == isMax)
|
||||
return;
|
||||
@ -97,7 +103,7 @@ const long border_width = 6;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool TaoView::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)
|
||||
#else
|
||||
bool TaoView::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
||||
bool TaoFrameLessView::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
||||
#endif
|
||||
{
|
||||
if (!result) {
|
||||
@ -113,16 +119,17 @@ bool TaoView::nativeEvent(const QByteArray &eventType, void *message, long *resu
|
||||
*result = mode ? WVR_REDRAW : 0;
|
||||
|
||||
const auto clientRect = mode ? &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(msg->lParam)->rgrc[0]) : reinterpret_cast<LPRECT>(msg->lParam);
|
||||
//规避 拖动border进行resize时界面闪烁
|
||||
if (!isMaxWin(this) && !isFullWin(this)) {
|
||||
if (clientRect->top != 0)
|
||||
{
|
||||
clientRect->top -= 1;
|
||||
} else if (IsMaximized(HWND(winId()))) {
|
||||
const int bw = ::GetSystemMetrics(SM_CXSIZEFRAME) + ::GetSystemMetrics(SM_CXPADDEDBORDER);
|
||||
const int bh = ::GetSystemMetrics(SM_CYSIZEFRAME) + ::GetSystemMetrics(SM_CXPADDEDBORDER);
|
||||
clientRect->top += bh;
|
||||
clientRect->bottom -= bh;
|
||||
clientRect->left += bw;
|
||||
clientRect->right -= bw;
|
||||
}
|
||||
} else {
|
||||
if (clientRect->top != 0)
|
||||
{
|
||||
clientRect->top += 1;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -142,12 +149,18 @@ bool TaoView::nativeEvent(const QByteArray &eventType, void *message, long *resu
|
||||
return true;
|
||||
}
|
||||
}
|
||||
double dpr = qApp->devicePixelRatio();
|
||||
QPoint pos = mapFromGlobal(QPoint(x / dpr, y / dpr));
|
||||
QRect titleRect(border_width, border_width, width() * 0.8, 50);
|
||||
if (titleRect.contains(pos)) {
|
||||
*result = HTCAPTION;
|
||||
return true;
|
||||
|
||||
if (m_titleItem)
|
||||
{
|
||||
auto titlePos = m_titleItem->mapToGlobal(m_titleItem->position());
|
||||
titlePos = mapFromGlobal(titlePos.toPoint());
|
||||
auto titleRect = QRect(titlePos.x(), titlePos.y(), m_titleItem->width(), m_titleItem->height());
|
||||
double dpr = qApp->devicePixelRatio();
|
||||
QPoint pos = mapFromGlobal(QPoint(x / dpr, y / dpr));
|
||||
if (titleRect.contains(pos)) {
|
||||
*result = HTCAPTION;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} //end case WM_NCHITTEST
|
@ -2,23 +2,26 @@
|
||||
|
||||
#include <QQuickView>
|
||||
//无边框窗口,支持拖动和改变大小,支持Windows平台Aero效果
|
||||
class TaoView : public QQuickView
|
||||
class TaoFrameLessView : public QQuickView
|
||||
{
|
||||
Q_OBJECT
|
||||
using Super = QQuickView;
|
||||
Q_PROPERTY(bool isMax READ isMax NOTIFY isMaxChanged)
|
||||
public:
|
||||
explicit TaoView(QWindow *parent = nullptr);
|
||||
~TaoView();
|
||||
explicit TaoFrameLessView(QWindow *parent = nullptr);
|
||||
~TaoFrameLessView();
|
||||
void moveToScreenCenter();
|
||||
bool isMax() const
|
||||
{
|
||||
return m_isMax;
|
||||
}
|
||||
|
||||
QQuickItem *titleItem() const
|
||||
{
|
||||
return m_titleItem;
|
||||
}
|
||||
public slots:
|
||||
void setIsMax(bool isMax);
|
||||
|
||||
void setTitleItem(QQuickItem *item);
|
||||
signals:
|
||||
void isMaxChanged(bool isMax);
|
||||
|
||||
@ -33,5 +36,6 @@ protected:
|
||||
#endif
|
||||
private:
|
||||
bool m_isMax;
|
||||
QQuickItem *m_titleItem = nullptr;
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "TaoView.h"
|
||||
#include "TaoFrameLessView.h"
|
||||
|
||||
#include "AppInfo.h"
|
||||
#include "ComponentsManager.h"
|
||||
@ -22,11 +22,15 @@ int main(int argc, char** argv)
|
||||
{
|
||||
prepareApp();
|
||||
QGuiApplication app(argc, argv);
|
||||
#ifdef TAODEBUG
|
||||
qSetMessagePattern("[%{time h:mm:ss.zzz} %{file} row(%{line}) %{function}] %{message}");
|
||||
#else
|
||||
Logger::initLog();
|
||||
#endif
|
||||
const auto appPath = QDir::cleanPath(app.applicationDirPath());
|
||||
qWarning() << "appPath" << appPath;
|
||||
|
||||
TaoView view;
|
||||
TaoFrameLessView view;
|
||||
|
||||
TaoFramework::instance()->setMainView(&view);
|
||||
TaoFramework::instance()->createObject<Trans>();
|
||||
@ -39,7 +43,7 @@ int main(int argc, char** argv)
|
||||
view.engine()->addImportPath(qmlPath);
|
||||
#ifdef TaoQuickImportPath
|
||||
view.engine()->addImportPath(TaoQuickImportPath);
|
||||
qWarning() << TaoQuickImportPath;
|
||||
qWarning() << "TaoQuickImportPath " << TaoQuickImportPath;
|
||||
#endif
|
||||
|
||||
#ifdef TaoQuickImagePath
|
||||
|
@ -7,16 +7,16 @@ msvc | gcc | xcode {
|
||||
}
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/Src/TaoFrameLessView.h \
|
||||
$$PWD/Src/TaoObject.h \
|
||||
$$PWD/Src/TaoFramework.h \
|
||||
$$PWD/Src/TaoView.h \
|
||||
$$PWD/Src/Trans.h \
|
||||
$$PWD/Src/AppInfo.h \
|
||||
$$PWD/Src/ComponentsManager.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/Src/TaoFrameLessView.cpp \
|
||||
$$PWD/Src/TaoFramework.cpp \
|
||||
$$PWD/Src/TaoView.cpp \
|
||||
$$PWD/Src/Trans.cpp \
|
||||
$$PWD/Src/AppInfo.cpp \
|
||||
$$PWD/Src/ComponentsManager.cpp \
|
||||
@ -40,7 +40,7 @@ CONFIG(debug, debug|release) {
|
||||
}
|
||||
|
||||
!android:!ios {
|
||||
trans.files = $$files($$_PRO_FILE_PWD_/Trans/language_*.json)
|
||||
trans.file = $$_PRO_FILE_PWD_/Trans
|
||||
trans.path = $$DESTDIR/Trans
|
||||
COPIES += trans
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
TEMPLATE = app
|
||||
TARGET = TaoQuickApp
|
||||
|
||||
QT += qml quick
|
||||
QT += core gui qml quick
|
||||
|
||||
CONFIG += c++17 qtquickcompiler utf8_source
|
||||
|
||||
@ -11,8 +11,8 @@ setTaoVersion()
|
||||
load(taoBundle)
|
||||
BundlePath = $$getBundlePath("TaoQuickApp")
|
||||
|
||||
load(taoBuildPath)
|
||||
setBuildPath($${TaoQuick_BUILD_TREE}/$${TARGET})
|
||||
#load(taoBuildPath)
|
||||
#setBuildPath($${TaoQuick_BUILD_TREE}/$${TARGET})
|
||||
|
||||
CONFIG(debug,debug|release) {
|
||||
DESTDIR = $${TaoQuick_RUN_TREE}/debug
|
||||
|
@ -12,6 +12,8 @@ Button {
|
||||
property alias tipDelay: toolTip.delay
|
||||
property alias tipTimeout: toolTip.timeout
|
||||
|
||||
property bool containsMouse: hovered
|
||||
property bool containsPressed: pressed
|
||||
property color backgroundColorNormal
|
||||
property color backgroundColorHovered
|
||||
property color backgroundColorPressed
|
||||
|
@ -12,14 +12,15 @@ Button {
|
||||
property alias tipVisible: toolTip.visible
|
||||
property alias tipDelay: toolTip.delay
|
||||
property alias tipTimeout: toolTip.timeout
|
||||
|
||||
property bool containsMouse: hovered
|
||||
property bool containsPressed: pressed
|
||||
|
||||
property string btnImgNormal
|
||||
property string btnImgHovered
|
||||
property string btnImgPressed
|
||||
property string btnImgDisbaled
|
||||
|
||||
property string btnImgUr: {
|
||||
property string btnImgUrl: {
|
||||
if (!cusButtonImage.enabled) {
|
||||
return btnImgDisbaled
|
||||
} else if (cusButtonImage.pressed) {
|
||||
@ -38,7 +39,7 @@ Button {
|
||||
}
|
||||
background: Image {
|
||||
id: backImage
|
||||
source: btnImgUr
|
||||
source: btnImgUrl
|
||||
width: sourceSize.width
|
||||
height: sourceSize.height
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user