473,416 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

qt ver. 3, linux, windows, and modal forms

Hi,

I'm having a problem with modal forms on windows. I've written a very
short test program, with a main window and a form called from the main
window. The form is set to modal with form.setModal(1) before calling
form.show().

All works as expected on Linux. The form is modal, not allowing the main
window to received the focus. If I call the form from within itself, the
topmost form is modal, and not of the previous forms will receive the
focus until the topmost form is closed; then the next topmost is modal,
and so on.

However, on Windows XP Pro (at work - don't use windows at home), the
form is not modal. The main window will receive the focus with a mouse
click even though the modal form is still on top.

The source code is identical on both OS's.

Has anyone run into this before? Is there a fix? I haven't been able to
find anything with google searches, and Trolltech's forums don't seem to
have any entries addressing the problem, either.

I have a progam that I'm writing for work using Qt and Python, which was
like pulling teeth with our Microsoft oriented IT department, and I very
much do not want to tell them that it's not going to work (modal forms
are essential).

Thanks for your help,
Mike
Mar 24 '07 #1
2 2624
On Saturday 24 March 2007 23:08, Mike wrote:
I'm having a problem with modal forms on windows. I've written a very
short test program, with a main window and a form called from the main
window. The form is set to modal with form.setModal(1) before calling
form.show().
Is form an instance of a QWidget subclass or a QDialog subclass?

Have you tried calling form.exec_loop() instead of form.show()?
All works as expected on Linux. The form is modal, not allowing the main
window to received the focus. If I call the form from within itself, the
topmost form is modal, and not of the previous forms will receive the
focus until the topmost form is closed; then the next topmost is modal,
and so on.
This sounds like the desired behaviour.
However, on Windows XP Pro (at work - don't use windows at home), the
form is not modal. The main window will receive the focus with a mouse
click even though the modal form is still on top.
But this should show the same behaviour. I suspect that the use of show()
rather than exec_loop() leads to the platform-specific behaviour you are
seeing.
The source code is identical on both OS's.

Has anyone run into this before? Is there a fix? I haven't been able to
find anything with google searches, and Trolltech's forums don't seem to
have any entries addressing the problem, either.

I have a progam that I'm writing for work using Qt and Python, which was
like pulling teeth with our Microsoft oriented IT department, and I very
much do not want to tell them that it's not going to work (modal forms
are essential).
Modal forms are quite commonplace, so they should work as you expect. If you
above advice doesn't help, you'll need to supply some more information about
the versions of Qt, PyQt, SIP and Python you are using.

David
Mar 24 '07 #2
Answers interspersed.

David Boddie wrote:
On Saturday 24 March 2007 23:08, Mike wrote:
>I'm having a problem with modal forms on windows. I've written a very
short test program, with a main window and a form called from the main
window. The form is set to modal with form.setModal(1) before calling
form.show().

Is form an instance of a QWidget subclass or a QDialog subclass?
QDialog
>
Have you tried calling form.exec_loop() instead of form.show()?
Yes
>
>All works as expected on Linux. The form is modal, not allowing the main
window to received the focus. If I call the form from within itself, the
topmost form is modal, and not of the previous forms will receive the
focus until the topmost form is closed; then the next topmost is modal,
and so on.

This sounds like the desired behaviour.
>However, on Windows XP Pro (at work - don't use windows at home), the
form is not modal. The main window will receive the focus with a mouse
click even though the modal form is still on top.

But this should show the same behaviour. I suspect that the use of show()
rather than exec_loop() leads to the platform-specific behaviour you are
seeing.
Tried both - didn't make any difference.
>
>The source code is identical on both OS's.

Has anyone run into this before? Is there a fix? I haven't been able to
find anything with google searches, and Trolltech's forums don't seem to
have any entries addressing the problem, either.

I have a progam that I'm writing for work using Qt and Python, which was
like pulling teeth with our Microsoft oriented IT department, and I very
much do not want to tell them that it's not going to work (modal forms
are essential).

Modal forms are quite commonplace, so they should work as you expect. If you
above advice doesn't help, you'll need to supply some more information about
the versions of Qt, PyQt, SIP and Python you are using.
I'll have to get back to you on that one. I'm at home now (weekend).
Will get versions from work and let you know.
>
David
Thanks so much,
Mike
Mar 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: DoubleM | last post by:
Hi, I'm running Python2.3.3c1 on Mandrake 9.1 The following code is designed to bring up a window with a button labeled "popup". Clicking on the popup buttons triggers a secondary window with...
12
by: yoshimitsu | last post by:
Hi, I have decided to use a MainMenu in my main form. I have a menu item "Open Form". When this item is clicked I want the "newform.frm" to open just below the menu in the main form. How can this...
2
by: cassidyc | last post by:
Hi, I was wondering if anyone has come accross this issue? And if they have any solutions I have that can create new copies of itself Form1 as = new form1(); af.show(); This form can also...
8
by: Mitchell Vincent | last post by:
I think the answer was here, but it's expired and I can't figure out how to get it. In fact, I think I asked the question before! Anyway, I have the need to show an MDI child window modally, and...
23
by: Chukkalove | last post by:
Im sorry, I dont know the correct description for a hierarchy of parent and child forms. I have a main form that opens a child form modally. This child form in turn opens it's own child form...
1
by: Mike | last post by:
Hello, I have a Windows form that opens a modal dialog window. From there I can open yet another modal dialog window so I can grab some info to pass back to the first dialog. Both need to be...
3
by: aagarwal8 | last post by:
Hi, I have a main form, which i use to open secondary forms. From the secondary form i need to open a Modal Window in such a way that, my secondary form is blocked, but i can still access my...
4
by: =?Utf-8?B?Z2luYWNyZXNzZQ==?= | last post by:
I am trying to close/dispose multiple instances of a form but because they are modal and hidden, they do not show up in My.Application.OpenForms. They must be modal, so making them modeless is not...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.