Use Kirigami header in sidebar
This commit is contained in:
parent
e57fd79f26
commit
3118be5c98
1 changed files with 47 additions and 35 deletions
|
@ -35,43 +35,55 @@ Kirigami.ApplicationWindow
|
|||
modal: !root.wideScreen
|
||||
handleVisible: !root.wideScreen
|
||||
|
||||
header: Kirigami.AbstractApplicationHeader {
|
||||
topPadding: Kirigami.Units.smallSpacing / 2 // HACK: not dividing by two makes the header to big and not adding the spacing make it to small
|
||||
bottomPadding: Kirigami.Units.smallSpacing
|
||||
leftPadding: Kirigami.Units.smallSpacing
|
||||
rightPadding: Kirigami.Units.smallSpacing
|
||||
contentItem: RowLayout {
|
||||
anchors.fill: parent
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
|
||||
DBusProperty {
|
||||
id: announcedNameProperty
|
||||
object: DaemonDbusInterface
|
||||
read: "announcedName"
|
||||
defaultValue: ""
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: nameField
|
||||
visible: false
|
||||
Layout.fillWidth: true
|
||||
text: announcedNameProperty.value
|
||||
onAccepted: {
|
||||
DaemonDbusInterface.setAnnouncedName(text)
|
||||
text = Qt.binding(function() {return announcedNameProperty.value})
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.Heading {
|
||||
level: 2
|
||||
text: announcedNameProperty.value
|
||||
Layout.fillWidth: true
|
||||
visible: !nameField.visible
|
||||
elide: Qt.ElideRight
|
||||
font.pointSize: 18
|
||||
}
|
||||
|
||||
Button {
|
||||
icon.name: nameField.visible ? "dialog-ok-apply" : "entry-edit"
|
||||
onClicked: {
|
||||
nameField.visible = !nameField.visible
|
||||
nameField.accepted()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
topContent: RowLayout {
|
||||
width: parent.width
|
||||
DBusProperty {
|
||||
id: announcedNameProperty
|
||||
object: DaemonDbusInterface
|
||||
read: "announcedName"
|
||||
defaultValue: ""
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: nameField
|
||||
visible: false
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: Kirigami.Units.smallSpacing
|
||||
text: announcedNameProperty.value
|
||||
onAccepted: {
|
||||
DaemonDbusInterface.setAnnouncedName(text)
|
||||
text = Qt.binding(function() {return announcedNameProperty.value})
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: announcedNameProperty.value
|
||||
visible: !nameField.visible
|
||||
Layout.fillWidth: true
|
||||
elide: Qt.ElideRight
|
||||
font.pointSize: 18
|
||||
Layout.leftMargin: Kirigami.Units.smallSpacing
|
||||
}
|
||||
|
||||
Button {
|
||||
icon.name: nameField.visible ? "dialog-ok-apply" : "entry-edit"
|
||||
onClicked: {
|
||||
nameField.visible = !nameField.visible
|
||||
nameField.accepted()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property var objects: [findDevicesAction]
|
||||
|
|
Loading…
Reference in a new issue