Results 1 to 8 of 8

Thread: Modal dialog not behaving

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2006
    Location
    Hawaii
    Posts
    130
    Thanks
    48
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Modal dialog not behaving

    Yes, this fixed the issue. Thank you for your help

    What is interesting, is that this ui file was made in designer, and I did not see the "windowModality" property in designer for the QLineEdit, so I am not sure how it got there especially since this property for the main widget was Qt::NonModal. Editing the ui file by hand did work though.

  2. #2
    Join Date
    May 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Modal dialog not behaving

    I'm a Qt n00b who inherited the duty to maintain a data entry application written in an earlier version of Qt. I've just started going through the code, learning the application and the Qt environment.

    I had the same problem with a QDialog object that you mentioned in your post that started this thread.

    My QDialog object contains:

    (1) a QTableView to list some records in a query from which the user was to choose one by clicking on it.

    (2) an OK QPushButton to accept the choice, and pass the record ID selected to the parent window while closing the QDialog window.

    (3) a Cancel QPushButton to close the QDialog window.

    Originally, the WindowModality properties of the QDialog window object and (1) and (3) were set to "NonModal" and that of (2) was set to "Aplication Modal".

    The QDialog functioned perfectly well when compiled in an earlier version of Qt. But when I compiled it in version 4.4.0, the behavior was exactly as you described.

    After I read this thread, I changed the WindowModality property of (2) to "NonModal" to match the WindowModality properties of the QDialog window object and (1) and (3), thinking that the inconstant values of the object properties were causing the problem.

    And it worked!

    Obviously, some "under the hood" functionality of the Qt libraries changed, causing the QDialog window object to behave differently when compiled with the new version even though there were no code or ui changes.

    But what puzzles me is that even though the QDialog window object and all the objects it contains now have their WindowModality properties set to "NonModal", the QDialog window still behaves like it is a modal window; that is, you can't shift focus to the parent window without first closing the QDialog child window. This is fine, since that is how it is supposed to function. But by my understanding, if the QDialog is set to be "NonModal", then it shouldn't behave like a modal window, should it?

    Is there something that I don't understand or is this a bug?

  3. #3
    Join Date
    Oct 2006
    Location
    Hawaii
    Posts
    130
    Thanks
    48
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Modal dialog not behaving

    In my case what seemed to be happening, was that when i use "exec()" then the pop up of course is shown modal. The "Qt::ApplicationModal" property of the QLineEdit caused it to be modal relative to the pop up and blocking all input to the pop up, which in turn blocked the main window, locking up the whole program.

    Thus, making the QLineEdit Qt::NonModal made it not block the pop up window, in turn allowing the submit button to work.

    This behavior makes sense, however in older versions (and on other operating systems aside from windows) the "Qt::ApplicationModal" property in the .ui file seems to be ignored for the QLineEdit, as I had used the offending .ui file for quite a while on many platforms with no problem.

    I am not even sure how my QLineEdit got this property given that I made the UI file with designer, and designer does not give you the option to set this property for QLineEdit. It was however originally made with an older designer in the 4.x series on linux, and then used when I compiled with the latest version on windows. Manually editing the .ui file to remove that property fixed the issue right away.

Similar Threads

  1. modal dialog blocking problem...
    By photonmaster in forum Qt Programming
    Replies: 3
    Last Post: 4th June 2008, 09:49
  2. Special Modal Dialog
    By adonel in forum Qt Programming
    Replies: 2
    Last Post: 13th May 2008, 08:12
  3. System modal dialog!!
    By boss_bhat in forum Qt Programming
    Replies: 2
    Last Post: 23rd June 2006, 07:01
  4. QDialog::exec() cereates no modal dialog
    By sboesch in forum Qt Programming
    Replies: 8
    Last Post: 27th March 2006, 17:03
  5. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 14:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.