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. QQuick(PaintedItem) inside a flickable
Forum Updated to NodeBB v4.3 + New Features

QQuick(PaintedItem) inside a flickable

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.6k 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.
  • Q Offline
    Q Offline
    QbProg
    wrote on last edited by
    #1

    As follow up to this : http://qt-project.org/forums/viewthread/25805/

    I'm using a QQuickPaintedItem, drawing some lines.
    Now, I want to put it inside a flickable and update the drawing depending on the scroll position.
    I see that paint () is not called at each frame, so I don't know how to tell the item to repaint when the flickable scroll position is changed.

    (at the moment I tryed doing something like this, but seems a little weird)

    • have the QQuickPaintedItem "outside" the flickable, having it's size (anchors.fill : flickable)

    • draw the item each 300ms, via update()

    • bind the X position of the item to the flickable "contentX", so it basically scrolls the already-painted items without re-calling paint ()

    • everytime I trigger the timer , update the item () , and reset the X of the item to "0"

    If make the item bigger than the flickable, I can get a smooth scrolling without seeing the updates (though there is some flicker when the X position is reset).
    I feel this is not the correct way to do this!

    as an alternative option: is it possible to get an QSGNode low-level geometry out of a QPainter ? Maybe in this way I could transform the nodes depending on the contentX position, but I don't want to loose the QPainter benefits

    1 Reply Last reply
    0
    • U Offline
      U Offline
      utcenter
      wrote on last edited by
      #2

      I am also curious if there is a way to "borrow" the geometry QPainter generates when used on a OpenGL paint device, that could prove useful and save math headaches.

      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