Problems with Multiple QApplications(同时运行两个qt embedded程序)

Problems with Multiple QApplications
up vote
1

down vote
favorite
1
share [g+]
share [fb]
share [tw] Can someone help me understand what are the problems in running multiple QApplications 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 QApplications 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 anything which says that we should not run multiple QApplication instances at the same time.

I am executing two QApplications 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?

regards

-Nitin
qt
link|improve this question asked Nov 1 '09 at 11:07
beedroid
62

1
Do you mean multiple QApplication instances in a single process, or multiple processes each with one QApplication? – rohanpm Nov 1 '09 at 13:14
I meant, multiple QApplication instances in multiple, processes. – beedroid Nov 2 '09 at 3:04
feedback
3 Answersactive
oldest
votes
up vote
3

down vote 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.
link|improve this answer answered Nov 2 '09 at 10:16
rohanpm
2,66026

Thats what I did. Executed one application as QWS server and with fullScreen. Second Application, simply as client and in normalMode. Main windows of both of them are receiving mouse press events.However the application which is in foreground(second App) is alone receiving key press events. Even If I click on the fisrt application(QWS Server, fullScreen), it does not get focusInEvent, hence no keyboard focus and no key press events. I want this App also to get key press events. – beedroid Nov 2 '09 at 11:39
feedback


up vote
2

down vote 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.
link|improve this answer answered Nov 2 '09 at 9:43
drhirsch
10.6k31233



feedback

up vote
0

down vote 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?
link|improve this answer

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值