Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. French
  4. Utiliser une commande lambda avec connect
QtWS25 Last Chance

Utiliser une commande lambda avec connect

Scheduled Pinned Locked Moved Solved French
connect problemlambda
9 Posts 4 Posters 1.2k Views
  • 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.
  • F Offline
    F Offline
    Futuray Programming
    wrote on 19 Feb 2023, 10:46 last edited by
    #1

    Bonjour,
    j'essaye d'utiliser un QOject::connect pour modifier une variable de type int :

    QObject::connect(bouton, SIGNAL(clicked()), this, [this](){
      variable++;
    });
    

    Or, cela me sort plusieurs erreurs :

    no matching function for call to ‘OptionMenuView::connect(QPushButton*&, const char*, vue*, vue::vue(QWidget*)::<lambda(int)>)’
          |     });
          |      ^
    

    et

    erreur : no type named ‘Object’ in ‘struct QtPrivate::FunctionPointer<OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)> >’
    In file included from /home/-/Qt/6.4.1/gcc_64/include/QtWidgets/qgraphicsitem.h:8,
                     from /home/-/Qt/6.4.1/gcc_64/include/QtWidgets/QGraphicsItem:1,
                     from /home/-/-/rpg/main/optionmenuview.h:4,
                     from /home/-/-/rpg/main/optionmenuview.cpp:1:
    /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:181:36: note: candidate: ‘static QMetaObject::Connection QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)’
      181 |     static QMetaObject::Connection connect(const QObject *sender, const char *signal,
          |                                    ^~~~~~~
    /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:182:62: note:   no known conversion for argument 4 from ‘OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)>’ to ‘const char*’
      182 |                         const QObject *receiver, const char *member, Qt::ConnectionType = Qt::AutoConnection);
          |                                                  ~~~~~~~~~~~~^~~~~~
    /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:184:36: note: candidate: ‘static QMetaObject::Connection QObject::connect(const QObject*, const QMetaMethod&, const QObject*, const QMetaMethod&, Qt::ConnectionType)’
      184 |     static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal,
          |                                    ^~~~~~~
    /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:184:86: note:   no known conversion for argument 2 from ‘const char*’ to ‘const QMetaMethod&’
      184 |     static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal,
          |                                                                   ~~~~~~~~~~~~~~~~~~~^~~~~~
    /home/sit/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:432:32: note: candidate: ‘QMetaObject::Connection QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const’
      432 | inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal,
          |                                ^~~~~~~
    /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:433:57: note:   no known conversion for argument 3 from ‘OptionMenuView*’ to ‘const char*’
      433 |                                             const char *amember, Qt::ConnectionType atype) const
          |                                             ~~~~~~~~~~~~^~~~~~~
    /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:201:43: note: candidate: ‘template<class Func1, class Func2> static QMetaObject::Connection QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const typename QtPrivate::FunctionPointer<Func2>::Object*, Func2, Qt::ConnectionType)’
      201 |     static inline QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,
          |                                           ^~~~~~~
    /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:201:43: note:   template argument deduction/substitution failed:
    /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h: In substitution of ‘template<class Func1, class Func2> static QMetaObject::Connection QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const typename QtPrivate::FunctionPointer<Func2>::Object*, Func2, Qt::ConnectionType) [with Func1 = const char*; Func2 = OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)>]’:
    /home/-/nicolas/rpg/main/optionmenuview.cpp:33:6:   required from here
    /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:201:43: error: no type named ‘Object’ in ‘struct QtPrivate::FunctionPointer<OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)> >’
    /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:233:13: note: candidate: ‘template<class Func1, class Func2> static typename std::enable_if<((int)(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0), QMetaObject::Connection>::type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2)’
      233 |             connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot)
          |             ^~~~~~~
    /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:233:13: note:   template argument deduction/substitution failed:
    /home/-/-/-/main/optionmenuview.cpp:33:6: note:   candidate expects 3 arguments, 4 provided
          |     });
          |      ^
    

    et encore 2 autres très similaires.
    Si quelqu'un peut m'aider, je le remercie d'avance.

    M J 2 Replies Last reply 19 Feb 2023, 11:19
    0
    • F Futuray Programming marked this topic as a regular topic on 19 Feb 2023, 10:46
    • F Futuray Programming marked this topic as a question on 19 Feb 2023, 10:46
    • F Futuray Programming
      19 Feb 2023, 10:46

      Bonjour,
      j'essaye d'utiliser un QOject::connect pour modifier une variable de type int :

      QObject::connect(bouton, SIGNAL(clicked()), this, [this](){
        variable++;
      });
      

      Or, cela me sort plusieurs erreurs :

      no matching function for call to ‘OptionMenuView::connect(QPushButton*&, const char*, vue*, vue::vue(QWidget*)::<lambda(int)>)’
            |     });
            |      ^
      

      et

      erreur : no type named ‘Object’ in ‘struct QtPrivate::FunctionPointer<OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)> >’
      In file included from /home/-/Qt/6.4.1/gcc_64/include/QtWidgets/qgraphicsitem.h:8,
                       from /home/-/Qt/6.4.1/gcc_64/include/QtWidgets/QGraphicsItem:1,
                       from /home/-/-/rpg/main/optionmenuview.h:4,
                       from /home/-/-/rpg/main/optionmenuview.cpp:1:
      /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:181:36: note: candidate: ‘static QMetaObject::Connection QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)’
        181 |     static QMetaObject::Connection connect(const QObject *sender, const char *signal,
            |                                    ^~~~~~~
      /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:182:62: note:   no known conversion for argument 4 from ‘OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)>’ to ‘const char*’
        182 |                         const QObject *receiver, const char *member, Qt::ConnectionType = Qt::AutoConnection);
            |                                                  ~~~~~~~~~~~~^~~~~~
      /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:184:36: note: candidate: ‘static QMetaObject::Connection QObject::connect(const QObject*, const QMetaMethod&, const QObject*, const QMetaMethod&, Qt::ConnectionType)’
        184 |     static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal,
            |                                    ^~~~~~~
      /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:184:86: note:   no known conversion for argument 2 from ‘const char*’ to ‘const QMetaMethod&’
        184 |     static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal,
            |                                                                   ~~~~~~~~~~~~~~~~~~~^~~~~~
      /home/sit/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:432:32: note: candidate: ‘QMetaObject::Connection QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const’
        432 | inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal,
            |                                ^~~~~~~
      /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:433:57: note:   no known conversion for argument 3 from ‘OptionMenuView*’ to ‘const char*’
        433 |                                             const char *amember, Qt::ConnectionType atype) const
            |                                             ~~~~~~~~~~~~^~~~~~~
      /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:201:43: note: candidate: ‘template<class Func1, class Func2> static QMetaObject::Connection QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const typename QtPrivate::FunctionPointer<Func2>::Object*, Func2, Qt::ConnectionType)’
        201 |     static inline QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,
            |                                           ^~~~~~~
      /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:201:43: note:   template argument deduction/substitution failed:
      /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h: In substitution of ‘template<class Func1, class Func2> static QMetaObject::Connection QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const typename QtPrivate::FunctionPointer<Func2>::Object*, Func2, Qt::ConnectionType) [with Func1 = const char*; Func2 = OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)>]’:
      /home/-/nicolas/rpg/main/optionmenuview.cpp:33:6:   required from here
      /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:201:43: error: no type named ‘Object’ in ‘struct QtPrivate::FunctionPointer<OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)> >’
      /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:233:13: note: candidate: ‘template<class Func1, class Func2> static typename std::enable_if<((int)(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0), QMetaObject::Connection>::type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2)’
        233 |             connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot)
            |             ^~~~~~~
      /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:233:13: note:   template argument deduction/substitution failed:
      /home/-/-/-/main/optionmenuview.cpp:33:6: note:   candidate expects 3 arguments, 4 provided
            |     });
            |      ^
      

      et encore 2 autres très similaires.
      Si quelqu'un peut m'aider, je le remercie d'avance.

      J Offline
      J Offline
      JonB
      wrote on 19 Feb 2023, 11:20 last edited by JonB
      #3

      @Futuray-Programming
      On ne peut pas avoir SIGNAL/SLOT() macros avec le connect() moderne qui permet un lambda:

      QObject::connect(bouton, &QPushButton::clicked, this, [this](){
      

      Ne utilisez plus le syntaxe ancien avec les macros.
      N'utilisez plus l'ancienne syntaxe avec les macros.

      M 1 Reply Last reply 19 Feb 2023, 11:35
      3
      • F Futuray Programming
        19 Feb 2023, 10:46

        Bonjour,
        j'essaye d'utiliser un QOject::connect pour modifier une variable de type int :

        QObject::connect(bouton, SIGNAL(clicked()), this, [this](){
          variable++;
        });
        

        Or, cela me sort plusieurs erreurs :

        no matching function for call to ‘OptionMenuView::connect(QPushButton*&, const char*, vue*, vue::vue(QWidget*)::<lambda(int)>)’
              |     });
              |      ^
        

        et

        erreur : no type named ‘Object’ in ‘struct QtPrivate::FunctionPointer<OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)> >’
        In file included from /home/-/Qt/6.4.1/gcc_64/include/QtWidgets/qgraphicsitem.h:8,
                         from /home/-/Qt/6.4.1/gcc_64/include/QtWidgets/QGraphicsItem:1,
                         from /home/-/-/rpg/main/optionmenuview.h:4,
                         from /home/-/-/rpg/main/optionmenuview.cpp:1:
        /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:181:36: note: candidate: ‘static QMetaObject::Connection QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)’
          181 |     static QMetaObject::Connection connect(const QObject *sender, const char *signal,
              |                                    ^~~~~~~
        /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:182:62: note:   no known conversion for argument 4 from ‘OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)>’ to ‘const char*’
          182 |                         const QObject *receiver, const char *member, Qt::ConnectionType = Qt::AutoConnection);
              |                                                  ~~~~~~~~~~~~^~~~~~
        /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:184:36: note: candidate: ‘static QMetaObject::Connection QObject::connect(const QObject*, const QMetaMethod&, const QObject*, const QMetaMethod&, Qt::ConnectionType)’
          184 |     static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal,
              |                                    ^~~~~~~
        /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:184:86: note:   no known conversion for argument 2 from ‘const char*’ to ‘const QMetaMethod&’
          184 |     static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal,
              |                                                                   ~~~~~~~~~~~~~~~~~~~^~~~~~
        /home/sit/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:432:32: note: candidate: ‘QMetaObject::Connection QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const’
          432 | inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal,
              |                                ^~~~~~~
        /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:433:57: note:   no known conversion for argument 3 from ‘OptionMenuView*’ to ‘const char*’
          433 |                                             const char *amember, Qt::ConnectionType atype) const
              |                                             ~~~~~~~~~~~~^~~~~~~
        /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:201:43: note: candidate: ‘template<class Func1, class Func2> static QMetaObject::Connection QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const typename QtPrivate::FunctionPointer<Func2>::Object*, Func2, Qt::ConnectionType)’
          201 |     static inline QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,
              |                                           ^~~~~~~
        /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:201:43: note:   template argument deduction/substitution failed:
        /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h: In substitution of ‘template<class Func1, class Func2> static QMetaObject::Connection QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const typename QtPrivate::FunctionPointer<Func2>::Object*, Func2, Qt::ConnectionType) [with Func1 = const char*; Func2 = OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)>]’:
        /home/-/nicolas/rpg/main/optionmenuview.cpp:33:6:   required from here
        /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:201:43: error: no type named ‘Object’ in ‘struct QtPrivate::FunctionPointer<OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)> >’
        /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:233:13: note: candidate: ‘template<class Func1, class Func2> static typename std::enable_if<((int)(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0), QMetaObject::Connection>::type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2)’
          233 |             connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot)
              |             ^~~~~~~
        /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:233:13: note:   template argument deduction/substitution failed:
        /home/-/-/-/main/optionmenuview.cpp:33:6: note:   candidate expects 3 arguments, 4 provided
              |     });
              |      ^
        

        et encore 2 autres très similaires.
        Si quelqu'un peut m'aider, je le remercie d'avance.

        M Offline
        M Offline
        mpergand
        wrote on 19 Feb 2023, 11:19 last edited by
        #2

        @Futuray-Programming said in Utiliser une commande lambda avec connect:

        QObject::connect(bouton, SIGNAL(clicked()), this, this{
        variable++;
        });

        Essaye avec la nouvelle syntaxe:

        connect(bouton, &QPushButton::clicked, this, [this](){
          variable++;
        });
        
        1 Reply Last reply
        2
        • F Futuray Programming
          19 Feb 2023, 10:46

          Bonjour,
          j'essaye d'utiliser un QOject::connect pour modifier une variable de type int :

          QObject::connect(bouton, SIGNAL(clicked()), this, [this](){
            variable++;
          });
          

          Or, cela me sort plusieurs erreurs :

          no matching function for call to ‘OptionMenuView::connect(QPushButton*&, const char*, vue*, vue::vue(QWidget*)::<lambda(int)>)’
                |     });
                |      ^
          

          et

          erreur : no type named ‘Object’ in ‘struct QtPrivate::FunctionPointer<OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)> >’
          In file included from /home/-/Qt/6.4.1/gcc_64/include/QtWidgets/qgraphicsitem.h:8,
                           from /home/-/Qt/6.4.1/gcc_64/include/QtWidgets/QGraphicsItem:1,
                           from /home/-/-/rpg/main/optionmenuview.h:4,
                           from /home/-/-/rpg/main/optionmenuview.cpp:1:
          /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:181:36: note: candidate: ‘static QMetaObject::Connection QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)’
            181 |     static QMetaObject::Connection connect(const QObject *sender, const char *signal,
                |                                    ^~~~~~~
          /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:182:62: note:   no known conversion for argument 4 from ‘OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)>’ to ‘const char*’
            182 |                         const QObject *receiver, const char *member, Qt::ConnectionType = Qt::AutoConnection);
                |                                                  ~~~~~~~~~~~~^~~~~~
          /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:184:36: note: candidate: ‘static QMetaObject::Connection QObject::connect(const QObject*, const QMetaMethod&, const QObject*, const QMetaMethod&, Qt::ConnectionType)’
            184 |     static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal,
                |                                    ^~~~~~~
          /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:184:86: note:   no known conversion for argument 2 from ‘const char*’ to ‘const QMetaMethod&’
            184 |     static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal,
                |                                                                   ~~~~~~~~~~~~~~~~~~~^~~~~~
          /home/sit/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:432:32: note: candidate: ‘QMetaObject::Connection QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const’
            432 | inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal,
                |                                ^~~~~~~
          /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:433:57: note:   no known conversion for argument 3 from ‘OptionMenuView*’ to ‘const char*’
            433 |                                             const char *amember, Qt::ConnectionType atype) const
                |                                             ~~~~~~~~~~~~^~~~~~~
          /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:201:43: note: candidate: ‘template<class Func1, class Func2> static QMetaObject::Connection QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const typename QtPrivate::FunctionPointer<Func2>::Object*, Func2, Qt::ConnectionType)’
            201 |     static inline QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,
                |                                           ^~~~~~~
          /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:201:43: note:   template argument deduction/substitution failed:
          /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h: In substitution of ‘template<class Func1, class Func2> static QMetaObject::Connection QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const typename QtPrivate::FunctionPointer<Func2>::Object*, Func2, Qt::ConnectionType) [with Func1 = const char*; Func2 = OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)>]’:
          /home/-/nicolas/rpg/main/optionmenuview.cpp:33:6:   required from here
          /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:201:43: error: no type named ‘Object’ in ‘struct QtPrivate::FunctionPointer<OptionMenuView::OptionMenuView(QWidget*)::<lambda(int)> >’
          /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:233:13: note: candidate: ‘template<class Func1, class Func2> static typename std::enable_if<((int)(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0), QMetaObject::Connection>::type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2)’
            233 |             connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot)
                |             ^~~~~~~
          /home/-/Qt/6.4.1/gcc_64/include/QtCore/qobject.h:233:13: note:   template argument deduction/substitution failed:
          /home/-/-/-/main/optionmenuview.cpp:33:6: note:   candidate expects 3 arguments, 4 provided
                |     });
                |      ^
          

          et encore 2 autres très similaires.
          Si quelqu'un peut m'aider, je le remercie d'avance.

          J Offline
          J Offline
          JonB
          wrote on 19 Feb 2023, 11:20 last edited by JonB
          #3

          @Futuray-Programming
          On ne peut pas avoir SIGNAL/SLOT() macros avec le connect() moderne qui permet un lambda:

          QObject::connect(bouton, &QPushButton::clicked, this, [this](){
          

          Ne utilisez plus le syntaxe ancien avec les macros.
          N'utilisez plus l'ancienne syntaxe avec les macros.

          M 1 Reply Last reply 19 Feb 2023, 11:35
          3
          • J JonB
            19 Feb 2023, 11:20

            @Futuray-Programming
            On ne peut pas avoir SIGNAL/SLOT() macros avec le connect() moderne qui permet un lambda:

            QObject::connect(bouton, &QPushButton::clicked, this, [this](){
            

            Ne utilisez plus le syntaxe ancien avec les macros.
            N'utilisez plus l'ancienne syntaxe avec les macros.

            M Offline
            M Offline
            mpergand
            wrote on 19 Feb 2023, 11:35 last edited by mpergand
            #4

            @JonB said in Utiliser une commande lambda avec connect:

            Ne utilisez plus le syntaxe ancien avec les macros.

            En bon français:
            N'utilisez plus l'ancienne syntaxe avec les macros.
            :)

            J 1 Reply Last reply 19 Feb 2023, 12:48
            1
            • M mpergand
              19 Feb 2023, 11:35

              @JonB said in Utiliser une commande lambda avec connect:

              Ne utilisez plus le syntaxe ancien avec les macros.

              En bon français:
              N'utilisez plus l'ancienne syntaxe avec les macros.
              :)

              J Offline
              J Offline
              JonB
              wrote on 19 Feb 2023, 12:48 last edited by
              #5

              @mpergand Soupir :) Merci, je l'ai corrigé

              1 Reply Last reply
              0
              • F Offline
                F Offline
                Futuray Programming
                wrote on 20 Feb 2023, 07:23 last edited by Futuray Programming
                #6

                Ah oui, en effet, je ne connaissais pas la nouvelle syntaxe.
                Je vais mètre à jour tout le code du coup.
                👍

                M 1 Reply Last reply 21 Feb 2023, 00:39
                1
                • F Futuray Programming
                  20 Feb 2023, 07:23

                  Ah oui, en effet, je ne connaissais pas la nouvelle syntaxe.
                  Je vais mètre à jour tout le code du coup.
                  👍

                  M Offline
                  M Offline
                  mpergand
                  wrote on 21 Feb 2023, 00:39 last edited by
                  #7

                  @Futuray-Programming said in Utiliser une commande lambda avec connect:

                  Je vais mètre à jour tout le code du coup.

                  Combien de mètres de code ? :)

                  F 1 Reply Last reply 21 Feb 2023, 09:30
                  0
                  • M mpergand
                    21 Feb 2023, 00:39

                    @Futuray-Programming said in Utiliser une commande lambda avec connect:

                    Je vais mètre à jour tout le code du coup.

                    Combien de mètres de code ? :)

                    F Offline
                    F Offline
                    Futuray Programming
                    wrote on 21 Feb 2023, 09:30 last edited by
                    #8

                    @mpergand Ah, oui oups...
                    😑

                    1 Reply Last reply
                    0
                    • F Futuray Programming has marked this topic as solved on 21 Feb 2023, 13:54
                    • GrecKoG Offline
                      GrecKoG Offline
                      GrecKo
                      Qt Champions 2018
                      wrote on 27 Feb 2023, 11:17 last edited by
                      #9

                      Nouvelle syntaxe qui a 10 ans pour info ;)

                      1 Reply Last reply
                      0

                      1/9

                      19 Feb 2023, 10:46

                      • Login

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