Changeset View
Changeset View
Standalone View
Standalone View
kcms/fonts/package/contents/ui/FontWidget.qml
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | Copyright (c) 2015 Antonis Tsiapaliokas <antonis.tsiapaliokas@kde.org> | ||||
3 | Copyright (c) 2017 Marco Martin <mart@kde.org> | ||||
4 | | ||||
5 | This library is free software; you can redistribute it and/or | ||||
6 | modify it under the terms of the GNU Library General Public | ||||
7 | License version 2 as published by the Free Software Foundation. | ||||
8 | | ||||
9 | This library is distributed in the hope that it will be useful, | ||||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
12 | Library General Public License for more details. | ||||
13 | | ||||
14 | You should have received a copy of the GNU Library General Public License | ||||
15 | along with this library; see the file COPYING.LIB. If not, write to | ||||
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
17 | Boston, MA 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | import QtQuick 2.1 | ||||
21 | import QtQuick.Layouts 1.1 | ||||
22 | import QtQuick.Controls 2.0 as QtControls | ||||
23 | import QtQuick.Dialogs 1.2 as QtDialogs | ||||
24 | import org.kde.kirigami 2.3 as Kirigami | ||||
25 | import org.kde.kcm 1.0 | ||||
26 | | ||||
27 | | ||||
28 | FocusScope { | ||||
29 | id: root | ||||
30 | property string label | ||||
31 | property string category | ||||
32 | property font font | ||||
33 | Kirigami.FormData.label: root.label | ||||
34 | activeFocusOnTab: true | ||||
35 | | ||||
36 | Layout.minimumWidth: layout.Layout.minimumWidth | ||||
37 | Layout.preferredWidth: layout.Layout.preferredWidth | ||||
38 | Layout.minimumHeight: layout.Layout.minimumHeight | ||||
39 | Layout.preferredHeight: layout.Layout.preferredHeight | ||||
40 | implicitWidth: layout.implicitWidth | ||||
41 | implicitHeight: layout.implicitHeight | ||||
42 | | ||||
43 | RowLayout { | ||||
44 | id: layout | ||||
45 | | ||||
46 | QtControls.TextField { | ||||
47 | enabled: false | ||||
48 | text: root.font.family + " " + root.font.pointSize | ||||
49 | font: root.font | ||||
50 | Layout.fillHeight: true | ||||
51 | } | ||||
52 | | ||||
53 | QtControls.Button { | ||||
54 | text: i18n("Choose...") | ||||
55 | Layout.fillHeight: true | ||||
56 | Kirigami.MnemonicData.enabled: false | ||||
57 | focus: true | ||||
58 | onClicked: { | ||||
59 | fontDialog.adjustAllFonts = false; | ||||
60 | fontDialog.currentCategory = root.category | ||||
61 | fontDialog.font = root.font; | ||||
62 | fontDialog.currentFont = root.font; | ||||
63 | fontDialog.open() | ||||
64 | } | ||||
65 | } | ||||
66 | } | ||||
67 | } | ||||
68 | |