mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-24 11:36:14 +00:00
StandardButton/StandardDropdown QML development
This commit is contained in:
parent
8295b9dffd
commit
3d5fee0a2f
2 changed files with 33 additions and 28 deletions
|
@ -28,17 +28,18 @@
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
|
import "." 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: button
|
id: button
|
||||||
height: 37 * scaleRatio
|
height: 37 * scaleRatio
|
||||||
property string shadowPressedColor: "#B32D00"
|
property string shadowPressedColor: Style.buttonBackgroundColor
|
||||||
property string shadowReleasedColor: "#FF4304"
|
property string shadowReleasedColor: Style.buttonBackgroundColor
|
||||||
property string pressedColor: "#FF4304"
|
property string pressedColor: Style.buttonBackgroundColor
|
||||||
property string releasedColor: "#FF6C3C"
|
property string releasedColor: Style.buttonBackgroundColor
|
||||||
property string icon: ""
|
property string icon: ""
|
||||||
property string textColor: "#FFFFFF"
|
property string textColor: button.enabled? Style.buttonTextColor: Style.buttonTextColorDisabled
|
||||||
property int fontSize: 12 * scaleRatio
|
property int fontSize: 18 * scaleRatio
|
||||||
property alias text: label.text
|
property alias text: label.text
|
||||||
signal clicked()
|
signal clicked()
|
||||||
|
|
||||||
|
@ -56,30 +57,31 @@ Item {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
height: parent.height - 1
|
height: parent.height - 1
|
||||||
y: buttonArea.pressed ? 0 : 1
|
y: buttonArea.pressed ? 0 : 1
|
||||||
//radius: 4
|
radius: 3
|
||||||
color: {
|
color: parent.enabled ? Style.buttonBackgroundColor : Style.buttonBackgroundColorDisabled
|
||||||
parent.enabled ? (buttonArea.pressed ? parent.shadowPressedColor : parent.shadowReleasedColor)
|
// color: {
|
||||||
: Qt.lighter(parent.shadowReleasedColor)
|
// parent.enabled ? (buttonArea.pressed ? parent.shadowPressedColor : parent.shadowReleasedColor)
|
||||||
}
|
// : Qt.lighter(parent.shadowReleasedColor)
|
||||||
|
// }
|
||||||
border.color: Qt.darker(parent.releasedColor)
|
border.color: Qt.darker(parent.releasedColor)
|
||||||
border.width: parent.focus ? 1 : 0
|
border.width: parent.focus ? 1 : 0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
// Rectangle {
|
||||||
anchors.left: parent.left
|
// anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
// anchors.right: parent.right
|
||||||
height: parent.height - 1
|
// height: parent.height - 1
|
||||||
y: buttonArea.pressed ? 1 : 0
|
// y: buttonArea.pressed ? 1 : 0
|
||||||
color: {
|
// color: {
|
||||||
parent.enabled ? (buttonArea.pressed ? parent.pressedColor : parent.releasedColor)
|
// parent.enabled ? (buttonArea.pressed ? parent.pressedColor : parent.releasedColor)
|
||||||
: Qt.lighter(parent.releasedColor)
|
// : Qt.lighter(parent.releasedColor)
|
||||||
|
|
||||||
}
|
// }
|
||||||
//radius: 4
|
// //radius: 4
|
||||||
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: label
|
id: label
|
||||||
|
@ -87,7 +89,7 @@ Item {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
font.family: "Arial"
|
font.family: Style.fontBold.name
|
||||||
font.bold: true
|
font.bold: true
|
||||||
font.pixelSize: button.fontSize
|
font.pixelSize: button.fontSize
|
||||||
color: parent.textColor
|
color: parent.textColor
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
import "." 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: dropdown
|
id: dropdown
|
||||||
|
@ -175,10 +176,10 @@ Item {
|
||||||
anchors.right: col2Text.left
|
anchors.right: col2Text.left
|
||||||
anchors.leftMargin: 12 * scaleRatio
|
anchors.leftMargin: 12 * scaleRatio
|
||||||
anchors.rightMargin: column2.length > 0 ? 12 * scaleRatio: 0
|
anchors.rightMargin: column2.length > 0 ? 12 * scaleRatio: 0
|
||||||
font.family: "Arial"
|
font.family: Style.fontRegular.name
|
||||||
font.bold: true
|
font.bold: true
|
||||||
font.pixelSize: 12 * scaleRatio
|
font.pixelSize: 14 * scaleRatio
|
||||||
color: "#FFFFFF"
|
color: itemArea.containsMouse || index === column.currentIndex || itemArea.containsMouse ? "#FA6800" : "#FFFFFF"
|
||||||
text: qsTr(column1) + translationManager.emptyString
|
text: qsTr(column1) + translationManager.emptyString
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,8 +188,8 @@ Item {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 45 * scaleRatio
|
anchors.rightMargin: 45 * scaleRatio
|
||||||
font.family: "Arial"
|
font.family: Style.fontRegular.name
|
||||||
font.pixelSize: 12 * scaleRatio
|
font.pixelSize: 14 * scaleRatio
|
||||||
color: "#FFFFFF"
|
color: "#FFFFFF"
|
||||||
text: column2
|
text: column2
|
||||||
}
|
}
|
||||||
|
@ -211,6 +212,8 @@ Item {
|
||||||
id: itemArea
|
id: itemArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
dropdown.expanded = false
|
dropdown.expanded = false
|
||||||
column.currentIndex = index
|
column.currentIndex = index
|
||||||
|
|
Loading…
Reference in a new issue