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

Feature Request: Keyword Argument Support

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Reported
    • Priority: Not Evaluated
    • Resolution: Unresolved
    • Affects Version/s: 6.3.0
    • Fix Version/s: None
    • Component/s: PySide
    • Labels:
      None
    • Environment:

      OS: All
      PySide/PyQt: Next release

    • Platform/s:
      All
    • Commits:
      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

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            crmaurei Cristian Maureira-Fredes
            Reporter:
            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