Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. How to make a modal dialog?
Forum Updated to NodeBB v4.3 + New Features

How to make a modal dialog?

Scheduled Pinned Locked Moved Language Bindings
3 Posts 2 Posters 2.3k 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.
  • R Offline
    R Offline
    robinsiebler
    wrote on last edited by
    #1

    I am trying to make a modal dialog. I have the below code. If I use ldlg.show(), the dialog never appears. If I use ldlg.exec_(), the dialog is not modal. What am I doing wrong? I have the dialog properties set to ApplicationModal.

    @
    self.action_Legend.triggered.connect(self.show_legend)

    def show_legend(self):
        """Display the Legend dialog."""
    
        class LegendDialog(QDialog, legendDlg.Ui_dlgLegend):
          def __init__(self, parent=None):
    
            super(LegendDialog, self).__init__(parent)
            self.setupUi(self)
    
        ldlg = LegendDialog()
        ldlg.exec_()
    

    @

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      Please check out how to use "code wrappings.":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01 They make your code section readable. I introduced them for you this time.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • R Offline
        R Offline
        robinsiebler
        wrote on last edited by
        #3

        Thankfully, I found the answer "somewhere else":http://stackoverflow.com/questions/5874025/pyqt4-how-to-show-a-modeless-dialog...

        @ ldlg = LegendDialog(self)
        ldlg.show()@

        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