Skip to content

Instantly share code, notes, and snippets.

@Zren
Last active October 14, 2018 04:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zren/40f657da96e4d8a29b13d74b74e956c5 to your computer and use it in GitHub Desktop.
Save Zren/40f657da96e4d8a29b13d74b74e956c5 to your computer and use it in GitHub Desktop.

Test with: qmlscene KDecorationButtonTest1.qml

import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.kwin.private.kdecoration 1.0 as KDecoration
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
Item {
id: main
width: 400
height: 400
KDecoration.Bridge {
id: bridgeItem
plugin: "org.kde.breezeenhanced"
theme: ""
}
KDecoration.Settings {
id: settingsItem
bridge: bridgeItem.bridge
borderSizesIndex: 3 // Normal
}
Item {
id: test1
anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right
anchors.margins: units.smallSpacing
height: units.iconSizes.medium
Rectangle {
anchors.fill: buttonPreviewRow
color: theme.backgroundColor
}
RowLayout {
id: buttonPreviewRow
anchors.fill: parent
Repeater {
// https://github.com/KDE/kdecoration/blob/master/src/decorationdefines.h#L33
model: [
5, // Close
4, // Maximize
3, // Minimize
]
KDecoration.Button {
id: button
Layout.fillHeight: true
Layout.preferredWidth: height
bridge: bridgeItem.bridge
settings: settingsItem
type: modelData
}
}
Item { Layout.fillWidth: true }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment