Working around our font dialog option listing issues.
Font dialog options are now persisted.
Fixing issue with italic font being cut by using proper string width from boundigRect.
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
11 property alias font: textFontDemoLowerCase.font;
12 property alias checkBoxScalableFonts: checkBoxScalableFonts.checked
13 property alias checkBoxNonScalableFonts: checkBoxNonScalableFonts.checked
14 property alias checkBoxMonospacedFonts: checkBoxMonospacedFonts.checked
15 property alias checkBoxProportionalFonts: checkBoxProportionalFonts.checked
24 modality: Qt.WindowModal
25 scalableFonts: checkBoxScalableFonts.checked
26 nonScalableFonts: checkBoxNonScalableFonts.checked
27 monospacedFonts: checkBoxMonospacedFonts.checked
28 proportionalFonts: checkBoxProportionalFonts.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 display.font = currentFont;
38 //textFontDemoUpperCase.font = currentFont;
39 //textFontDemoDigits.font = currentFont;
41 //onRejected: { console.log("Rejected") }
51 text: "Current font: <b>" + textFontDemoLowerCase.font.family + " - " + textFontDemoLowerCase.font.pointSize +"</b>"
54 onClicked: fontDialog.open()
63 id: textFontDemoLowerCase
65 text: "abcdefghijklmnopqrstyvwxyz"
66 font: Qt.font({ family: "Arial", pointSize: 16, weight: Font.Normal })
70 id: textFontDemoUpperCase
72 text: "ABCDEFGHIJKLMNOPQRSTYVWXYZ"
73 font: textFontDemoLowerCase.font
77 id: textFontDemoDigits
80 font: textFontDemoLowerCase.font
84 //Font selection options
91 id: checkBoxScalableFonts
92 text: "Scalable fonts"
94 //Binding on checked { value: fontDialog.scalableFonts }
97 id: checkBoxNonScalableFonts
98 text: "Non scalable fonts"
100 //Binding on checked { value: fontDialog.nonScalableFonts }
103 id: checkBoxMonospacedFonts
104 text: "Monospaced fonts"
106 //Binding on checked { value: fontDialog.monospacedFonts }
109 id: checkBoxProportionalFonts
110 text: "Proportional fonts"
112 //Binding on checked { value: fontDialog.proportionalFonts }
119 text: qsTr("Change font")
121 //We had to do this double magic cause otherwise our font list
122 //would not reflect our options.
123 fontDialog.setVisible(true);