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. How to use C++ Painter component on ListView and make it visible.

How to use C++ Painter component on ListView and make it visible.

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 2.0k Views
  • 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.
  • P Offline
    P Offline
    Pong_Cpr.E.
    wrote on last edited by
    #1

    I have declared Line component for using in QML. but when I use it on ListView it not visible.

    this is code:

    @
    import QtQuick 1.0
    import DrawLine 1.0

    Rectangle { id: page
    width: 400; height: 300
    color: "#4d4d4d"

    ListView { 
        id: lineList
        anchors.fill: parent;
        model: lineModel
        delegate: Component {
            Item {
                DrawLine { // this line is not visible
                    name: "testInList";  
                    x1:x1; y1:y1; x2:x2; y2:y2;
                    color: "red"
    
                }
                Text { // this text is visible
                    text: txt
                }
            }
        }
        ListModel { id: lineModel
            ListElement {
                x1:0; y1:50; x2:800; y2:800; txt:"hello"
            }
    
        }
    }
    
    DrawLine { name: "testOutList"; x1:0; y1:0; x2:1200; y2:800; color: "red" ; } // this line is visible
    

    }@

    How to make it visible ?

    Thanks.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      moderator note
      I have deleted your copy of this post in the Desktop and General forum. Please stick to a single forum when you post questions. Multi-posting is not good practice and it will not get you more attention.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Pong_Cpr.E.
        wrote on last edited by
        #3

        Apologize with that. I'll stick to a single forum when I post next questions.

        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