Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] GridView wraps to late.
Forum Updated to NodeBB v4.3 + New Features

[Solved] GridView wraps to late.

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kysymys
    wrote on last edited by
    #1

    Hi there,

    I am new to using QML, so I don't really know if the GridVirew's behavior is normal.
    GridView wraps it's content at some point, but to late, so the last element on each row gets clipped.

    Also the scene produces following message:
    @Cannot create accessible interface for object: QQuickRectangle(0x9d9e820)@

    I don't know why this error message is produced, since everything seems to working right.


    Please enlighten me.

    Last element gets clipped:
    !http://s9.postimg.org/wdcswspmn/2013_03_26_22_35_41_Grid_Cuts_Wrapped.png(Grid clipps content)!

    Code to reproduce:
    @import QtQuick 2.0

    Rectangle {
    width: 300
    height: 300
    color: "gray"

    Rectangle {
    anchors.fill: parent
    anchors.margins: 10
    color: "white"

    GridView {
    id: grid
    anchors.fill: parent
    cellWidth: 80; cellHeight: 80
    clip: true
    highlight: Rectangle { color: "darkgray"; radius: 10 }
    focus: true

    model: ListModel {
    ListElement { color: "red"; text: "red" }
    ListElement { color: "blue"; text: "blue" }
    ListElement { color: "yellow"; text: "yellow" }
    ListElement { color: "red"; text: "red" }
    ListElement { color: "blue"; text: "blue" }
    ListElement { color: "yellow"; text: "yellow" }
    }
    delegate: Rectangle {
    width: grid.cellWidth; height: grid.cellHeight
    color: "transparent"
    border.color: "black"
    radius: 10

    Column {
     anchors.fill: parent
     anchors.topMargin: 10
     Rectangle {
      anchors.horizontalCenter: parent.horizontalCenter
      width: 60; height: 50; color: model.color
     }
     Text {
      anchors.horizontalCenter: parent.horizontalCenter
      text: model.text;
     }
    }
    

    }
    }
    }
    }
    @

    \o/ \o/ Kudos ...

    Paholaisen Kysymys

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jens
      wrote on last edited by
      #2

      The bug you found was probably already reported here:
      https://bugreports.qt-project.org/browse/QTBUG-29436

      Since this is a bug in the component itself and behavior might change in the future, the safest way to work around it would be to ensure that the with of your grid view is an exact multiple of cellWidth. You can do this by not filling to parent and assigning the width yourself.

      I believe you can ignore the warning safely and there has already been issued a fix for it here: https://bugreports.qt-project.org/browse/QTBUG-29720

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kysymys
        wrote on last edited by
        #3

        Thanks a lot.
        That answers my question.

        \o/ \o/ Kudos ...

        Paholaisen Kysymys

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved