Use PlasmaComponents.Menu instead of ugly default QCC1 Menu
This commit is contained in:
parent
356a4d7304
commit
fca8ccad4d
|
@ -388,35 +388,38 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TinyButton {
|
TinyButton {
|
||||||
|
id: connectionsButton
|
||||||
text: plasmoid.nativeInterface.currentConnectionConfigName
|
text: plasmoid.nativeInterface.currentConnectionConfigName
|
||||||
icon: "network-connect"
|
icon: "network-connect"
|
||||||
paddingEnabled: true
|
paddingEnabled: true
|
||||||
// FIXME: figure out why menu doesn't work in plasmoidviewer using NVIDIA driver
|
onClicked: (connectionConfigsMenu.opened
|
||||||
// (works with plasmawindowed and plasmashell or always when using Intel graphics)
|
= !connectionConfigsMenu.opened) ? connectionConfigsMenu.open(
|
||||||
menu: Menu {
|
x,
|
||||||
id: connectionConfigsMenu
|
y + height) : connectionConfigsMenu.close()
|
||||||
|
Shortcut {
|
||||||
ExclusiveGroup {
|
sequence: "Ctrl+Shift+C"
|
||||||
id: connectionConfigsExclusiveGroup
|
onActivated: connectionsButton.clicked()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Instantiator {
|
PlasmaComponents.Menu {
|
||||||
model: plasmoid.nativeInterface.connectionConfigNames
|
id: connectionConfigsMenu
|
||||||
|
property bool opened: false
|
||||||
MenuItem {
|
}
|
||||||
text: model.modelData
|
Instantiator {
|
||||||
checkable: true
|
model: plasmoid.nativeInterface.connectionConfigNames
|
||||||
checked: plasmoid.nativeInterface.currentConnectionConfigIndex === index
|
PlasmaComponents.MenuItem {
|
||||||
exclusiveGroup: connectionConfigsExclusiveGroup
|
text: model.modelData
|
||||||
onTriggered: {
|
checkable: true
|
||||||
plasmoid.nativeInterface.currentConnectionConfigIndex = index
|
checked: plasmoid.nativeInterface.currentConnectionConfigIndex === index
|
||||||
}
|
onClicked: {
|
||||||
}
|
plasmoid.nativeInterface.currentConnectionConfigIndex = index
|
||||||
onObjectAdded: connectionConfigsMenu.insertItem(index,
|
connectionConfigsMenu.close()
|
||||||
object)
|
connectionConfigsMenu.opened = false
|
||||||
onObjectRemoved: connectionConfigsMenu.removeItem(object)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onObjectAdded: connectionConfigsMenu.addMenuItem(
|
||||||
|
object, connectionConfigsMenu.content[index])
|
||||||
|
onObjectRemoved: connectionConfigsMenu.removeItem(object)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue