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. Is there a lightweight component I can use in a ScrollView?
Forum Updated to NodeBB v4.3 + New Features

Is there a lightweight component I can use in a ScrollView?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 323 Views 2 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
    kitfox
    wrote on last edited by kitfox
    #1

    At the moment, I'm using a ScrollView to display a customized QQuickPaintedItem. Unfortunately, my custom component can have a very large size so (based on some early experimenting) I think it is allocating a very large buffer for drawing. I would prefer that only a buffer large enough to fit the viewport is allocated and my drawing code is called to update just the visible portion instead of the entire component. However, I don't see a way to do this with this with a QQuickPaintedItem.

    Is there some other component that will allow me to use a much smaller buffer and paint in a just-in-time fashion so that I can render a component with a large logical size?

    raven-worxR 1 Reply Last reply
    0
    • K kitfox

      At the moment, I'm using a ScrollView to display a customized QQuickPaintedItem. Unfortunately, my custom component can have a very large size so (based on some early experimenting) I think it is allocating a very large buffer for drawing. I would prefer that only a buffer large enough to fit the viewport is allocated and my drawing code is called to update just the visible portion instead of the entire component. However, I don't see a way to do this with this with a QQuickPaintedItem.

      Is there some other component that will allow me to use a much smaller buffer and paint in a just-in-time fashion so that I can render a component with a large logical size?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @kitfox
      https://doc.qt.io/qt-5/qquickpainteditem.html#textureSize-prop

      alternatively(?) you can try to call setRenderTarget(QQuickPaintedItem::FramebufferObject), since then no image texture is allocated? But i am not an expert on that matter

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

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

        A framebuffer object is used in much the same manner as an image. So QQuickPaintedItem will still allocate a raster (presumably the same size), it will just access it in a slightly different way under the hood.

        1 Reply Last reply
        0
        • jeremy_kJ Offline
          jeremy_kJ Offline
          jeremy_k
          wrote on last edited by
          #4

          I don't see a ready-made solution.

          You could pass the ScrollView to the QQuickPaintedItem, or look for it by following the parentItem chain.

          Use the underlying Flickable's contentX, contentY, etc, and QQuickItem::mapRectFromItem() to determine what portion of the QQuickPaintedItem is visible. Calls to update() will be necessary when the ScrollView's viewport changes, because the initial paint is expected to have painted the entire item into the backing store.

          Asking a question about code? http://eel.is/iso-c++/testcase/

          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