FontsTab.qml
changeset 14 9903a5edeb56
parent 13 40da62e57d85
child 15 737f8bb110be
     1.1 --- a/FontsTab.qml	Wed May 28 20:14:23 2014 +0200
     1.2 +++ b/FontsTab.qml	Wed May 28 21:31:03 2014 +0200
     1.3 @@ -5,15 +5,15 @@
     1.4  import Qt.labs.settings 1.0
     1.5  
     1.6  Item {
     1.7 -    width: 640
     1.8 -    height: 480
     1.9 -    //SystemPalette { id: palette }
    1.10      clip: true
    1.11 -
    1.12 -
    1.13 -
    1.14 +    //
    1.15      Settings {
    1.16          property alias font: textFontDemoLowerCase.font;
    1.17 +        property alias checkBoxScalableFonts: checkBoxScalableFonts.checked
    1.18 +        property alias checkBoxNonScalableFonts: checkBoxNonScalableFonts.checked
    1.19 +        property alias checkBoxMonospacedFonts: checkBoxMonospacedFonts.checked
    1.20 +        property alias checkBoxProportionalFonts: checkBoxProportionalFonts.checked
    1.21 +
    1.22      }
    1.23  
    1.24  
    1.25 @@ -22,23 +22,23 @@
    1.26          id: fontDialog
    1.27          visible: false
    1.28          modality: Qt.WindowModal
    1.29 -        scalableFonts: fontDialogScalableFonts.checked
    1.30 -        nonScalableFonts: fontDialogNonScalableFonts.checked
    1.31 -        monospacedFonts: fontDialogMonospacedFonts.checked
    1.32 -        proportionalFonts: fontDialogProportionalFonts.checked
    1.33 +        scalableFonts: checkBoxScalableFonts.checked
    1.34 +        nonScalableFonts: checkBoxNonScalableFonts.checked
    1.35 +        monospacedFonts: checkBoxMonospacedFonts.checked
    1.36 +        proportionalFonts: checkBoxProportionalFonts.checked
    1.37          title: qsTr("Choose a font")
    1.38          font: textFontDemoLowerCase.font
    1.39          currentFont: textFontDemoLowerCase.font
    1.40 -        onCurrentFontChanged: { console.log("CurrentFontChanged: " + currentFont) }
    1.41 -        onFontChanged: { console.log("FontChanged: " + font) }
    1.42 +        //onCurrentFontChanged: { console.log("CurrentFontChanged: " + currentFont) }
    1.43 +        //onFontChanged: { console.log("FontChanged: " + font) }
    1.44          onAccepted: {
    1.45 -            console.log("Accepted: " + font);
    1.46 +            //console.log("Accepted: " + font);
    1.47              textFontDemoLowerCase.font = currentFont;
    1.48              display.font = currentFont;
    1.49              //textFontDemoUpperCase.font = currentFont;
    1.50              //textFontDemoDigits.font = currentFont;
    1.51          }
    1.52 -        onRejected: { console.log("Rejected") }
    1.53 +        //onRejected: { console.log("Rejected") }
    1.54      }
    1.55      //
    1.56      ColumnLayout {
    1.57 @@ -88,24 +88,28 @@
    1.58              columnSpacing: 8
    1.59  
    1.60              CheckBox {
    1.61 -                id: fontDialogScalableFonts
    1.62 +                id: checkBoxScalableFonts
    1.63                  text: "Scalable fonts"
    1.64 -                Binding on checked { value: fontDialog.scalableFonts }
    1.65 +                checked: true
    1.66 +                //Binding on checked { value: fontDialog.scalableFonts }
    1.67              }
    1.68              CheckBox {
    1.69 -                id: fontDialogNonScalableFonts
    1.70 +                id: checkBoxNonScalableFonts
    1.71                  text: "Non scalable fonts"
    1.72 -                Binding on checked { value: fontDialog.nonScalableFonts }
    1.73 +                checked: true
    1.74 +                //Binding on checked { value: fontDialog.nonScalableFonts }
    1.75              }
    1.76              CheckBox {
    1.77 -                id: fontDialogMonospacedFonts
    1.78 +                id: checkBoxMonospacedFonts
    1.79                  text: "Monospaced fonts"
    1.80 -                Binding on checked { value: fontDialog.monospacedFonts }
    1.81 +                checked: true
    1.82 +                //Binding on checked { value: fontDialog.monospacedFonts }
    1.83              }
    1.84              CheckBox {
    1.85 -                id: fontDialogProportionalFonts
    1.86 +                id: checkBoxProportionalFonts
    1.87                  text: "Proportional fonts"
    1.88 -                Binding on checked { value: fontDialog.proportionalFonts }
    1.89 +                checked: true
    1.90 +                //Binding on checked { value: fontDialog.proportionalFonts }
    1.91              }
    1.92          }
    1.93  
    1.94 @@ -113,7 +117,12 @@
    1.95  
    1.96          Button {
    1.97              text: qsTr("Change font")
    1.98 -            onClicked: fontDialog.open()
    1.99 +            onClicked: {
   1.100 +                //We had to do this double magic cause otherwise our font list
   1.101 +                //would not reflect our options.
   1.102 +                fontDialog.setVisible(true);
   1.103 +                fontDialog.open();
   1.104 +            }
   1.105          }
   1.106      } //ColumnLayout
   1.107  } //Item