Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwindecoration/package/contents/ui/ButtonGroup.qml
- This file was moved from kcmkwin/kwindecoration/qml/ButtonGroup.qml.
Show All 11 Lines | |||||
12 | * This program is distributed in the hope that it will be useful, | 12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. | ||
16 | * | 16 | * | ||
17 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | import QtQuick 2.1 | 20 | import QtQuick 2.7 | ||
21 | import QtQuick.Controls 1.2 | | |||
22 | import QtQuick.Layouts 1.1 | | |||
23 | import org.kde.kwin.private.kdecoration 1.0 as KDecoration | 21 | import org.kde.kwin.private.kdecoration 1.0 as KDecoration | ||
24 | import org.kde.plasma.core 2.0 as PlasmaCore; | | |||
25 | 22 | | |||
26 | ListView { | 23 | ListView { | ||
27 | id: view | 24 | id: view | ||
28 | property string key | 25 | property string key | ||
29 | property bool dragging: false | 26 | property bool dragging: false | ||
27 | property int iconSize: units.iconSizes.small | ||||
30 | orientation: ListView.Horizontal | 28 | orientation: ListView.Horizontal | ||
31 | interactive: false | 29 | interactive: false | ||
32 | spacing: units.smallSpacing | 30 | spacing: units.smallSpacing | ||
33 | implicitHeight: units.iconSizes.small | 31 | implicitHeight: iconSize | ||
34 | implicitWidth: count * (units.iconSizes.small + units.smallSpacing) - Math.min(1, count) * units.smallSpacing | 32 | implicitWidth: count * (iconSize + units.smallSpacing) - Math.min(1, count) * units.smallSpacing | ||
35 | delegate: Item { | 33 | delegate: Item { | ||
36 | width: units.iconSizes.small | 34 | width: iconSize | ||
37 | height: units.iconSizes.small | 35 | height: iconSize | ||
38 | KDecoration.Button { | 36 | KDecoration.Button { | ||
39 | id: button | 37 | id: button | ||
40 | property int itemIndex: index | 38 | property int itemIndex: index | ||
41 | property var buttonsModel: parent.ListView.view.model | 39 | property var buttonsModel: parent.ListView.view.model | ||
42 | bridge: bridgeItem.bridge | 40 | bridge: bridgeItem.bridge | ||
43 | settings: settingsItem | 41 | settings: settingsItem | ||
44 | type: model["button"] | 42 | type: model["button"] | ||
43 | width: iconSize | ||||
44 | height: iconSize | ||||
45 | anchors.fill: Drag.active ? undefined : parent | 45 | anchors.fill: Drag.active ? undefined : parent | ||
46 | Drag.keys: [ "decoButtonRemove", view.key ] | 46 | Drag.keys: [ "decoButtonRemove", view.key ] | ||
47 | Drag.active: dragArea.drag.active | 47 | Drag.active: dragArea.drag.active | ||
48 | Drag.onActiveChanged: view.dragging = Drag.active | 48 | Drag.onActiveChanged: view.dragging = Drag.active | ||
49 | color: palette.windowText | ||||
49 | } | 50 | } | ||
50 | MouseArea { | 51 | MouseArea { | ||
51 | id: dragArea | 52 | id: dragArea | ||
52 | cursorShape: Qt.SizeAllCursor | 53 | cursorShape: Qt.SizeAllCursor | ||
53 | anchors.fill: parent | 54 | anchors.fill: parent | ||
54 | drag.target: button | 55 | drag.target: button | ||
55 | onReleased: { | 56 | onReleased: { | ||
56 | if (drag.target.Drag.target) { | 57 | if (drag.target.Drag.target) { | ||
Show All 19 Lines |