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. Type errors using QInputDialog()
Qt 6.11 is out! See what's new in the release blog

Type errors using QInputDialog()

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

    I am cutting and pasting examples that work into my app and I get these errors.

    bq. Traceback (most recent call last):
    File "/home/me/scripts/ghf/ghf.py", line 295, in bkill
    QtCore.QDir.home().dirName())
    TypeError: 'PySide.QtGui.QInputDialog.getText' called with wrong argument types:
    PySide.QtGui.QInputDialog.getText(Ui_StatCheck, str, str, PySide.QtGui.QLineEdit.EchoMode, unicode)
    Supported signatures:
    PySide.QtGui.QInputDialog.getText(PySide.QtGui.QWidget, unicode, unicode, PySide.QtGui.QLineEdit.EchoMode = QLineEdit.Normal, unicode = QString(), PySide.QtCore.bool, PySide.QtCore.Qt.WindowFlags = 0)
    PySide.QtGui.QInputDialog.getText(PySide.QtGui.QWidget, unicode, unicode, PySide.QtGui.QLineEdit.EchoMode, unicode, PySide.QtCore.bool, PySide.QtCore.Qt.WindowFlags, PySide.QtCore.Qt.InputMethodHints)

    The python code for the GUI is generated by pyside-uic and it defines a class as "class Ui_MainWindow(object):"

    I've noticed in the example I am using the class is defined as "class Dialog(QtGui.QDialog):" so I am assuming that is the root of my problem.

    This is the function definition from the example;
    @def setText(self):
    text, ok = QtGui.QInputDialog.getText(self, "QInputDialog.getText()",
    "User name:", QtGui.QLineEdit.Normal,
    QtCore.QDir.home().dirName())
    if ok and text != '':
    self.textLabel.setText(text)@

    The function is called with "pushButton.clicked.connect(self.setText)". Since my signal is part of an 'object' class instead of a 'QtGui.Qdialog' class how do I invoke an input dialog?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Blackbear
      wrote on last edited by
      #2

      I found another method for getting the required input.

      Still curious how to pass the proper types to QInputDialog but at least I'm not DIW on my project.

      Thanks to all.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Blackbear
        wrote on last edited by
        #3

        Replaced 'self' with 'MainWindow' and the function worked.

        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