Fixing qml warnings.
authorsl
Wed, 28 May 2014 20:14:23 +0200
changeset 1340da62e57d85
parent 12 f0c61338a2e8
child 14 9903a5edeb56
Fixing qml warnings.
DisplayTab.qml
FontsTab.qml
     1.1 --- a/DisplayTab.qml	Wed May 28 19:31:55 2014 +0200
     1.2 +++ b/DisplayTab.qml	Wed May 28 20:14:23 2014 +0200
     1.3 @@ -15,14 +15,13 @@
     1.4      Component.onCompleted: {
     1.5          display.closing.connect(onDisplayClosing);
     1.6          display.opened.connect(onDisplayOpened);
     1.7 +        appWindow.closing.connect(onWindowClosing);
     1.8          if(checkBoxConnectOnStartUp.checked) display.open()
     1.9      }
    1.10  
    1.11      //We need to disconnect our signals to avoid receiving stray events
    1.12      Component.onDestruction: {
    1.13 -        display.closed.disconnect(onDisplayClosing);
    1.14 -        display.opened.disconnect(onDisplayOpened);
    1.15 -        onDisplayClosing();
    1.16 +        disconnectDisplaySignals()
    1.17      }
    1.18      //
    1.19      Settings {
    1.20 @@ -32,31 +31,44 @@
    1.21          property alias brightness: sliderBrightness.value;
    1.22      }
    1.23  
    1.24 +    function disconnectDisplaySignals()
    1.25 +    {
    1.26 +        display.closed.disconnect(onDisplayClosing);
    1.27 +        display.opened.disconnect(onDisplayOpened);
    1.28 +    }
    1.29 +
    1.30 +    //Clear both front and back buffers
    1.31 +    function clearBuffers()
    1.32 +    {
    1.33 +        display.clear();
    1.34 +        display.swapBuffers();
    1.35 +        display.clear();
    1.36 +        display.swapBuffers();
    1.37 +    }
    1.38 +
    1.39 +    function onWindowClosing()
    1.40 +    {
    1.41 +        //Clear both our frames
    1.42 +        onDisplayClosing();
    1.43 +        disconnectDisplaySignals();
    1.44 +    }
    1.45 +
    1.46      function onDisplayClosing()
    1.47      {
    1.48 -        //Clear both our frames
    1.49 -        if (checkBoxClearWhenDisconnecting.checked)
    1.50 +        if (checkBoxClearWhenDisconnecting != null && checkBoxClearWhenDisconnecting.checked)
    1.51          {
    1.52 -            display.clear();
    1.53 -            display.swapBuffers();
    1.54 -            display.clear();
    1.55 -            display.swapBuffers();
    1.56 +            clearBuffers();
    1.57          }
    1.58      }
    1.59  
    1.60      function onDisplayOpened()
    1.61      {
    1.62 -        //Clear both our frames
    1.63          if (checkBoxClearWhenConnecting.checked)
    1.64          {
    1.65 -            display.clear();
    1.66 -            display.swapBuffers();
    1.67 -            display.clear();
    1.68 -            display.swapBuffers();
    1.69 +            clearBuffers();
    1.70          }
    1.71      }
    1.72  
    1.73 -
    1.74      //
    1.75  
    1.76      Column {
     2.1 --- a/FontsTab.qml	Wed May 28 19:31:55 2014 +0200
     2.2 +++ b/FontsTab.qml	Wed May 28 20:14:23 2014 +0200
     2.3 @@ -46,7 +46,7 @@
     2.4          anchors.margins: 8
     2.5          spacing: 8
     2.6  
     2.7 -        Text {
     2.8 +        Label {
     2.9              id: fontLabel
    2.10              text: "Current font: <b>" + textFontDemoLowerCase.font.family + " - " + textFontDemoLowerCase.font.pointSize +"</b>"
    2.11              MouseArea {
    2.12 @@ -59,21 +59,21 @@
    2.13              anchors.margins: 0
    2.14              spacing: 0
    2.15  
    2.16 -            Text {
    2.17 +            Label {
    2.18                  id: textFontDemoLowerCase
    2.19                  anchors.margins: 0
    2.20                  text: "abcdefghijklmnopqrstyvwxyz"
    2.21                  font: Qt.font({ family: "Arial", pointSize: 16, weight: Font.Normal })
    2.22              }
    2.23  
    2.24 -            Text {
    2.25 +            Label {
    2.26                  id: textFontDemoUpperCase
    2.27                  anchors.margins: 0
    2.28                  text: "ABCDEFGHIJKLMNOPQRSTYVWXYZ"
    2.29                  font: textFontDemoLowerCase.font
    2.30              }
    2.31  
    2.32 -            Text {
    2.33 +            Label {
    2.34                  id: textFontDemoDigits
    2.35                  anchors.margins: 0
    2.36                  text: "0123456789"