title: autoresize text in qml
body: <p>In the process of studying QML and QtQuick, the following question arose. How can I make the text automatically reduce the font size by decreasing the element in which it is located. 
  Now I have this method </p>
  
  <pre><code>Rectangle {
  id: main_window
  width: 700
  height: 500
  
  property int main_w: main_window.width
  
  Rectangle {
      width: 400
      height: 400
      anchors.centerIn: parent
      color: 'green'
  
      Text {
          text: "SIZE ME!!!"
          anchors.centerIn: parent
          color: 'white'
          font.pointSize: {
              if (main_window.main_w &lt; main_window.width)
                  return main_window.main_w / 35 // we need 20pt
              return main_window.width / 35
          }
          visible: {
              if (parent.width &lt; 100)
                  return false
              return true
          }
      }
  }
  </code></pre>
  
  <p>It works, but not too elegantly. Maybe there are some methods that the text automatically resized. If the wrap in the <code>ColumnLayout</code> does not work. </p>
  
  <p>Please help. Thank you</p>
  
  <p>Here my code with <code>fontSizeMode</code> trying:</p>
  
  <pre><code>Rectangle {
  id: root
  width: 700
  height: 700
  property int mrg: 10   
  
  Rectangle {
      anchors.centerIn: parent
      width: 400
      height: 400
      color: 'green'
  
      Text {
          id: field
          text: "Size me!"
          minimumPointSize: 10
          font.pointSize: 60
          fontSizeMode: Text.Fit
          color: 'white'
          anchors.centerIn: parent
      }
  }
  }
  </code></pre>