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

Can't use ListView.view with VisualItemModel

    XMLWordPrintable

Details

    Description

      import Qt 4.7
      
      Item {
        width : 400
        height : 400
      
        VisualItemModel {
          id : slideModel
          Rectangle {
            width : ListView.view.width / 2
            height : ListView.view.height / 2
            color : "blue"
          }
      
        }
      
        ListView {
          anchors.fill : parent
          model : slideModel
        }
      
      }
      

      main.qml:11: TypeError: Result of expression 'ListView.view' [null] is not an object.

      If I take the rectangle into a custom item it works:

      Item {
        width : 400
        height : 400
      
        VisualItemModel {
          id : slideModel
          Ext {}
        }
      
        ListView {
          anchors.fill : parent
          model : slideModel
        }
      
      }
      

      Ext.qml:

      import Qt 4.7
          Rectangle {
            width : ListView.view.width / 2
            height : ListView.view.height / 2
            color : "blue"
          }
      

      Attachments

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

        Activity

          People

            aakenned Aaron Kennedy
            steveire Stephen Kelly (Personal)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes