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. Qt4 lambda slot
Forum Updated to NodeBB v4.3 + New Features

Qt4 lambda slot

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 997 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by SPlatten
    #1

    I am working for a client that is using a very old version of Qt 4.8. I have put forward a case for upgrading, however it remains to be seen if this will happen.

    In the mean time I have to modify and update this very old source. I want to implement a lambda connection, I'm not sure if this is even possible with this version:

    QObject::connect(this, SIGNAL(error(const char*)), [this](const char* cpszMsg) {
        perror(cpszMsg);
        QApplication::quit();
        exit(-1);
    });
    

    When I try to build this I get:

    no matching function for call to 'clsMainWnd::connect(clsMainWnd* const, const char*, clsMainWnd::clsMainWnd(int, char**, QWidget*)::<lambda(const char*)>)'
    

    I also tried:

    QObject::connect(this, &clsMainWnd::error, [this](const char* cpszMsg) {
        perror(cpszMsg);
        QApplication::quit();
        exit(-1);
    });
    

    Same result

    Kind Regards,
    Sy

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by Christian Ehrlicher
      #2

      Qt4 does not support the new signal/slot syntax.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      SPlattenS 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        Qt4 does not support the new signal/slot syntax.

        SPlattenS Offline
        SPlattenS Offline
        SPlatten
        wrote on last edited by
        #3

        @Christian-Ehrlicher , thats what I was afraid of.

        Kind Regards,
        Sy

        Christian EhrlicherC 1 Reply Last reply
        0
        • SPlattenS SPlatten

          @Christian-Ehrlicher , thats what I was afraid of.

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @SPlatten said in Qt4 lambda slot:

          thats what I was afraid of.

          Reading the documentation would have helped to ask. But documentation is bad ... I know.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          SPlattenS 1 Reply Last reply
          2
          • Christian EhrlicherC Christian Ehrlicher

            @SPlatten said in Qt4 lambda slot:

            thats what I was afraid of.

            Reading the documentation would have helped to ask. But documentation is bad ... I know.

            SPlattenS Offline
            SPlattenS Offline
            SPlatten
            wrote on last edited by
            #5

            @Christian-Ehrlicher , I tried google before posting, couldn't see an absolute answer...I just don't understand why large companies still allow themselves to fall into this obsolete trap.

            Kind Regards,
            Sy

            JonBJ 1 Reply Last reply
            0
            • SPlattenS SPlatten

              @Christian-Ehrlicher , I tried google before posting, couldn't see an absolute answer...I just don't understand why large companies still allow themselves to fall into this obsolete trap.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @SPlatten
              The standard page for this is New Signal Slot Syntax whose first sentence is

              This page was used to describe the new signal and slot syntax during its development. The feature is now released with Qt 5.

              fall into this obsolete trap.

              What "obsolete" do you mean? The new syntax was an addition at Qt5.

              1 Reply Last reply
              2

              • Login

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