[Interest] Qt Quick Controls 2 Button Fails in GridView

Nurmi J-P jpnurmi at theqtcompany.com
Wed Mar 23 18:46:00 CET 2016


> On 23 Mar 2016, at 18:24, Mark R Youngquist <mark.youngquist at vantagecontrols.com> wrote:
> 
> I've been enjoying my time with using the QtQuick Controls in the labs portion of Qt 5.6
> 
> 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 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;
>             }
>         }
>     }
> }
> 
> Is anyone else experiencing this problem or have a recommendation for troubleshooting this?

Hi Mark,

Looks strange. Please file a bug. I can see some "<Unknown File>: QML VisualDataModel: Error creating delegate” messages, but it requires some debugging to figure out what’s actually going on there.

--
J-P Nurmi



More information about the Interest mailing list