how to best set OS specific properties in plugin
Hello.
I need some properties to adapt to the OS, namely file paths and executable location. For now they are commented in the script, up to the user to uncomment the ones s.he needs... but that's not nice for non developpers.
The compile-time macro #ifndef Q_OS_WIN
don't seem to work.
What are other (better) options to make some part of the QML code OS-aware ? (mostly distinguishing Linux; from Windows; from MacOSX)
Thanks.
Berteh.
Comments
See https://doc.qt.io/qt-5/qml-qtqml-qt.html#platform-prop
Looks like testing
Qt.platform.os
will do the trick.If you have better options feel free to comment, of course !
doc: https://doc.qt.io/qt-5/qml-qtqml-qt.html#platform-prop
In reply to Looks like testing Qt… by berteh
That's what I hinted at ;-)
In reply to That's what I hinted at ;-) by Jojo-Schmitz
yes, thanks. But I'm not allowed to use the (dynamic)
if
test in the class properties areas, or is there any way in QML ? (sorry for my poor JS knowledge).In reply to Looks like testing Qt… by berteh
I ended up using syntactic sugars. Works... but not great if you need to test for multiple platforms or have many properties... so better options are still welcome.