Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Is there a way to set the QInputDialog().getInt() dialog as a NonModal dialog?
Forum Updated to NodeBB v4.3 + New Features

Is there a way to set the QInputDialog().getInt() dialog as a NonModal dialog?

Scheduled Pinned Locked Moved Solved Qt for Python
2 Posts 2 Posters 363 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.
  • feiyuhuahuoF Offline
    feiyuhuahuoF Offline
    feiyuhuahuo
    wrote on last edited by
    #1

    This function is convenient. But I need a NonModal dialog, is there a way to let
    QInputDialog().getInt() to achieve it?

    eyllanescE 1 Reply Last reply
    0
    • feiyuhuahuoF feiyuhuahuo

      This function is convenient. But I need a NonModal dialog, is there a way to let
      QInputDialog().getInt() to achieve it?

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by
      #2

      @feiyuhuahuo The static methods using exec so they are modal so a solution in your case is not to use QInputDialog::getInt() but to implement it:

      from PySide2 import QtWidgets
      
      
      class MainWindow(QtWidgets.QMainWindow):
          def __init__(self, parent=None):
              super().__init__(parent)
      
              button = QtWidgets.QPushButton("Open Dialog")
              self.setCentralWidget(button)
      
              self.input_dialog = QtWidgets.QInputDialog(modal=False)
              self.input_dialog.setWindowTitle("title")
              self.input_dialog.setLabelText("label")
              self.input_dialog.setIntRange(-2147483647, 2147483647)
              self.input_dialog.setIntValue(5)
              self.input_dialog.setIntStep(1)
              button.clicked.connect(self.input_dialog.show)
      
      
      if __name__ == "__main__":
          import sys
      
          app = QtWidgets.QApplication(sys.argv)
          w = MainWindow()
          w.show()
          sys.exit(app.exec_())
      

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      1 Reply Last reply
      2

      • Login

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