Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1964

Feature Request: Keyword Argument Support

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 6.3.0
    • PySide
    • None
    • OS: All
      PySide/PyQt: Next release

    • All
    • 61834a7895db65e56434ca9c463b61e1fd40b71e

    Description

      Moderators: A "New Feature" issue type may be more appropriate, but this was not available to me.

      C++ doesn't natively support keyword arguments, but Python does. Calls to `Qt` functions from `PyQt` return a "no matching signature" or "not enough arguments" error when keywords are used. This is confusing for newcomers, especially if they are calling a function correctly but are otherwise unaware that keyword arguments are not supported.

      Would it be possible to wrap `Qt` calls in the python bindings so keyword arguments are supported?

      #    keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1)
      # Works: keyword parameter for optional argument
          QTest.keyPress(window, Qt.Key_Q, modifier=Qt.ControlModifier) # 
      # Does not work
          QTest.keyPress(widget=window, key=Qt.Key_Q, modifier=Qt.ControlModifier)
          QTest.keyPress(widget=window, key=Qt.Key_Q, modifier=Qt.ControlModifier)
      TypeError: PySide6.QtTest.QTest.keyPress(): not enough arguments
      

      Attachments

        For Gerrit Dashboard: PYSIDE-1964
        # Subject Branch Project Status CR V

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            adamhendry Adam Hendry
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes