Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-42401

QML 5.4 ListView headerpositioning footerpositioning, FontMetrics TextMetrics feature missing

    XMLWordPrintable

Details

    Description

      Despite the documentation is mentioning the following features in 5.4,
      headerpositioning footerpositioning FontMetrics TextMetrics, none of them is working with 5.4beta.

      http://qt-project.org/wiki/New-Features-in-Qt-5.4
      http://doc-snapshot.qt-project.org/qt5-5.4/qml-qtquick-listview.html

      import QtQuick 2.3
      import QtQuick.Controls 1.2
      import QtQuick.Window 2.2
      
      ApplicationWindow {
          title: qsTr("ListView")
          width: 240
          height: 320
      
          ListModel {
              id:lmodel
              ListElement {
                  name: "Bill Smith"
                  number: "555 3264"
              }
              ListElement {
                  name: "John Brown"
                  number: "555 8426"
              }
              ListElement {
                  name: "Sam Wise"
                  number: "555 0473"
              }
          }
      
          Component {
              id: contactDelegate
              Item {
                  width: 180; height: 40
                  Column {
                      Text { text: '<b>Name:</b> ' + name }
                      Text { text: '<b>Number:</b> ' + number }
                  }
              }
          }
      
          ListView {
              anchors.fill: parent
              model: lmodel
              delegate: contactDelegate
              highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
              focus: true
              header: Rectangle{
                  color:"orange"
                  width: 180; height: 40
                  Text { text: '<b>Header:</b> ' }
              }
              headerPositioning: ListView.OverlayHeader;
              footer: Rectangle{
                  color:"orange"
                  width: 180; height: 40
                  Text { text: '<b>Footer:</b> ' }
              }
              footerPositioning: ListView.OverlayHeader;
          }
          FontMetrics {
              id: fontMetrics
              font.family: "Arial"
          }
      
          Rectangle {
              width: fontMetrics.height * 4
              height: fontMetrics.height * 2
              color: "red"
          }
      
          TextMetrics {
              id: textMetrics
              font.family: "Arial"
              elide: Text.ElideMiddle
              elideWidth: 100
              text: "Hello World"
          }
      
          Text {
              text: textMetrics.elidedText
          }
      }
      

      Starting /work1/Qt/bin/Qt5.4-beta/5.4/gcc_64/bin/qmlscene...
      file:///home/kapinter/Documents/New5.4Training/ListViewHeaderFooter/ListViewHeaderFooter.qml:172 FontMetrics is not a type

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              aalpert Alan Alpert
              qtcomsupport Qt Support
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes