mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-01 17:27:53 +00:00
wip select input
This commit is contained in:
parent
bf5f0b6dda
commit
68689147d6
@ -35,6 +35,7 @@ ModalPopup {
|
|||||||
anchors.top: accountNameInput.bottom
|
anchors.top: accountNameInput.bottom
|
||||||
anchors.topMargin: marginBetweenInputs
|
anchors.topMargin: marginBetweenInputs
|
||||||
label: qsTr("Account color")
|
label: qsTr("Account color")
|
||||||
|
isSelect: true
|
||||||
}
|
}
|
||||||
|
|
||||||
footer: StyledButton {
|
footer: StyledButton {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
|
import QtGraphicalEffects 1.12
|
||||||
import "../imports"
|
import "../imports"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -11,6 +12,7 @@ Item {
|
|||||||
|
|
||||||
// property string label: "My Label"
|
// property string label: "My Label"
|
||||||
// property url icon: "../app/img/hash.svg"
|
// property url icon: "../app/img/hash.svg"
|
||||||
|
property bool isSelect: false
|
||||||
property url icon: ""
|
property url icon: ""
|
||||||
readonly property bool hasIcon: icon.toString() !== ""
|
readonly property bool hasIcon: icon.toString() !== ""
|
||||||
readonly property bool hasLabel: label !== ""
|
readonly property bool hasLabel: label !== ""
|
||||||
@ -48,6 +50,7 @@ Item {
|
|||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: inputValue
|
id: inputValue
|
||||||
|
visible: !isSelect
|
||||||
placeholderText: inputBox.placeholderText
|
placeholderText: inputBox.placeholderText
|
||||||
text: inputBox.text
|
text: inputBox.text
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@ -59,6 +62,58 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
id: selectMenu
|
||||||
|
width: parent.width
|
||||||
|
padding: 10
|
||||||
|
background: Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
|
color: Theme.grey
|
||||||
|
radius: Theme.radius
|
||||||
|
}
|
||||||
|
property var elements: [
|
||||||
|
{
|
||||||
|
text: "Element 1",
|
||||||
|
onTriggered: function () {
|
||||||
|
console.log("Allo 1")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "Element 2",
|
||||||
|
onTriggered: function () {
|
||||||
|
console.log("Allo 2")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
Component.onCompleted: {
|
||||||
|
elements.forEach(element => {
|
||||||
|
addItem(menuItem.createObject(selectMenu, element))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: menuItem
|
||||||
|
MenuItem {
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.left: parent.left
|
||||||
|
background: Rectangle {
|
||||||
|
color: Theme.white
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MenuItem {
|
||||||
|
// text: "New..."
|
||||||
|
// anchors.right: parent.right
|
||||||
|
// anchors.left: parent.left
|
||||||
|
//// onTriggered: document.reset()
|
||||||
|
// background: Rectangle {
|
||||||
|
// color: Theme.white
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: iconImg
|
id: iconImg
|
||||||
sourceSize.height: 24
|
sourceSize.height: 24
|
||||||
@ -75,7 +130,7 @@ Item {
|
|||||||
id: mouseArea
|
id: mouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
inputValue.forceActiveFocus(Qt.MouseFocusReason)
|
isSelect ? selectMenu.open() : inputValue.forceActiveFocus(Qt.MouseFocusReason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user