473,573 Members | 2,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2635
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
3322
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 a button labeled "ok". The second window is supposed to be modal - it should not be possible to reset the focus back to the first window or close...
12
369
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 be done? I am using VB.Net. Thanks for any replies. Yoshi
2
2550
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 bring up a modal dialog (MessageBox)
8
4000
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 I know the docs say "you can't" , but there *must* be some kind of hack, work around or magic to make this happen. Is there? Thanks guys! --
23
2716
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 modally. I also have a separate thread running that monitors a card reader. If the user removes the card then the thread calls back the main form to tell...
1
3781
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 modal and are launched like this: if (formName1.ShowDialog( this ) == DialogResult.OK) ......
3
2467
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 main forms, and open other secondary windows. (An exact analogy for my problem is the Yahoo Messenger, where i can open any number of chatwindows...
4
4540
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 an option. I also need to check the values in a spread control on the forms before I close/dispose them. I'm using VB 2005. Is there some way...
21
3314
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 a zipcode that is unknown this form will open. I don't want users to modify any of this customers data until they close the zipcode form. ...
0
7699
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8027
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8202
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6421
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5594
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5292
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3733
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3733
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2216
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.