1
0
mirror of https://github.com/jaredtao/TaoQuick.git synced 2025-02-06 21:48:24 +08:00

update CheckBox;update ComboBox

This commit is contained in:
jared 2020-10-21 10:49:07 +08:00
parent e25e26ce39
commit 702e697d95
32 changed files with 180 additions and 193 deletions

View File

@ -63,10 +63,12 @@ Item {
CusComboBox { CusComboBox {
model: 10 model: 10
width: 120 width: 120
displayText: qsTr(currentText) + trans.transString
} }
CusComboBox { CusComboBox {
model: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] model: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
width: 120 width: 120
displayText: qsTr(currentText) + trans.transString
} }
} }
Item { Item {

View File

@ -38,13 +38,7 @@
<file>Image/Effect/Dissolve_2.png</file> <file>Image/Effect/Dissolve_2.png</file>
<file>Image/Effect/girl.jpg</file> <file>Image/Effect/girl.jpg</file>
<file>Image/Effect/soundRect.png</file> <file>Image/Effect/soundRect.png</file>
<file>Image/Tao/qq.jpg</file>
<file>Image/Tao/qq_connect.jpg</file>
<file>Image/Tao/qqgroup.jpg</file>
<file>Image/Tao/qqgroup2.jpg</file>
<file>Image/Tao/weixin.jpg</file> <file>Image/Tao/weixin.jpg</file>
<file>Image/Tao/weixin_connect.jpg</file>
<file>Image/Tao/weixingongzhonghao.jpg</file>
<file>Image/Tao/zhifubao.jpg</file> <file>Image/Tao/zhifubao.jpg</file>
<file>Image/Common/left.png</file> <file>Image/Common/left.png</file>
<file>Image/Common/left_hovered.png</file> <file>Image/Common/left_hovered.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -11,5 +11,7 @@
<file>Qml/Pane/TitlePane.qml</file> <file>Qml/Pane/TitlePane.qml</file>
<file>Qml/Page/Home.qml</file> <file>Qml/Page/Home.qml</file>
<file>Qml/Pane/ContentModel.qml</file> <file>Qml/Pane/ContentModel.qml</file>
<file>Qml/Dialog/AboutDialog.qml</file>
<file>Qml/Dialog/SettingsDialog.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -1,22 +1,25 @@
import QtQuick 2.9 import QtQuick 2.9
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
import QtGraphicalEffects 1.0
import TaoQuick 1.0 import TaoQuick 1.0
import "../Biz"
Popup { Popup {
id: root id: root
width: 600 width: 680
height: 340 height: 460
background: Rectangle { background: Item {
id: back
width: root.width width: root.width
height: root.height height: root.height
radius: 8 Rectangle {
color: gConfig.themeColor id: back
border.width: 1 anchors {
border.color: gConfig.reserverColor fill: parent
margins: 4
}
radius: 4
color: CusConfig.themeColor
MoveArea { MoveArea {
anchors.fill: parent anchors.fill: parent
control: root control: root
@ -25,7 +28,7 @@ Popup {
root.y += yOffset root.y += yOffset
} }
} }
Image { CusImage {
id: img id: img
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 2 anchors.leftMargin: 2
@ -34,12 +37,10 @@ Popup {
} }
CusButton { CusButton {
id: closeBtn id: closeBtn
text: qsTr("Close") text: qsTr("Close") + trans.transString
width: 80 width: 80
height: 38 height: 38
radius: 8 radius: 8
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.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: 4 anchors.bottomMargin: 4
@ -53,76 +54,80 @@ Popup {
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 4 anchors.topMargin: 4
anchors.bottom: closeBtn.top anchors.bottom: closeBtn.top
anchors.bottomMargin: 260
anchors.right: parent.right anchors.right: parent.right
spacing: 18 spacing: 18
Text { BasicText {
anchors.left: parent.left anchors.horizontalCenter: parent.horizontalCenter
anchors.right: parent.right
text: appInfo.appName + " " + appInfo.appVersion text: appInfo.appName + " " + appInfo.appVersion
font.pixelSize: 20 font.pixelSize: 20
renderType: Text.NativeRendering font.bold: true
} }
Text { BasicText {
anchors.left: parent.left anchors.horizontalCenter: parent.horizontalCenter
anchors.right: parent.right
wrapMode: Text.WordWrap
text: "Base on Qt " + appInfo.compilerVendor text: "Base on Qt " + appInfo.compilerVendor
font.pixelSize: 16
renderType: Text.NativeRendering
} }
Text { BasicText {
anchors.left: parent.left anchors.horizontalCenter: parent.horizontalCenter
anchors.right: parent.right
text: "Build on " + appInfo.buildDateTime text: "Build on " + appInfo.buildDateTime
font.pixelSize: 16
renderType: Text.NativeRendering
} }
TextInput { CusTextInput {
anchors.left: parent.left anchors.horizontalCenter: parent.horizontalCenter
anchors.right: parent.right
readOnly: true readOnly: true
selectByMouse: true
text: "From revision " + appInfo.buildRevision text: "From revision " + appInfo.buildRevision
font.pixelSize: 16
font.underline: true font.underline: true
renderType: Text.NativeRendering
} }
Text { BasicText {
anchors.left: parent.left anchors.horizontalCenter: parent.horizontalCenter
anchors.right: parent.right
text: appInfo.copyRight text: appInfo.copyRight
font.pixelSize: 16
renderType: Text.NativeRendering
} }
Text { BasicText {
anchors.left: parent.left anchors.horizontalCenter: parent.horizontalCenter
anchors.right: parent.right
textFormat: Text.RichText textFormat: Text.RichText
text: "Author JaredTao <a href=\"https://jaredtao.github.io\">JaredTao Blog</a>" text: "Author JaredTao <a href=\"https://jaredtao.github.io\">JaredTao Blog</a>"
onLinkActivated: { onLinkActivated: {
Qt.openUrlExternally("https://jaredtao.github.io") Qt.openUrlExternally("https://jaredtao.github.io")
} }
font.pixelSize: 16 TransArea {
renderType: Text.NativeRendering cursorShape: Qt.PointingHandCursor
}
TextArea {
readOnly: true
anchors.left: parent.left
anchors.right: parent.right
text: appInfo.descript
font.pixelSize: 16
renderType: Text.NativeRendering
} }
} }
} }
function show() Row {
{ anchors {
bottom: closeBtn.top
bottomMargin: 4
horizontalCenter: parent.horizontalCenter
}
spacing: 20
BasicText {
text: qsTr("Sponsors") + trans.transString
anchors.verticalCenter: parent.verticalCenter
}
CusImage {
source: imgPath + "Tao/weixin.jpg"
}
CusImage {
source: imgPath + "Tao/zhifubao.jpg"
}
}
}
DropShadow {
source: back
anchors.fill: back
radius: 4
samples: 16
color: "#80000000"
}
}
function show() {
x = (parent.width - width) / 2 x = (parent.width - width) / 2
y = (parent.height - height) / 2 y = (parent.height - height) / 2
open() open()
} }
} }

View File

@ -18,6 +18,7 @@ Item {
right: parent.right right: parent.right
rightMargin: 4 rightMargin: 4
} }
placeholderText: qsTr("Search") + trans.transString
} }
} }
Rectangle { Rectangle {

View File

@ -3,6 +3,7 @@ import QtQuick.Controls 2.2
import TaoQuick 1.0 import TaoQuick 1.0
import "./Page" import "./Page"
import "./Pane" import "./Pane"
import "./Dialog"
//import Qt.labs.platform 1.1 //import Qt.labs.platform 1.1
CusBackground { CusBackground {
id: rootItem id: rootItem
@ -29,9 +30,9 @@ CusBackground {
// } // }
// } // }
// } // }
// AboutDialog { AboutDialog {
// id: aboutDialog id: aboutDialog
// } }
// SettingsDialog { // SettingsDialog {
// id: settingDialog // id: settingDialog
// } // }

View File

@ -15,7 +15,7 @@ static void prepareApp()
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setOrganizationName("JaredTao"); QCoreApplication::setOrganizationName("JaredTao");
QCoreApplication::setOrganizationDomain("https://JaredTao.gitee.io"); QCoreApplication::setOrganizationDomain("https://JaredTao.gitee.io");
QCoreApplication::setApplicationName("TaoQuickApp"); QCoreApplication::setApplicationName("TaoQuickShow");
} }
int main(int argc, char** argv) int main(int argc, char** argv)

View File

@ -338,6 +338,11 @@
{ {
"key": "Misc", "key": "Misc",
"value": "杂项" "value": "杂项"
},
{
"key": "Sponsors",
"value": "赞助"
} }
] ]
} }

