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 | 21 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
22 | import QtQuick.Layouts 1.1 | | |||
23 | import org.kde.kwin.private.kdecoration 1.0 as KDecoration | 22 | import org.kde.kwin.private.kdecoration 1.0 as KDecoration | ||
24 | import org.kde.plasma.core 2.0 as PlasmaCore; | | |||
25 | 23 | | |||
26 | ListView { | 24 | ListView { | ||
27 | id: view | 25 | id: view | ||
28 | property string key | 26 | property string key | ||
29 | property bool dragging: false | 27 | property bool dragging: false | ||
28 | property int iconSize: units.iconSizes.small | ||||
30 | orientation: ListView.Horizontal | 29 | orientation: ListView.Horizontal | ||
31 | interactive: false | 30 | interactive: false | ||
32 | spacing: units.smallSpacing | 31 | spacing: units.smallSpacing | ||
33 | implicitHeight: units.iconSizes.small | 32 | implicitHeight: iconSize | ||
34 | implicitWidth: count * (units.iconSizes.small + units.smallSpacing) - Math.min(1, count) * units.smallSpacing | 33 | implicitWidth: count * (iconSize + units.smallSpacing) - Math.min(1, count) * units.smallSpacing | ||
35 | delegate: Item { | 34 | delegate: Item { | ||
36 | width: units.iconSizes.small | 35 | width: iconSize | ||
37 | height: units.iconSizes.small | 36 | height: iconSize | ||
38 | KDecoration.Button { | 37 | KDecoration.Button { | ||
39 | id: button | 38 | id: button | ||
40 | property int itemIndex: index | 39 | property int itemIndex: index | ||
41 | property var buttonsModel: parent.ListView.view.model | 40 | property var buttonsModel: parent.ListView.view.model | ||
42 | bridge: bridgeItem.bridge | 41 | bridge: bridgeItem.bridge | ||
43 | settings: settingsItem | 42 | settings: settingsItem | ||
44 | type: model["button"] | 43 | type: model["button"] | ||
44 | width: iconSize | ||||
45 | height: iconSize | ||||
45 | anchors.fill: Drag.active ? undefined : parent | 46 | anchors.fill: Drag.active ? undefined : parent | ||
46 | Drag.keys: [ "decoButtonRemove", view.key ] | 47 | Drag.keys: [ "decoButtonRemove", view.key ] | ||
47 | Drag.active: dragArea.drag.active | 48 | Drag.active: dragArea.drag.active | ||
48 | Drag.onActiveChanged: view.dragging = Drag.active | 49 | Drag.onActiveChanged: view.dragging = Drag.active | ||
49 | } | 50 | } | ||
50 | MouseArea { | 51 | MouseArea { | ||
51 | id: dragArea | 52 | id: dragArea | ||
52 | cursorShape: Qt.SizeAllCursor | 53 | cursorShape: Qt.SizeAllCursor | ||
Show All 23 Lines |