Improve access speed
-
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.
-
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 bitsRow {
property int rowIndex: indexRepeater {
model: mainParent.aspectLengthColumn { 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" } } }
}
}
}
}
@ -
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++.