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. Efficiently update vector image in Qml Flickable on Android
Forum Updated to NodeBB v4.3 + New Features

Efficiently update vector image in Qml Flickable on Android

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

    I'm trying to view large vector image in Qml Flickable on Android. I created an instance of QQuickPaintedItem (named ViewItem) as a child of Flickable and reimplemented paint function in such way:

    @void ViewItem::paint(QPainter *painter)
    {
    ...
    // width,height - sizes of Flickable item
    QImage image(width, height);
    ...

    // x,y - left-top coordinates of ViewItem on Flickable surface
    painter->drawImage(QPoint(x,y), image);
    }@

    It works so: when image is moved new pixmap of the whole ViewItem is created and rendered. And it's very slow. With an old Qt realization only a part of ViewItem was updated with the help of QScrollView::drawContents() function.

    Maybe it's possible to make viewer work faster with the help of update() function but I failed to understand how it works. Can you advise principles to build efficient vector image viewer for Android with scaling and moving functions? Thanks!

    1 Reply Last reply
    0
    • X Offline
      X Offline
      Xander84
      wrote on last edited by
      #2

      Hi, you may try and use a QOpenGLFramebufferObject instead of the QImage as the render target, also if your image doesn't change much you can cache the painted image/texture in your class I guess?

      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