问题
How does windowing work in qt embedded, where Qt is drawing directly to a framebuffer instead of through a separate windowing system? Can I run multiple programs at once? Do I get compositing and the little [x] button, maximizing and so forth?
回答1:
You need to run one application as the server to provide window management facilities; for example, by passing the -qws option at the command line when you run it.
Any other applications are run as clients. See this page for details:
http://doc.qt.digia.com/4.5/qt-embedded-running.html
回答2:
What part of how does it work are you asking about? If you want a basic overview, think of it kind of like a X-windows server on Linux, where the framebuffer draws the border, decorations, etc., only the Qt libraries are compiled to work more directly with the framebuffer than they do with X-windows servers. Various aspects of the framebuffer can be overridden by a program as well, rather than needing to be changed by the window server. However, for most of your UI work with Qt, you'd be using the exact some classes (QDialog, etc.) that you would on a regular desktop version. They are just drawn by a different underlying layer.
回答3:
From the Qt documentation :
A Qt for Embedded Linux application requires a server application to be running, or to be the server application itself. Any Qt for Embedded Linux application can be the server application by constructing the QApplication object with the QApplication::GuiServer type, or by running the application with the -qws command line option.
So you can pass QApplication::GuiServer
as the third parameter to the QApplication
constructor to have a server :
QApplication app( argc, argv, QApplication::GuiServer );
Or pass -qws
argument to application to run it as server :
./MyApp -qws
Other applications should run as clients.
来源:https://stackoverflow.com/questions/538783/how-does-windowing-work-in-qt-embedded