Problems with Multiple QApplications
Can someone help me understand what are the problems in running multiple QApplication
s on Qt for Embedded Linux? Please point me to some documentation of mailing-list threads.
While going through some of the mails in mailing lists, I have seen some comments which say that, running multiple QApplication
s in Qt is not supported by design and why at all it is required? How can I understand this more clearly?
However, while reading the document "Qt for Embedded Linux Architecture" I did not find an开发者_JAVA技巧ything which says that we should not run multiple QApplication
instances at the same time.
I am executing two QApplication
s on a Embedded Linux platform (not a PC) and one of them in full screen mode. The one which is in fullScreen
mode it is not getting keyboard focus, even though it receives mousePress
events. If same app is run in normalMode
, it gets the mousePress
event followed by focusInEvent`.
Can somebody provide pointers on it?
You can run multiple processes each with one QApplication just fine.
However, with Qt for Embedded Linux, only one of these must be the QWS server. In other words, you should start the first process with `-qws', and all other processes without.
QApplication is a singleton class, so its "single" by design. You can have only a single QApplication object per program.
But in Qt there is no inherent limitation of the number of qt programs using the QApplication class you can run parallel. You can have more than one program using qt (and thus very likely QApplication) at the same time.
Probably this got somehow confused in your mailing lists.
My guess is that one QApplication would accept the mouse event or keyboard event and therefore the other would not get it.
Its probably a little random as to which QApplication accepts which events based on having so many QApplications in a single process.
I cannot imagine the use case as to why you would want multiple QApplications within a process. Could you expand on what you are trying to do?
精彩评论