FontsTab.qml
changeset 0 c0e13d2503b9
child 1 bc046f5187fd
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/FontsTab.qml	Tue May 27 12:00:47 2014 +0200
     1.3 @@ -0,0 +1,96 @@
     1.4 +import QtQuick 2.2
     1.5 +import QtQuick.Controls 1.2
     1.6 +import QtQuick.Dialogs 1.1
     1.7 +
     1.8 +Item {
     1.9 +    width: 640
    1.10 +    height: 480
    1.11 +    //SystemPalette { id: palette }
    1.12 +    clip: true
    1.13 +
    1.14 +
    1.15 +    //
    1.16 +    FontDialog {
    1.17 +        id: fontDialog
    1.18 +        visible: false
    1.19 +        modality: Qt.WindowModal
    1.20 +        scalableFonts: fontDialogScalableFonts.checked
    1.21 +        nonScalableFonts: fontDialogNonScalableFonts.checked
    1.22 +        monospacedFonts: fontDialogMonospacedFonts.checked
    1.23 +        proportionalFonts: fontDialogProportionalFonts.checked
    1.24 +        title: qsTr("Choose a font")
    1.25 +        font: Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal })
    1.26 +        currentFont: Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal })
    1.27 +        onCurrentFontChanged: { console.log("CurrentFontChanged: " + currentFont) }
    1.28 +        onAccepted: { console.log("Accepted: " + font) }
    1.29 +        onRejected: { console.log("Rejected") }
    1.30 +    }
    1.31 +    //
    1.32 +
    1.33 +    Flow {
    1.34 +        anchors.fill: parent
    1.35 +        anchors.margins: 12
    1.36 +        spacing: 10
    1.37 +
    1.38 +        CheckBox {
    1.39 +            id: fontDialogScalableFonts
    1.40 +            text: "Scalable fonts"
    1.41 +            Binding on checked { value: fontDialog.scalableFonts }
    1.42 +        }
    1.43 +        CheckBox {
    1.44 +            id: fontDialogNonScalableFonts
    1.45 +            text: "Non scalable fonts"
    1.46 +            Binding on checked { value: fontDialog.nonScalableFonts }
    1.47 +        }
    1.48 +        CheckBox {
    1.49 +            id: fontDialogMonospacedFonts
    1.50 +            text: "Monospaced fonts"
    1.51 +            Binding on checked { value: fontDialog.monospacedFonts }
    1.52 +        }
    1.53 +        CheckBox {
    1.54 +            id: fontDialogProportionalFonts
    1.55 +            text: "Proportional fonts"
    1.56 +            Binding on checked { value: fontDialog.proportionalFonts }
    1.57 +        }
    1.58 +
    1.59 +        Text {
    1.60 +            text: "Current font:"
    1.61 +        }
    1.62 +
    1.63 +        Text {
    1.64 +            id: fontLabel
    1.65 +            color: palette.windowText
    1.66 +            text: "<b>" + fontDialog.font.family + " - " + fontDialog.font.pointSize + "</b>"
    1.67 +            MouseArea {
    1.68 +                anchors.fill: parent
    1.69 +                onClicked: fontDialog.open()
    1.70 +            }
    1.71 +        }
    1.72 +
    1.73 +        Text {
    1.74 +            id: textFontDemoLowerCase
    1.75 +            text: "abcdefghijklmnopqrstyvwxyz"
    1.76 +            font: fontDialog.font
    1.77 +        }
    1.78 +
    1.79 +        Text {
    1.80 +            id: textFontDemoUpperCase
    1.81 +            text: "ABCDEFGHIJKLMNOPQRSTYVWXYZ"
    1.82 +            font: fontDialog.font
    1.83 +        }
    1.84 +
    1.85 +        Text {
    1.86 +            id: textFontDemoDigits
    1.87 +            text: "0123456789"
    1.88 +            font: fontDialog.font
    1.89 +        }
    1.90 +
    1.91 +
    1.92 +        Button {
    1.93 +            text: qsTr("Select Font")
    1.94 +            onClicked: fontDialog.open()
    1.95 +        }
    1.96 +
    1.97 +
    1.98 +    }
    1.99 +}