Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with new connect syntax
Forum Updated to NodeBB v4.3 + New Features

Problem with new connect syntax

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nostrora
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

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

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

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DerManu
        wrote on last edited by
        #3

        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?)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved