Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. setWindowModality problem!!!
QtWS25 Last Chance

setWindowModality problem!!!

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    opengpu2
    wrote on last edited by opengpu2
    #1

    i use setWindowModality to dynamically change a QDockWidget's modality.
    but i met a problem!

    void MyDockWidget::closeEvent(QCloseEvent* event)
    {
    if (windowModality() == Qt::ApplicationModal)  //WindowModality also failed...
      setWindowModality(Qt::NonModal);
    
    QDockWidget::closeEvent(event);
    }
    

    here i want to reset it back to non-modal....but after i close the modal one....the whole Qt app including the MainWindow and other windows Cannot clicked....the whole app seems be Frozen....i don;t know why...

    1 Reply Last reply
    0
    • O Offline
      O Offline
      opengpu2
      wrote on last edited by
      #2

      it seems like the Mainwindow and other windows still keep the state while the QDockWidget is modal......frozen there...cannot click anywhere...
      and i tried to setFocus to the Mainwindow...still not worked....

      1 Reply Last reply
      0
      • O Offline
        O Offline
        opengpu2
        wrote on last edited by
        #3

        anyone know met this problem?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          alex_malyu
          wrote on last edited by alex_malyu
          #4

          As far as I understand modality should not be changed after widget is shown,
          It is not simply a state, it is much more.
          Question is why do you want to do it.
          Mostly likely you should change the design to avoid this.
          But here is what documentation says:
          "Changing this property while the window is visible has no effect; you must hide() the widget first, then show() it again."

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved