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. Unlocking QMainWindow when QDialog is open
Forum Updated to NodeBB v4.3 + New Features

Unlocking QMainWindow when QDialog is open

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 1.6k Views 1 Watching
  • 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.
  • X Offline
    X Offline
    xXDarkShadowXx
    wrote on 13 Oct 2013, 10:55 last edited by
    #1

    When a QDialog is open, Qt prevents you from clicking/accessing your QMainWindow by locking it.

    Is there a way to change it so that when a QDialog is open, you can also click/access your QMainWindow?

    If not, what could i use to be able to access two windows at the same time?
    Thanks.

    Code used to display my QDialog

    @
    NetstatMap Map;
    Map.setModal(true);
    Map.exec();
    @

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p3c0
      Moderators
      wrote on 13 Oct 2013, 11:03 last edited by
      #2

      Hi,

      Does it allow when you setModal to false ?

      157

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xXDarkShadowXx
        wrote on 13 Oct 2013, 11:04 last edited by
        #3

        [quote author="p3c0" date="1381662184"]Hi,

        Does it allow when you setModal to false ?[/quote]

        Nope.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          p3c0
          Moderators
          wrote on 13 Oct 2013, 11:07 last edited by
          #4

          Try @ Map.show();@

          157

          1 Reply Last reply
          0
          • X Offline
            X Offline
            xXDarkShadowXx
            wrote on 13 Oct 2013, 11:16 last edited by
            #5

            [quote author="p3c0" date="1381662444"]Try @ Map.show();@[/quote]

            When using Map.show(); the QDialog closes instantly.

            1 Reply Last reply
            0
            • I Offline
              I Offline
              issam
              wrote on 13 Oct 2013, 11:17 last edited by
              #6

              I think You must set the parent of the QDialog object to be the QMainWindow cobject !

              http://www.iissam.com/

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 13 Oct 2013, 20:03 last edited by
                #7

                Hi,

                It's because your dialog is on the stack, you must allocate it on the heap if you want it to survive the function where it's created. To ensure it gets deleted, set the Qt::WA_DeleteOnClose property on it (unless you want to be able to hide/show it but then it's another problem)

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0

                3/7

                13 Oct 2013, 11:04

                • Login

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