Usage of QGenericArgument / Q_ARG when using invokeMethod in PySide2










1















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?










share|improve this question
























  • Possible duplicate of QMetaObject::invokeMethod doesn't find methods with parameters

    – eyllanesc
    Nov 14 '18 at 11:43











  • unfortunately PySide2 inherits the same limitations of PySide

    – eyllanesc
    Nov 14 '18 at 11:43











  • So, no news in last years for this issue? In that question the OP is using 'QString' in GenericArgument, and str in the slot (just as I already tried with no success). Any workaround?

    – Roman Rdgz
    Nov 14 '18 at 15:26











  • As they point out in the answer that is a bug, it does not matter if it is QString or str, which still remains in PySide2 and unfortunately there is no workaround

    – eyllanesc
    Nov 14 '18 at 15:35















1















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?










share|improve this question
























  • Possible duplicate of QMetaObject::invokeMethod doesn't find methods with parameters

    – eyllanesc
    Nov 14 '18 at 11:43











  • unfortunately PySide2 inherits the same limitations of PySide

    – eyllanesc
    Nov 14 '18 at 11:43











  • So, no news in last years for this issue? In that question the OP is using 'QString' in GenericArgument, and str in the slot (just as I already tried with no success). Any workaround?

    – Roman Rdgz
    Nov 14 '18 at 15:26











  • As they point out in the answer that is a bug, it does not matter if it is QString or str, which still remains in PySide2 and unfortunately there is no workaround

    – eyllanesc
    Nov 14 '18 at 15:35













1












1








1








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?










share|improve this question
















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?







python pyside2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 11:42









eyllanesc

77.5k103156




77.5k103156










asked Nov 14 '18 at 8:55









Roman RdgzRoman Rdgz

5,3372988166




5,3372988166












  • Possible duplicate of QMetaObject::invokeMethod doesn't find methods with parameters

    – eyllanesc
    Nov 14 '18 at 11:43











  • unfortunately PySide2 inherits the same limitations of PySide

    – eyllanesc
    Nov 14 '18 at 11:43











  • So, no news in last years for this issue? In that question the OP is using 'QString' in GenericArgument, and str in the slot (just as I already tried with no success). Any workaround?

    – Roman Rdgz
    Nov 14 '18 at 15:26











  • As they point out in the answer that is a bug, it does not matter if it is QString or str, which still remains in PySide2 and unfortunately there is no workaround

    – eyllanesc
    Nov 14 '18 at 15:35

















  • Possible duplicate of QMetaObject::invokeMethod doesn't find methods with parameters

    – eyllanesc
    Nov 14 '18 at 11:43











  • unfortunately PySide2 inherits the same limitations of PySide

    – eyllanesc
    Nov 14 '18 at 11:43











  • So, no news in last years for this issue? In that question the OP is using 'QString' in GenericArgument, and str in the slot (just as I already tried with no success). Any workaround?

    – Roman Rdgz
    Nov 14 '18 at 15:26











  • As they point out in the answer that is a bug, it does not matter if it is QString or str, which still remains in PySide2 and unfortunately there is no workaround

    – eyllanesc
    Nov 14 '18 at 15:35
















Possible duplicate of QMetaObject::invokeMethod doesn't find methods with parameters

– eyllanesc
Nov 14 '18 at 11:43





Possible duplicate of QMetaObject::invokeMethod doesn't find methods with parameters

– eyllanesc
Nov 14 '18 at 11:43













unfortunately PySide2 inherits the same limitations of PySide

– eyllanesc
Nov 14 '18 at 11:43





unfortunately PySide2 inherits the same limitations of PySide

– eyllanesc
Nov 14 '18 at 11:43













So, no news in last years for this issue? In that question the OP is using 'QString' in GenericArgument, and str in the slot (just as I already tried with no success). Any workaround?

– Roman Rdgz
Nov 14 '18 at 15:26





So, no news in last years for this issue? In that question the OP is using 'QString' in GenericArgument, and str in the slot (just as I already tried with no success). Any workaround?

– Roman Rdgz
Nov 14 '18 at 15:26













As they point out in the answer that is a bug, it does not matter if it is QString or str, which still remains in PySide2 and unfortunately there is no workaround

– eyllanesc
Nov 14 '18 at 15:35





As they point out in the answer that is a bug, it does not matter if it is QString or str, which still remains in PySide2 and unfortunately there is no workaround

– eyllanesc
Nov 14 '18 at 15:35












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53296261%2fusage-of-qgenericargument-q-arg-when-using-invokemethod-in-pyside2%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53296261%2fusage-of-qgenericargument-q-arg-when-using-invokemethod-in-pyside2%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Museum of Modern and Contemporary Art of Trento and Rovereto

In R, how to develop a multiplot heatmap.2 figure showing key labels successfully