sl@0: import QtQuick 2.2 sl@0: import QtQuick.Controls 1.2 sl@0: import QtQuick.Dialogs 1.1 sl@1: import QtQuick.Layouts 1.1 sl@1: import Qt.labs.settings 1.0 sl@0: sl@0: Item { sl@0: width: 640 sl@0: height: 480 sl@0: //SystemPalette { id: palette } sl@0: clip: true sl@0: sl@0: sl@1: sl@1: Settings { sl@1: property alias font: textFontDemoLowerCase.font; sl@1: } sl@1: sl@1: sl@0: // sl@0: FontDialog { sl@0: id: fontDialog sl@0: visible: false sl@0: modality: Qt.WindowModal sl@0: scalableFonts: fontDialogScalableFonts.checked sl@0: nonScalableFonts: fontDialogNonScalableFonts.checked sl@0: monospacedFonts: fontDialogMonospacedFonts.checked sl@0: proportionalFonts: fontDialogProportionalFonts.checked sl@0: title: qsTr("Choose a font") sl@1: font: textFontDemoLowerCase.font sl@1: currentFont: textFontDemoLowerCase.font sl@0: onCurrentFontChanged: { console.log("CurrentFontChanged: " + currentFont) } sl@1: onFontChanged: { console.log("FontChanged: " + font) } sl@1: onAccepted: { sl@1: console.log("Accepted: " + font); sl@1: textFontDemoLowerCase.font = currentFont; sl@1: //textFontDemoUpperCase.font = currentFont; sl@1: //textFontDemoDigits.font = currentFont; sl@1: } sl@0: onRejected: { console.log("Rejected") } sl@0: } sl@0: // sl@1: ColumnLayout { sl@0: anchors.fill: parent sl@1: anchors.margins: 8 sl@1: spacing: 8 sl@0: sl@0: Text { sl@0: id: fontLabel sl@1: text: "Current font: " + textFontDemoLowerCase.font.family + " - " + textFontDemoLowerCase.font.pointSize +"" sl@0: MouseArea { sl@0: anchors.fill: parent sl@0: onClicked: fontDialog.open() sl@0: } sl@0: } sl@0: sl@1: ColumnLayout { sl@1: anchors.margins: 0 sl@1: spacing: 0 sl@1: sl@1: Text { sl@1: id: textFontDemoLowerCase sl@1: anchors.margins: 0 sl@1: text: "abcdefghijklmnopqrstyvwxyz" sl@1: font: Qt.font({ family: "Arial", pointSize: 16, weight: Font.Normal }) sl@1: } sl@1: sl@1: Text { sl@1: id: textFontDemoUpperCase sl@1: anchors.margins: 0 sl@1: text: "ABCDEFGHIJKLMNOPQRSTYVWXYZ" sl@1: font: textFontDemoLowerCase.font sl@1: } sl@1: sl@1: Text { sl@1: id: textFontDemoDigits sl@1: anchors.margins: 0 sl@1: text: "0123456789" sl@1: font: textFontDemoLowerCase.font sl@1: } sl@0: } sl@0: sl@1: //Font selection options sl@1: GridLayout { sl@1: anchors.margins: 8 sl@1: columns: 2 sl@1: columnSpacing: 8 sl@1: sl@1: CheckBox { sl@1: id: fontDialogScalableFonts sl@1: text: "Scalable fonts" sl@1: Binding on checked { value: fontDialog.scalableFonts } sl@1: } sl@1: CheckBox { sl@1: id: fontDialogNonScalableFonts sl@1: text: "Non scalable fonts" sl@1: Binding on checked { value: fontDialog.nonScalableFonts } sl@1: } sl@1: CheckBox { sl@1: id: fontDialogMonospacedFonts sl@1: text: "Monospaced fonts" sl@1: Binding on checked { value: fontDialog.monospacedFonts } sl@1: } sl@1: CheckBox { sl@1: id: fontDialogProportionalFonts sl@1: text: "Proportional fonts" sl@1: Binding on checked { value: fontDialog.proportionalFonts } sl@1: } sl@0: } sl@0: sl@0: sl@0: sl@0: Button { sl@1: text: qsTr("Change font") sl@0: onClicked: fontDialog.open() sl@0: } sl@1: } //ColumnLayout sl@1: } //Item