how to make a QDockWidget switch between Modal and unmodal dynamically?



  • how to make a QDockWidget switch between Modal and unmodal dynamically?
    i now have a QDockWidget which is unmodal,
    can i just use this 1 object which can be modal sometimes, and other times it is unmodal...
    is the QDockWidget allocate on stack when it's modal, and on heap when it's unmodal when it's created by new.

    and is this only 1 object method good?
    actually the unmodal object is global, and the modal ones will be many such as OpenFileDlg.


  • Lifetime Qt Champion

    Hi,

    It looks like you are trying to use QDockWidget in a pretty unusual way like a QDialog. Can you describe more precisely your use case ?



  • @SGaist
    i want only 1 object which is global that it is unmodal now...
    sometimes i want to make it modal (the usage is similar to OpenFileDialog), at this time i also want to add Ok and Cancle button on it (which is not appear in it while it's modal)...
    i want to know is this possible?

    i know the normal way is that write 1 class, and create a object on stack whenever i want to use it like modal dialog. Meanwhile, just keep 1 global object which is new in heap.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.