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

Discussion in 'Python' started by Mike, Mar 24, 2007.

  1. Mike

    Mike Guest

    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
     
    Mike, Mar 24, 2007
    #1
    1. Advertisements

  2. Mike

    David Boddie Guest

    Is form an instance of a QWidget subclass or a QDialog subclass?

    Have you tried calling form.exec_loop() instead of form.show()?
    This sounds like the desired behaviour.
    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.
    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
     
    David Boddie, Mar 24, 2007
    #2
    1. Advertisements

  3. Mike

    Mike Guest

    Answers interspersed.

    Tried both - didn't make any difference.
    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.
    Thanks so much,
    Mike
     
    Mike, Mar 24, 2007
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.