Binary file not shown.

View File

@ -13,12 +13,12 @@
#define VER_COMPANYNAME_STR "JaredTao\0" #define VER_COMPANYNAME_STR "JaredTao\0"
#define VER_FILEDESCRIPTION_STR "TaoQuickDemo\0" #define VER_FILEDESCRIPTION_STR "TaoQuickShow\0"
#define VER_INTERNALNAME_STR "jaredtao.github.io\0" #define VER_INTERNALNAME_STR "jaredtao.github.io\0"
#define VER_LEGALCOPYRIGHT_STR "Copyright(C)2019-2029 JaredTao\0" #define VER_LEGALCOPYRIGHT_STR "Copyright(C)2019-2029 JaredTao\0"
#define VER_LEGALTRADEMARKS_STR "JaredTao\0" #define VER_LEGALTRADEMARKS_STR "JaredTao\0"
#define VER_ORIGINALFILENAME_STR "TaoQuickDemo.exe\0" #define VER_ORIGINALFILENAME_STR "TaoQuickShow.exe\0"
#define VER_PRODUCTNAME_STR "TaoQuickDemo\0" #define VER_PRODUCTNAME_STR "TaoQuickShow\0"
// version number (string) // version number (string)
#define TOSTRING2(arg) #arg #define TOSTRING2(arg) #arg

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 B

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

