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

Qt Quick Controls 2 Button fails creation in GridView

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 5.6.0
    • None
    • Windows 7, Using Qt 5.6 / Visual Studio 2015

    Description

      I have a scenario where I use a GridView with a delegate Button component with a custom background property. Once I run the application and scroll through the grid I receive several errors in my output and an equivalent number of blank spaces in the grid itself. As soon as I remove my custom background, everything works great. This occurs on both desktop and embedded builds.

      The error output is: <Unknown File>: QML VisualDataModel: Error creating delegate

      The main.qml code is as follows:

      import QtQuick 2.6
      import Qt.labs.controls 1.0
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
      
          GridView {
              id: gridThing;
              anchors.fill: parent;
              cellWidth: 75;
              cellHeight: 75;
              model: 500;
      
              delegate: Button {
                  id: control
                  text: "Test"
                  width: gridThing.cellWidth;
                  height: gridThing.cellHeight;
                  background: Rectangle {
                      implicitHeight: 20;
                      implicitWidth: 20;
                      color: "red";
                      width: control.width;
                      height: control.height;
                      x: 0;
                      y: 0;
                  }
              }
          }
      }
      

      I also see the same problem when I use a ListView

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              markryoungquist Mark Youngquist
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes