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. Problem with QDialog , its not closeing right away when pressing the x , how to make it NOT on top?
QtWS25 Last Chance

Problem with QDialog , its not closeing right away when pressing the x , how to make it NOT on top?

Scheduled Pinned Locked Moved General and Desktop
13 Posts 3 Posters 4.0k 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.
  • G Offline
    G Offline
    goetz
    wrote on last edited by
    #4

    It's all explained in the [[Doc:QDialog]] API docs, including examples (look for the modal/modeless explanations), did you check those already?

    http://www.catb.org/~esr/faqs/smart-questions.html

    1 Reply Last reply
    0
    • U Offline
      U Offline
      umen242
      wrote on last edited by
      #5

      Ok Thanks about the modeless problem i understood .
      what about the connect / disconnect problem am i doing it right

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #6

        [quote author="umen242" date="1312788672"]Ok Thanks about the modeless problem i understood .
        what about the connect / disconnect problem am i doing it right [/quote]

        Probably not. The code looks a bit weird to me. But it's hard to analyze without the complete classes and without knowing what you actually want to do.

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • U Offline
          U Offline
          umen242
          wrote on last edited by
          #7

          what do you what me to show you , its context menu (right click ) when im on tree node it give me the option to right click and opem QDialog window

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #8

            So, why do you double the functionality? The signal mapper is only needed if the context menu needs to stay open during the execution of the slot called from the mapper.

            The menu exec gives you back the selected menu entry:

            @
            QAction* selectedItem = ContextMenu.exec(globalPos);
            @

            Just call the appropriate dialog according to the action returned by exec and abandon the QSignalMapper completely.

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • U Offline
              U Offline
              umen242
              wrote on last edited by
              #9

              im using the mapper to pass value to OpenWin slot when triggered() signal is invoked
              i don't see any other option

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on last edited by
                #10

                Try this:

                @
                void MainWindowContainer::ShowContextMenu(const QPoint& pos) // this is a slot
                {
                QPoint globalPos = ui.treeView_mainwindow->mapToGlobal(pos);
                QAction* selectedItem = ContextMenu.exec(globalPos);

                if(selectedItem == OpenAction) {
                    // do the open stuff
                } else if(selectedItem == EditAction) {
                    // do the edit stuff
                }
                

                }
                @

                Problem with your approach is, that the actions fire while the menu is open - and during this time, the menu's event loop (call of exec) is still running and may interfere with the rest of the application.

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply
                0
                • U Offline
                  U Offline
                  umen242
                  wrote on last edited by
                  #11

                  Thanks Allot for your time to answer.
                  but what if i have only one Action in the Context menu , and the action will be by the parameter taken from the node it stand on

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on last edited by
                    #12

                    Then you will have some code that attaches the data to the action anyways.

                    You could consider "dynamic properties":http://doc.qt.nokia.com/4.7/qobject.html#dynamic-properties attached to your QAction instances. You can read those from the returned QAction.

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0
                    • U Offline
                      U Offline
                      umen242
                      wrote on last edited by
                      #13

                      ok i will check it out ,thanks 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