View File

@ -6,19 +6,12 @@ import "../.."
CheckBox { CheckBox {
id: cusCheckBox id: cusCheckBox
height: CusConfig.fixedHeight implicitHeight: CusConfig.fixedHeight
// background: Rectangle {
// color: cusCheckBox.enabled ? Config.controlBackgroundColor : Config.controlBackgroundColor_disabled
// radius: Config.controlBorderRadius
// border.width: 1
// border.color: cusCheckBox.hovered ? Config.controlBorderColor_hovered : Config.controlBorderColor
// }
checked: false checked: false
contentItem: CusLabel { contentItem: CusLabel {
leftPadding: cusCheckBox.indicator.width + cusCheckBox.spacing leftPadding: cusCheckBox.indicator.width + cusCheckBox.spacing
text: cusCheckBox.text text: cusCheckBox.text
font: cusCheckBox.font
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight elide: Text.ElideRight
@ -28,14 +21,7 @@ CheckBox {
property color colorHovered: CusConfig.imageColor_hovered property color colorHovered: CusConfig.imageColor_hovered
property color colorPressed: CusConfig.imageColor_pressed property color colorPressed: CusConfig.imageColor_pressed
property color colorDisable: CusConfig.imageColor_disabled property color colorDisable: CusConfig.imageColor_disabled
// readonly property string imgUrlNormal: CusConfig.imagePathPrefix + "Checkbox_16.png" readonly property string imgUrlCheck: CusConfig.imagePathPrefix + "Check.png"
// readonly property string imgUrlChecked: CusConfig.imagePathPrefix + "Checkbox_16_Checked.png"
// readonly property string imgUrlHovered: CusConfig.imagePathPrefix + "Checkbox_16_Hover.png"
// readonly property string imgUrlDisable: CusConfig.imagePathPrefix + "Checkbox_16_Disable.png"
// readonly property string imgUrlCheckedDisable: CusConfig.imagePathPrefix + "Checkbox_16_Checked_Disable.png"
readonly property string imgUrlBorder: CusConfig.imagePathPrefix + "checkbox_border.png"
readonly property string imgUrlCheck: CusConfig.imagePathPrefix + "checkbox_check.png"
CusImage { CusImage {
id: baseImgCheck id: baseImgCheck
@ -43,38 +29,24 @@ CheckBox {
visible: false visible: false
source: imgUrlCheck source: imgUrlCheck
} }
CusImage {
id: baseImgBorder
smooth: true
visible: false
source: imgUrlBorder
}
indicator: ColorOverlay { indicator: Rectangle {
id: indicatorImg implicitWidth: 24
implicitHeight: 24
x: cusCheckBox.leftPadding x: cusCheckBox.leftPadding
y: cusCheckBox.height / 2 - height / 2 y: (cusCheckBox.height - height) / 2
source: baseImgBorder color: cusCheckBox.enabled ? CusConfig.controlColor : CusConfig.controlColor_disabled
width: baseImgBorder.width radius: CusConfig.controlBorderRadius
height: baseImgBorder.height border.width: 1
cached: true border.color: cusCheckBox.pressed ? CusConfig.controlBorderColor_pressed : (cusCheckBox.hovered ? CusConfig.controlBorderColor_hovered : CusConfig.controlBorderColor)
color: {
if (!cusCheckBox.enabled) {
return colorDisable
} else if (cusCheckBox.pressed) {
return colorPressed
} else if (cusCheckBox.hovered) {
return colorHovered
} else {
return colorNormal
}
}
ColorOverlay { ColorOverlay {
anchors.fill: parent id: indicatorImg
anchors.margins: 2
source: baseImgCheck source: baseImgCheck
visible: cusCheckBox.checked width: baseImgCheck.width
height: baseImgCheck.height
anchors.centerIn: parent
cached: true cached: true
visible: cusCheckBox.checked
color: { color: {
if (!cusCheckBox.enabled) { if (!cusCheckBox.enabled) {
return colorDisable return colorDisable

View File

@ -11,7 +11,6 @@ ComboBox {
rightPadding: 4 rightPadding: 4
currentIndex: 0 currentIndex: 0
readonly property string imgUrlNormal: CusConfig.imagePathPrefix + "ComboBox_Down.png" readonly property string imgUrlNormal: CusConfig.imagePathPrefix + "ComboBox_Down.png"
readonly property string imgUrlHovered: CusConfig.imagePathPrefix + "ComboBox_Down_Hover.png"
property real defaultHeight: CusConfig.fixedHeight * 6 property real defaultHeight: CusConfig.fixedHeight * 6
displayText: qsTr(currentText) displayText: qsTr(currentText)
@ -26,7 +25,6 @@ ComboBox {
leftPadding: cusComboBox.leftPadding leftPadding: cusComboBox.leftPadding
rightPadding: cusComboBox.indicator.width + cusComboBox.spacing rightPadding: cusComboBox.indicator.width + cusComboBox.spacing
text: cusComboBox.displayText text: cusComboBox.displayText
font: cusComboBox.font
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight elide: Text.ElideRight
@ -45,9 +43,15 @@ ComboBox {
smooth: true smooth: true
visible: false visible: false
} }
indicator: ColorOverlay { indicator: Item {
height: cusComboBox.height - cusComboBox.topPadding - cusComboBox.bottomPadding
width: height
x: cusComboBox.width - width - cusComboBox.rightPadding x: cusComboBox.width - width - cusComboBox.rightPadding
y: cusComboBox.topPadding + (cusComboBox.availableHeight - height) / 2 y: (cusComboBox.height - height) / 2
ColorOverlay {
anchors {
centerIn: parent
}
source: baseImage source: baseImage
width: baseImage.width width: baseImage.width
height: baseImage.height height: baseImage.height
@ -70,6 +74,7 @@ ComboBox {
} }
} }
} }
}
popup: Popup { popup: Popup {
y: cusComboBox.height - 1 y: cusComboBox.height - 1
@ -97,7 +102,7 @@ ComboBox {
background: Rectangle { background: Rectangle {
color: CusConfig.controlColor color: CusConfig.controlColor
// radius: CusConfig.controlBorderRadius // radius: CusConfig.controlBorderRadius
border.width: 1 border.width: 1
border.color: CusConfig.controlBorderColor border.color: CusConfig.controlBorderColor
} }

View File

@ -1,7 +1,6 @@
import QtQuick 2.9 import QtQuick 2.9
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
import ".."
import "../.."
Image { Image {
width: sourceSize.width width: sourceSize.width
height: sourceSize.height height: sourceSize.height

View File

@ -11,11 +11,11 @@ TextField {
maximumLength: CusConfig.maximumLength maximumLength: CusConfig.maximumLength
selectionColor: CusConfig.controlColor_pressed selectionColor: CusConfig.controlColor_pressed
selectedTextColor: CusConfig.textColor_pressed selectedTextColor: CusConfig.textColor_pressed
font.pixelSize: CusConfig.fontPixel
background: Rectangle { background: Rectangle {
color: (cusTextField.enabled && !cusTextField.readOnly) ? CusConfig.controlColor : CusConfig.controlColor_disabled color: (cusTextField.enabled && !cusTextField.readOnly) ? CusConfig.controlColor : CusConfig.controlColor_disabled
radius: CusConfig.controlBorderRadius radius: CusConfig.controlBorderRadius
border.width: 1 border.width: 1
border.color: (cusTextField.enabled && !cusTextField.readOnly && (cusTextField.hovered || cusTextField.focus)) ? CusConfig.controlBorderColor_hovered : CusConfig.controlBorderColor border.color: (cusTextField.enabled && !cusTextField.readOnly && (cusTextField.hovered || cusTextField.focus)) ? CusConfig.controlBorderColor_hovered : CusConfig.controlBorderColor
} }
} }

View File

@ -8,7 +8,7 @@ CusTextField {
implicitWidth: 240 implicitWidth: 240
height: CusConfig.fixedHeight height: CusConfig.fixedHeight
placeholderText: qsTr("Search")
leftPadding: 36 leftPadding: 36
rightPadding: 30 rightPadding: 30
background: Rectangle { background: Rectangle {

View File

@ -5,9 +5,13 @@ import "../.."
TextInput { TextInput {
id: cusTextField id: cusTextField
height: CusConfig.fixedHeight height: CusConfig.fixedHeight
font.pixelSize: CusConfig.fontPixel
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
selectByMouse: true selectByMouse: true
color: CusConfig.textColor color: CusConfig.textColor
maximumLength: CusConfig.maximumLength maximumLength: CusConfig.maximumLength
selectionColor: CusConfig.controlColor_pressed selectionColor: CusConfig.controlColor_pressed
selectedTextColor: CusConfig.textColor_pressed selectedTextColor: CusConfig.textColor_pressed
renderType: Text.NativeRendering
} }

View File

@ -13,7 +13,6 @@ SpinBox {
rightPadding: 4 rightPadding: 4
readonly property string imgUrlNormal : CusConfig.imagePathPrefix + "Expanded.png"; readonly property string imgUrlNormal : CusConfig.imagePathPrefix + "Expanded.png";
readonly property string imgUrlHovered : CusConfig.imagePathPrefix + "Expanded_Hover.png";
background: Rectangle { background: Rectangle {
radius: CusConfig.controlBorderRadius radius: CusConfig.controlBorderRadius
color: CusConfig.controlColor color: CusConfig.controlColor
@ -24,7 +23,6 @@ SpinBox {
id: input id: input
z: 2 z: 2
// text: cusSpinBox.value // text: cusSpinBox.value
font: cusSpinBox.font
color: CusConfig.textColor color: CusConfig.textColor
width: cusSpinBox.width - cusSpinBox.up.indicator.width - cusSpinBox.leftPadding - cusSpinBox.rightPadding width: cusSpinBox.width - cusSpinBox.up.indicator.width - cusSpinBox.leftPadding - cusSpinBox.rightPadding
selectionColor: CusConfig.controlColor_pressed selectionColor: CusConfig.controlColor_pressed

View File

@ -74,8 +74,7 @@
<file>Qml/Misc/CusRectDraw.qml</file> <file>Qml/Misc/CusRectDraw.qml</file>
<file>Qml/Misc/CusResizeBorder.qml</file> <file>Qml/Misc/CusResizeBorder.qml</file>
<file>Qml/Misc/CusShortCutKeys.qml</file> <file>Qml/Misc/CusShortCutKeys.qml</file>
<file>Images/checkbox_border.png</file> <file>Images/Check.png</file>
<file>Images/checkbox_check.png</file>
<file>Images/ComboBox_Down.png</file> <file>Images/ComboBox_Down.png</file>
<file>Images/Expanded.png</file> <file>Images/Expanded.png</file>
<file>Images/Search.png</file> <file>Images/Search.png</file>