Saturday, May 30, 2020

Future topics


Topics on the horizon

  • Themes & palette
  • Qt slots vs a pure C++ function vs Javascript function (speed comparison)
  • Qt message queue not preemptive at times
  • Using Promise or Qt.callLater() to make an application more snappy
  • Difference between a Rectangle and Item
  • Difference in speed between a QAbstractModelItem vs QML ListModel/ListElement
  • Difference in speed/memory between Rectangle and Pane
  • QML language bug: unable to resolve "this" when in an arrow function
  • How to use Javascript modules along with QML files
  • The drawback of declarative programming (using Loader to lazy load & load async)
  • Easily pass C++ objects to QML without using QObjects
  • Using Qt.callLater() to solve binding loops
  • What to do when ListView or TreeView redraws are too slow
  • How are binding loops broken?
  • What is the difference between "property var x" and "property string x"?
  • Difference between a Qt/QML object versus a Javascript object
  • Difference between a Javascript string and a QML string




Saturday, May 23, 2020

The Dreaded QML Binding Loop (Part 1)

What is a Binding Loop

The dreaded
Binding loop detected for property <xxx>
is a familiar error message for many QML developers. It is also a dreaded message because finding out where the binding loop is takes time. One cannot find it with a debugger. Once found, fixing it will be another time consuming task because it requires re-architecting or re-designing your code.

A binding loop is where one property depends on the value of another property (usually embedded in another QML type), and the other property somehow, through a long chain of dependencies, depends on the value of the original property.

What Is Declarative Programming in QML

The QML Declarative Programming Scene

It is not uncommon to see many developers, who believe they practise declarative programming in QML, to have been thought the wrong way of declarative programming by their colleagues or incumbent QML experts. With this chain reaction, the wrong way to program declaratively gets propagated from software engineer to software engineer. Before long, the QML code base becomes highly complex and difficult to manage. Sometimes, developers refer to it as a mine field.