Skip to content

Commit

Permalink
add some controls
Browse files Browse the repository at this point in the history
  • Loading branch information
jared2020 committed Dec 9, 2020
1 parent 1a578ba commit c5b2f53
Show file tree
Hide file tree
Showing 9 changed files with 208 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import QtQuick 2.10
import QtQuick.Controls 2.2
import ".."
import "../.."
Button {
id: cusButtonImage

property alias tipText: toolTip.text
property alias tipItem: toolTip
property alias tipVisible: toolTip.visible
property alias tipDelay: toolTip.delay
property alias tipTimeout: toolTip.timeout

property string btnImgUr
property color backgroundColor: "transparent"
property color backgroundColor_pressed
property color backgroundColor_hovered

BasicTooltip {
id: toolTip
visible: cusButtonImage.hovered && String(text).length
}
background: Rectangle {
width: cusButtonImage.width
height: cusButtonImage.height
color: cusButtonImage.pressed ? backgroundColor_pressed : ( cusButtonImage.hovered ? backgroundColor_hovered : backgroundColor)
CusImage {
anchors.centerIn: parent
width: cusButtonImage.width
height: cusButtonImage.height
source: btnImgUr
}
}
TransArea {}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import QtQml 2.0
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtGraphicalEffects 1.0
//import QtGraphicalEffects 1.0
import ".."
import "../.."

Expand Down Expand Up @@ -36,24 +37,24 @@ Button {
height: cusButtonImage.height
radius: CusConfig.controlBorderRadius
color: backgroundColor
ColorOverlay {
source: baseImage
width: baseImage.width
height: baseImage.height
anchors.centerIn: parent
cached: true
color: {
if (!cusButtonImage.enabled) {
return colorDisable
} else if (cusButtonImage.pressed || selected) {
return colorPressed
} else if (cusButtonImage.hovered) {
return colorHovered
} else {
return colorNormal
}
}
}
// ColorOverlay {
// source: baseImage
// width: baseImage.width
// height: baseImage.height
// anchors.centerIn: parent
// cached: true
// color: {
// if (!cusButtonImage.enabled) {
// return colorDisable
// } else if (cusButtonImage.pressed || selected) {
// return colorPressed
// } else if (cusButtonImage.hovered) {
// return colorHovered
// } else {
// return colorNormal
// }
// }
// }
}
BasicTooltip {
id: toolTip
Expand Down
54 changes: 54 additions & 0 deletions src/TaoQuick/imports/TaoQuick/Qml/CusButton/CusRadioButton.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import QtQuick 2.10
import QtQuick.Controls 2.2
import ".."
import "../.."

RadioButton {
id: cusRadioButton

implicitHeight: Config.fixedHeight
implicitWidth: 200
property alias tipText: toolTip.text
property alias tipItem: toolTip
property alias tipVisible: toolTip.visible
property alias tipDelay: toolTip.delay
property alias tipTimeout: toolTip.timeout

property string btnImgNormal: Config.imagePathPrefix + "0_Common/RadioBtn.png"
property string btnImgHovered: Config.imagePathPrefix + "0_Common/RadioBtn_Hover.png"
property string btnImgPressed: Config.imagePathPrefix + "0_Common/RadioBtn_Checked.png"
property string btnImgDisbaled: Config.imagePathPrefix + "0_Common/RadioBtn_Disabled.png"

property string btnImgUr: {
if (!cusRadioButton.enabled) {
return btnImgDisbaled
} else if (cusRadioButton.checked || cusRadioButton.pressed) {
return btnImgPressed
} else if (cusRadioButton.hovered) {
return btnImgHovered
} else {
return btnImgNormal
}
}

property color textColor: Config.textColor

indicator: CusImage {
x: cusRadioButton.leftPadding
source: btnImgUr
y: (cusRadioButton.height - height) /2
}

contentItem: BasicText {
height: cusRadioButton.height
leftPadding: cusRadioButton.leftPadding + cusRadioButton.indicator.width + cusRadioButton.spacing
text: cusRadioButton.text
color: cusRadioButton.textColor
horizontalAlignment: Text.AlignLeft
}
BasicTooltip {
id: toolTip
visible: cusRadioButton.hovered && String(text).length
}
TransArea {}
}
13 changes: 13 additions & 0 deletions src/TaoQuick/imports/TaoQuick/Qml/CusLabel/CusLabel_Center.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import QtQuick 2.10
import QtQuick.Controls 2.2
import ".."
import "../.."
Label {
font.pixelSize: Config.fontSize_default
color: Config.textColor
height: Config.fixedHeight
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
// renderType: Text.NativeRendering
}
13 changes: 13 additions & 0 deletions src/TaoQuick/imports/TaoQuick/Qml/CusLabel/CusLabel_Left.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import QtQuick 2.10
import QtQuick.Controls 2.2
import ".."
import "../.."
Label {
font.pixelSize: Config.fontSize_default
color: Config.textColor
height: Config.fixedHeight
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
// renderType: Text.NativeRendering
}
18 changes: 9 additions & 9 deletions src/TaoQuick/imports/TaoQuick/Qml/CusWizard/CusWizardPage.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtGraphicalEffects 1.0
// import QtGraphicalEffects 1.0
import ".."
import "../.."

Expand Down Expand Up @@ -34,14 +34,14 @@ Item {
y: focusRect.y
width: focusRect.width
height: focusRect.height
RadialGradient {
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: "transparent" }
GradientStop { position: 0.6; color: maskColor }
}
opacity: maskOpacity / 2
}
// RadialGradient {
// anchors.fill: parent
// gradient: Gradient {
// GradientStop { position: 0.0; color: "transparent" }
// GradientStop { position: 0.6; color: maskColor }
// }
// opacity: maskOpacity / 2
// }
}
//left
Rectangle {
Expand Down
4 changes: 4 additions & 0 deletions src/TaoQuick/imports/TaoQuick/TaoQuick.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
<file>Qml/CusButton/CusButton_Blue.qml</file>
<file>Qml/CusButton/CusButton_Gradient.qml</file>
<file>Qml/CusButton/CusButton_Image.qml</file>
<file>Qml/CusButton/CusButton_ImageBackground.qml</file>
<file>Qml/CusButton/CusButton_ImageColorOverlay.qml</file>
<file>Qml/CusButton/CusButton_Red.qml</file>
<file>Qml/CusButton/CusButton_White.qml</file>
<file>Qml/CusButton/CusRadioButton.qml</file>
<file>Qml/CusButton/CusTextButton.qml</file>
<file>Qml/CusCheckBox/CusCheckBox.qml</file>
<file>Qml/CusCheckBox/CusSwitch.qml</file>
Expand All @@ -28,6 +30,8 @@
<file>Qml/CusInput/CusTextField_Valid.qml</file>
<file>Qml/CusInput/CusTextInput.qml</file>
<file>Qml/CusLabel/CusLabel.qml</file>
<file>Qml/CusLabel/CusLabel_Center.qml</file>
<file>Qml/CusLabel/CusLabel_Left.qml</file>
<file>Qml/CusListView/CusListView.qml</file>
<file>Qml/CusPopup/CusPopup.qml</file>
<file>Qml/CusPopup/CusToolTip_Triangle.qml</file>
Expand Down
56 changes: 56 additions & 0 deletions src/TaoQuick/imports/TaoQuick/designer/TaoQuick.metainfo
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,20 @@ MetaInfo {
Property { name: "height"; type: "int"; value: 80 }
}
}
Type {
name: "TaoQuick.Qml.CusButton.CusButton_ImageBackground"
icon: "images/CusButton_ImageBackground.png"

ItemLibraryEntry {
name: "CusButton_ImageBackground"
category: "TaoQuick - CusButton"
libraryIcon: "images/CusButton_ImageBackground.png"
version: "1.0"
requiredImport: "TaoQuick"
Property { name: "width"; type: "int"; value: 120 }
Property { name: "height"; type: "int"; value: 80 }
}
}
Type {
name: "TaoQuick.Qml.CusButton.CusButton_ImageColorOverlay"
icon: "images/CusButton_ImageColorOverlay.png"
Expand Down Expand Up @@ -167,6 +181,20 @@ MetaInfo {
Property { name: "height"; type: "int"; value: 80 }
}
}
Type {
name: "TaoQuick.Qml.CusButton.CusRadioButton"
icon: "images/CusRadioButton.png"

ItemLibraryEntry {
name: "CusRadioButton"
category: "TaoQuick - CusButton"
libraryIcon: "images/CusRadioButton.png"
version: "1.0"
requiredImport: "TaoQuick"
Property { name: "width"; type: "int"; value: 120 }
Property { name: "height"; type: "int"; value: 80 }
}
}
Type {
name: "TaoQuick.Qml.CusButton.CusTextButton"
icon: "images/CusTextButton.png"
Expand Down Expand Up @@ -363,6 +391,34 @@ MetaInfo {
Property { name: "height"; type: "int"; value: 80 }
}
}
Type {
name: "TaoQuick.Qml.CusLabel.CusLabel_Center"
icon: "images/CusLabel_Center.png"

ItemLibraryEntry {
name: "CusLabel_Center"
category: "TaoQuick - CusLabel"
libraryIcon: "images/CusLabel_Center.png"
version: "1.0"
requiredImport: "TaoQuick"
Property { name: "width"; type: "int"; value: 120 }
Property { name: "height"; type: "int"; value: 80 }
}
}
Type {
name: "TaoQuick.Qml.CusLabel.CusLabel_Left"
icon: "images/CusLabel_Left.png"

ItemLibraryEntry {
name: "CusLabel_Left"
category: "TaoQuick - CusLabel"
libraryIcon: "images/CusLabel_Left.png"
version: "1.0"
requiredImport: "TaoQuick"
Property { name: "width"; type: "int"; value: 120 }
Property { name: "height"; type: "int"; value: 80 }
}
}
Type {
name: "TaoQuick.Qml.CusListView.CusListView"
icon: "images/CusListView.png"
Expand Down
4 changes: 4 additions & 0 deletions src/TaoQuick/imports/TaoQuick/qmldir
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ CusButton 1.0 Qml/CusButton/CusButton.qml
CusButton_Blue 1.0 Qml/CusButton/CusButton_Blue.qml
CusButton_Gradient 1.0 Qml/CusButton/CusButton_Gradient.qml
CusButton_Image 1.0 Qml/CusButton/CusButton_Image.qml
CusButton_ImageBackground 1.0 Qml/CusButton/CusButton_ImageBackground.qml
CusButton_ImageColorOverlay 1.0 Qml/CusButton/CusButton_ImageColorOverlay.qml
CusButton_Red 1.0 Qml/CusButton/CusButton_Red.qml
CusButton_White 1.0 Qml/CusButton/CusButton_White.qml
CusRadioButton 1.0 Qml/CusButton/CusRadioButton.qml
CusTextButton 1.0 Qml/CusButton/CusTextButton.qml
CusCheckBox 1.0 Qml/CusCheckBox/CusCheckBox.qml
CusSwitch 1.0 Qml/CusCheckBox/CusSwitch.qml
Expand All @@ -25,6 +27,8 @@ CusTextField_Search 1.0 Qml/CusInput/CusTextField_Search.qml
CusTextField_Valid 1.0 Qml/CusInput/CusTextField_Valid.qml
CusTextInput 1.0 Qml/CusInput/CusTextInput.qml
CusLabel 1.0 Qml/CusLabel/CusLabel.qml
CusLabel_Center 1.0 Qml/CusLabel/CusLabel_Center.qml
CusLabel_Left 1.0 Qml/CusLabel/CusLabel_Left.qml
CusListView 1.0 Qml/CusListView/CusListView.qml
CusPopup 1.0 Qml/CusPopup/CusPopup.qml
CusToolTip_Triangle 1.0 Qml/CusPopup/CusToolTip_Triangle.qml
Expand Down

0 comments on commit c5b2f53

Please sign in to comment.