问题
I am building a UI with QT Designer. I need this UI to run on a Raspberry Pi. What do I need to do to make the UI for the Pi? Does it have to be written in a specific language like python or can I just write it in whatever and launch it on the Pi? I am new to this and would really appreciate the guidance.
回答1:
To run qt-creator on Rpi itself. You can install it by "sudo apt-get install qt-creator"
It will install qt-creator and qt4-base modules on rpi. After installing, you can run "qt-creator" on terminal to get started with design. You will be using drag and drop for UI design and c++ as you background code language if you use qt creator.
However, qt creator runs very slowly on Rpi B due to limited RAM available on Rpi. (I'm not sure about rpi 2 as it is definitely more powerful)
2nd way is to install qt4 base package on rpi and start developing qt UI application on a linux running PC (possibly a debian distro). Since raspbian is a flavor of debian, first you can test code on your pc and then use those files to build code for rpi.
3rd way is to setup cross compiler on your host PC and compile binary for rpi once you test program successfully on native machine.
Hope it helps.
回答2:
It seems the latest is:
sudo apt-get install qtcreator
(without the dash)
And run with: qtcreator
A ui-file can can be converted for Python loading by using pyuic5
Note, if you use the PySide2 version, pyside2-uic (which also generates a .py file), your code might not run with Qt5. I've found if you reload the .ui file in QtDesigner, save it again as a .ui file, and use pyuic5, things work.
来源:https://stackoverflow.com/questions/30492720/qtdesigner-for-raspberry-pi