Problem with new connect syntax

  • Hello,

    Here is the new syntax :

    @ QObject::connect(m_actionAbout, &QAction::triggered,
    qApp, &QApplication::aboutQt);@

    But dsnt work :/

    @FenPrincipale.cpp:69: erreur : C2664: 'QMetaObject::Connection QObject::connect(const QObject *,const char *,const QObject *,const char ,Qt::ConnectionType)' : cannot convert parameter 2 from 'void (__thiscall QAction:: )(bool)' to 'const char *'
    There is no context in which this conversion is possible@

    Can you help ? thanks

  • QAction::triggered has an additional bool parameter, QApplication::aboutQt not.

    <code>QObject::connect(m_actionAbout, &QAction::triggered, { qApp->aboutQt(); });</code>

  • Beware that such a lambda construct isn't a real connection between QObjects, right? So things like sender() or connectNotify() won't work. (And even a disconnect?)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.