Changeset View
Changeset View
Standalone View
Standalone View
kcms/cursortheme/package/contents/ui/Delegate.qml
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | Copyright (c) 2015 Marco Martin <mart@kde.org> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU Library General Public | ||||
6 | License version 2 as published by the Free Software Foundation. | ||||
7 | | ||||
8 | This library is distributed in the hope that it will be useful, | ||||
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
11 | Library General Public License for more details. | ||||
12 | | ||||
13 | You should have received a copy of the GNU Library General Public License | ||||
14 | along with this library; see the file COPYING.LIB. If not, write to | ||||
15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
16 | Boston, MA 02110-1301, USA. | ||||
17 | */ | ||||
18 | | ||||
19 | import QtQuick 2.1 | ||||
20 | import QtQuick.Window 2.2 | ||||
21 | import QtQuick.Layouts 1.1 | ||||
22 | import QtQuick.Controls 2.2 as Controls | ||||
23 | import QtQuick.Templates 2.2 as T2 | ||||
24 | import QtGraphicalEffects 1.0 | ||||
25 | | ||||
26 | import org.kde.kirigami 2.2 as Kirigami | ||||
27 | | ||||
28 | import org.kde.kcm 1.0 | ||||
29 | import org.kde.kcmcontrols 1.0 as KCMControls | ||||
30 | import org.kde.private.kcm_cursortheme 1.0 | ||||
31 | | ||||
32 | KCMControls.GridDelegate { | ||||
33 | id: delegate | ||||
34 | | ||||
35 | text: model.display | ||||
36 | toolTip: model.description | ||||
37 | | ||||
38 | thumbnail: PreviewWidget { | ||||
39 | id: previewWidget | ||||
40 | //for cursor themes we must ignore the native scaling, | ||||
41 | //as they will be rendered by X11/KWin, ignoring whatever Qt | ||||
42 | //scaling | ||||
43 | width: parent.width * Screen.devicePixelRatio | ||||
44 | height: parent.height * Screen.devicePixelRatio | ||||
45 | x: Screen.devicePixelRatio % 1 | ||||
46 | y: Screen.devicePixelRatio % 1 | ||||
47 | transformOrigin: Item.TopLeft | ||||
48 | scale: 1 / Screen.devicePixelRatio | ||||
49 | themeModel: kcm.cursorsModel | ||||
50 | currentIndex: index | ||||
51 | currentSize: parseInt(sizeCombo.currentText) !== NaN ? parseInt(sizeCombo.currentText) : 0 | ||||
52 | } | ||||
53 | | ||||
54 | actions: [ | ||||
55 | Kirigami.Action { | ||||
56 | iconName: "edit-delete" | ||||
57 | tooltip: i18n("Remove Theme") | ||||
58 | enabled: model.isWritable | ||||
59 | onTriggered: kcm.removeTheme(index); | ||||
60 | } | ||||
61 | ] | ||||
62 | | ||||
63 | onClicked: { | ||||
64 | view.currentIndex = index; | ||||
65 | view.forceActiveFocus(); | ||||
66 | } | ||||
67 | } |