Conditional rendering of simulation vs production
-
wrote on 4 Mar 2024, 08:05 last edited by
Hello,
I have an application that communicates with some hardware. I do not always have the hardware at hand, so I wrote
class hardwaredriver
aswell asclass hardwaredriversimulation
. I have a config that is read upon application start, so I know if its a simulation or production run.How can I make sure the correct QML Object is created without doing something like this in QML
if (profile == simulation) hardwaredriversimu{} else hardwaredriver{}
Doesnt look too clean to me. Anyone got any ideas?
-
Hello,
I have an application that communicates with some hardware. I do not always have the hardware at hand, so I wrote
class hardwaredriver
aswell asclass hardwaredriversimulation
. I have a config that is read upon application start, so I know if its a simulation or production run.How can I make sure the correct QML Object is created without doing something like this in QML
if (profile == simulation) hardwaredriversimu{} else hardwaredriver{}
Doesnt look too clean to me. Anyone got any ideas?
@Redman you can use file selectors for that. Example: https://doc.qt.io/qt-6/qtquickcontrols-fileselectors.html
-
1/2