I'm trying to port a code from PyQt5 to PySide2. At a certain point, I'm using:
QMetaObject.invokeMethod(dialog, "my_function", Qt.QueuedConnection, QGenericArgument.Q_ARG(str, filepath))
Nevertheless, Q_ARG is not into QGenericArgument in PySide2. In fact, I have not been able to locate it at all, despite it is described in the documentation as the macro to be used instead of QGenericArgument.
Plan B: I tried using QGenericArgument directly, even while documentation discourages to do it. Therefore I tried these:
QMetaObject.invokeMethod(dialog, "my_function", Qt.QueuedConnection, QGenericArgument(str, filepath))
QMetaObject.invokeMethod(dialog, "my_function", Qt.QueuedConnection, QGenericArgument('str', filepath))
QMetaObject.invokeMethod(dialog, "my_function", Qt.QueuedConnection, QGenericArgument('QString', filepath))
In all of the cases, the error has been the same:
ERROR: 'PySide2.QtCore.QGenericArgument' called with wrong argument types:
PySide2.QtCore.QGenericArgument(str, str)
Supported signatures:
PySide2.QtCore.QGenericArgument(PySide2.QtCore.QGenericArgument)
PySide2.QtCore.QGenericArgument(bytes = nullptr, void = nullptr)
So it seems that I must use pointers here, but don't know how to do that. Also, I have not found any example of invokeMethod for PySide2.
Any idea?