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. Improve access speed
Forum Updated to NodeBB v4.3 + New Features

Improve access speed

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 943 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.
  • Z Offline
    Z Offline
    zepfan
    wrote on last edited by
    #1

    Hi,

    I'm building an application that uses a custom dot matrix text display. On the C++ side I have a QVariantList which gets exposed using Q_PROPERTY. This list is always 864 in size (108 bytes) and each element is a bool representing a bit. It gets updated every 20ms and emits a signal for the qml to get redrawn. I can't change the value of 20ms by the way.

    In the qml file I access this List and paint a small Rectangle for every bit - black for on, transparent for off. But accessing the List every 20ms is really slowing my application. Is there something I can do to optimise this? Or go about it a different way?

    Any help appreciated...

    Thanks.

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      zepfan
      wrote on last edited by
      #2

      Here's the main bulk of the qml code by the way. The display has an aspect of 36x24, with 3 rows of text. Therefore each row is 36x8 bits. driver.bitData is where I'm accessing the QVariantList...

      @
      Column {
      Repeater {
      model: mainParent.aspectHeight / 8 // 8 bits

      Row {
      property int rowIndex: index

      Repeater {
      model: mainParent.aspectLength

      Column {
       property int columnIndex: index
      
       Repeater {
        id: bitRepeater
        model: 8                                            
      
        Rectangle {
         // this represents 1 bit 
         id: dot
         width: printArea.dotWidth
         height: printArea.dotHeight
      
         property int byteIndex: (rowIndex * mainParent.aspectLength) + columnIndex
      
         property bool isOn: driver.bitData[byteIndex][index] //[byte][bit]
      
         color: isOn ? "#303030" : "transparent"
        }
       }
      }
      

      }
      }
      }
      }
      @

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Hi zepfan,

        how about creating your own QQuickPaintedItem derived class for the display and do all the rendering in that single place? And maybe you can share the memory for the bitmap between your display and your driver in c++.

        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