Results 1 to 2 of 2

Thread: QDialog and setModal

  1. #1

    Default Re: QDialog and setModal

    Hi all,
    I'm programming with QT 4.8.4, and i need to show modal dialog.

    I develop an QDialog frameless window with setModal(true). It's show correctly but mouse press position are wrong: if i put QPushButton as children of Dialog i can't click it correctly, seems there is an offset of 10px into mouse position.

    This is how i show window: (show method is ovveride)
    Qt Code:
    1. MenuPopupDialog *dlg = new MenuPopupDialog(this);
    2. dlg->setWindowTitle("Menù");
    3. dlg->setModal(true);
    4. dlg->show(QSize(500,700));
    To copy to clipboard, switch view to plain text mode 

    But if i set setModal(false) and windowsFlag to frameless window + Popup mouse work correctly.

    How can i resolve?

    Thanks

    Marco


    Added after 1:


    Another code problem:

    Qt Code:
    1. QDialog *dlg = new QDialog(this);
    2. QPushButton *btn = new QPushButton(dlg);
    3. btn->setGeometry(20,20,50,50);
    4. dlg->setModal(true);
    5. dlg->show()
    6. ;
    To copy to clipboard, switch view to plain text mode 

    Try this cose, you will be not able to push the button, why?

    Thanks
    Last edited by ruscoff; 3rd October 2013 at 10:54.

  2. #2

    Default Re: QDialog and setModal

    I found the problem:
    I intercept WM_NCACTIVATE and set it always to True,thats means main windows always activate.
    To work correctly QT need only one window actived, so i've to set WM_NCACTIVATE to False when required.

Similar Threads

  1. Replies: 1
    Last Post: 26th March 2013, 02:04
  2. Replies: 9
    Last Post: 25th March 2011, 21:22
  3. QDialog.exec() exiting without calling QDialog::accept()
    By doggrant in forum Qt Programming
    Replies: 3
    Last Post: 2nd February 2011, 11:35
  4. closing a Qdialog called from a Qdialog
    By OverTheOCean in forum Qt Programming
    Replies: 3
    Last Post: 28th September 2009, 08:02
  5. QDialog setModal()
    By summer_of_69 in forum Qt Programming
    Replies: 0
    Last Post: 16th August 2009, 12:46

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.