Qt::QML Application development in PantherX

Options:
1. Qt Creator via flatpak

  • Install Qt Creator via flatpak.
flatpak install --user flathub io.qt.QtCreator
  • Run the Qt Creator with --user and --filesystem=/var/guix/profiles
flatpak run --user --filesystem=/var/guix/profiles io.qt.QtCreator
  • Open/Create your project and go to the Project/Manage Kits

  • Qt Versions Tab:
    Click on Add and the real path of qmake command in the guix store. A path like this:

/gnu/store/3ag62qr53br83x0p0739xdhshd3km7yk-qtbase-5.15.2/bin/qmake
  • Compilers Tab:
    Click on Add and add the GCC-C and GCC-C++. Enter the real path of the gcc and g++ from the guix store in Compiler Path text box. Example:
/gnu/store/sjnh6a1fizi2jkiiham0d9s37bccpzid-gcc-toolchain-11.2.0/bin/gcc
/gnu/store/sjnh6a1fizi2jkiiham0d9s37bccpzid-gcc-toolchain-11.2.0/bin/g++
  • Debuggers Tab:
    Click on Add and add the real path of gdb. Example:
/gnu/store/9nsgri0qgffyr83ry90fq2ik92ih4s2p-gdb-10.2/bin/gdb
  • CMake Tab:
    Click on Add and add the real path of cmake. Example:
/gnu/store/vfbw5h12hqg23bagnzgrmclds2vrky3q-cmake-3.21.1/bin/cmake
  • Kits Tab:
    Click on Add, set a proper name and set all toolchain with them you added above. (qmake, gcc, g++, gdb and cmake)

  • Ensure the Qt Creator is using that qmake you entered in the Project/QtXX/Build/Effective qmake call

  • Update the QML2_IMPORT_PATH and QT_PLUGIN_PATH env variables:
    Go to the Project, choose the kit which you added, go to the Run and update the QML2_IMPORT_PATH and QT_PLUGIN_PATH in the Environment part.

QT_PLUGIN_PATH=/gnu/store/3ag62qr53br83x0p0739xdhshd3km7yk-qtbase-5.15.2/lib/qt5/plugins:/gnu/store/49rn4wjbwaagb8hr6rgdgwdm6bbdab6x-qtdeclarative-5.15.2/lib/qt5/plugins:/gnu/store/5jixar8hqbwmm302h2r04kw6g4268qyk-qtsvg-5.15.2/lib/qt5/plugins
QML2_IMPORT_PATH=/gnu/store/49rn4wjbwaagb8hr6rgdgwdm6bbdab6x-qtdeclarative-5.15.2/lib/qt5/qml:/gnu/store/22jq16rmk7rj5yi9sr01m9nic94k1jdp-qtgraphicaleffects-5.15.2/lib/qt5/qml:/gnu/store/3rxgqyhchca58apbafy6jkx2cs6zrhns-qtquickcontrols-5.15.2/lib/qt5/qml:/gnu/store/yw5fj3hjdv9wg8wr2ax4rgh8xslwf1p5-qtquickcontrols2-5.15.2/lib/qt5/qml:/gnu/store/5xssbna6yw6nvvkph0zn4v17al3cf2mk-qtxmlpatterns-5.15.2/lib/qt5/qml

If you don’t this last step, the project will be built but if you use QtQuick.Controls@2.x, it will be crashed.

2. VSCode:

To build and running the QML application in VSCode, only you need to update QT_PLUGIN_PATH and QML2_IMPORT_PATH env variables like above.

2 Likes