Selected font is now persisting.
2 import QtQuick.Controls 1.2
3 import QtQuick.Dialogs 1.1
4 import QtQuick.Layouts 1.1
5 import Qt.labs.settings 1.0
10 //SystemPalette { id: palette }
16 property alias font: textFontDemoLowerCase.font;
24 modality: Qt.WindowModal
25 scalableFonts: fontDialogScalableFonts.checked
26 nonScalableFonts: fontDialogNonScalableFonts.checked
27 monospacedFonts: fontDialogMonospacedFonts.checked
28 proportionalFonts: fontDialogProportionalFonts.checked
29 title: qsTr("Choose a font")
30 font: textFontDemoLowerCase.font
31 currentFont: textFontDemoLowerCase.font
32 onCurrentFontChanged: { console.log("CurrentFontChanged: " + currentFont) }
33 onFontChanged: { console.log("FontChanged: " + font) }
35 console.log("Accepted: " + font);
36 textFontDemoLowerCase.font = currentFont;
37 //textFontDemoUpperCase.font = currentFont;
38 //textFontDemoDigits.font = currentFont;
40 onRejected: { console.log("Rejected") }
50 text: "Current font: <b>" + textFontDemoLowerCase.font.family + " - " + textFontDemoLowerCase.font.pointSize +"</b>"
53 onClicked: fontDialog.open()
62 id: textFontDemoLowerCase
64 text: "abcdefghijklmnopqrstyvwxyz"
65 font: Qt.font({ family: "Arial", pointSize: 16, weight: Font.Normal })
69 id: textFontDemoUpperCase
71 text: "ABCDEFGHIJKLMNOPQRSTYVWXYZ"
72 font: textFontDemoLowerCase.font
76 id: textFontDemoDigits
79 font: textFontDemoLowerCase.font
83 //Font selection options
90 id: fontDialogScalableFonts
91 text: "Scalable fonts"
92 Binding on checked { value: fontDialog.scalableFonts }
95 id: fontDialogNonScalableFonts
96 text: "Non scalable fonts"
97 Binding on checked { value: fontDialog.nonScalableFonts }
100 id: fontDialogMonospacedFonts
101 text: "Monospaced fonts"
102 Binding on checked { value: fontDialog.monospacedFonts }
105 id: fontDialogProportionalFonts
106 text: "Proportional fonts"
107 Binding on checked { value: fontDialog.proportionalFonts }
114 text: qsTr("Change font")
115 onClicked: fontDialog.open()