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. QLCDnumber, slots, and my own complete loss of mental function...

QLCDnumber, slots, and my own complete loss of mental function...

Scheduled Pinned Locked Moved Unsolved General and Desktop
29 Posts 3 Posters 11.0k 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.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by mrjj
    #20

    Hi

    the Dialog is the controller and
    mainwindow is relayframe

    RelayFrame::RelayFrame(int pin, QWidget *parent) :
        QFrame(parent),
        ui(new Ui::RelayFrame)
    {
        ui->setupUi(this);
    
        controller = new RelayController(pin, 750);
    // connect here !
    
        controller2 = new RelayController(pin,5400000);
    // and HERE too
    
    }
    
    A 1 Reply Last reply
    0
    • mrjjM mrjj

      Hi

      the Dialog is the controller and
      mainwindow is relayframe

      RelayFrame::RelayFrame(int pin, QWidget *parent) :
          QFrame(parent),
          ui(new Ui::RelayFrame)
      {
          ui->setupUi(this);
      
          controller = new RelayController(pin, 750);
      // connect here !
      
          controller2 = new RelayController(pin,5400000);
      // and HERE too
      
      }
      
      A Offline
      A Offline
      Aesgarth
      wrote on last edited by
      #21

      @mrjj

      OK, so i've probably done this wrong, but i have the following errors:

      /home/pi/LampTesterV2/relayframe.cpp:17: error: ‘void RelayController::SetLCD(int)’ is protected within this context
        connect(&RelayController::SetLCD, this, &RelayFrame::SetLCD  );
                                  ^~~~~~
      
      /home/pi/LampTesterV2/relayframe.cpp:17: error: no matching function for call to ‘RelayFrame::connect(void (RelayController::*)(int), RelayFrame*, void (RelayFrame::*)(int))’
        connect(&RelayController::SetLCD, this, &RelayFrame::SetLCD  );
                                                                     ^
      

      in this bit...

      RelayFrame::RelayFrame(int pin, QWidget *parent) :
          QFrame(parent),
          ui(new Ui::RelayFrame)
      {
          ui->setupUi(this);
          //power cycle controller, 750ms delay
          controller = new RelayController(pin, 750);
      	connect(&RelayController::SetLCD, this, &RelayFrame::SetLCD  );
          //heat cycle controller, 2 hour (5400000ms) delay
          controller2 = new RelayController(pin,5400000);
      	connect(&RelayController::SetLCD, this, &RelayFrame::SetLCD  );
      }
      
      

      which doesn't look right to me anyway as i have the exact same thing twice...

      mrjjM 1 Reply Last reply
      0
      • A Aesgarth

        @mrjj

        OK, so i've probably done this wrong, but i have the following errors:

        /home/pi/LampTesterV2/relayframe.cpp:17: error: ‘void RelayController::SetLCD(int)’ is protected within this context
          connect(&RelayController::SetLCD, this, &RelayFrame::SetLCD  );
                                    ^~~~~~
        
        /home/pi/LampTesterV2/relayframe.cpp:17: error: no matching function for call to ‘RelayFrame::connect(void (RelayController::*)(int), RelayFrame*, void (RelayFrame::*)(int))’
          connect(&RelayController::SetLCD, this, &RelayFrame::SetLCD  );
                                                                       ^
        

        in this bit...

        RelayFrame::RelayFrame(int pin, QWidget *parent) :
            QFrame(parent),
            ui(new Ui::RelayFrame)
        {
            ui->setupUi(this);
            //power cycle controller, 750ms delay
            controller = new RelayController(pin, 750);
        	connect(&RelayController::SetLCD, this, &RelayFrame::SetLCD  );
            //heat cycle controller, 2 hour (5400000ms) delay
            controller2 = new RelayController(pin,5400000);
        	connect(&RelayController::SetLCD, this, &RelayFrame::SetLCD  );
        }
        
        

        which doesn't look right to me anyway as i have the exact same thing twice...

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #22

        @Aesgarth

        ahh c+11

        change
        signals:
        to public signals:

        i think

        A 1 Reply Last reply
        0
        • mrjjM mrjj

          @Aesgarth

          ahh c+11

          change
          signals:
          to public signals:

          i think

          A Offline
          A Offline
          Aesgarth
          wrote on last edited by Aesgarth
          #23

          @mrjj

          That considerably reduced the error count, however....

          /usr/include/qt4/QtCore/qobjectdefs.h:69: error: expected ‘:’ before ‘protected’
           #   define signals protected
                              ^
          
          /home/pi/LampTesterV2/relaycontroller.h:47: in expansion of macro ‘signals’
           public signals:
                  ^~~~~~~
          

          Edited to include the next line.

          mrjjM 1 Reply Last reply
          0
          • A Aesgarth

            @mrjj

            That considerably reduced the error count, however....

            /usr/include/qt4/QtCore/qobjectdefs.h:69: error: expected ‘:’ before ‘protected’
             #   define signals protected
                                ^
            
            /home/pi/LampTesterV2/relaycontroller.h:47: in expansion of macro ‘signals’
             public signals:
                    ^~~~~~~
            

            Edited to include the next line.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #24

            @Aesgarth

            please look at sample. should be the same.

            A 1 Reply Last reply
            0
            • mrjjM mrjj

              @Aesgarth

              please look at sample. should be the same.

              A Offline
              A Offline
              Aesgarth
              wrote on last edited by
              #25

              @mrjj

              I think the problem is with how i'm trying to connect the 2 - since using public signals: i get the same error with the connect lines commented out, but just using signals: (as per the example) works until i try to connect the signal and slot...

              does this look right?
              connect(&RelayController::SetLCD, this, &RelayFrame::SetLCD);

              A 1 Reply Last reply
              0
              • A Aesgarth

                @mrjj

                I think the problem is with how i'm trying to connect the 2 - since using public signals: i get the same error with the connect lines commented out, but just using signals: (as per the example) works until i try to connect the signal and slot...

                does this look right?
                connect(&RelayController::SetLCD, this, &RelayFrame::SetLCD);

                A Offline
                A Offline
                Aesgarth
                wrote on last edited by
                #26

                OK... i'm totally convinced the above is not right as i should be trying to connect the signal from controller or controller2 to the slot in RelayFrame, rather than the signal from RelayController...

                mrjjM 1 Reply Last reply
                0
                • A Aesgarth

                  OK... i'm totally convinced the above is not right as i should be trying to connect the signal from controller or controller2 to the slot in RelayFrame, rather than the signal from RelayController...

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #27

                  @Aesgarth
                  you miss the first part
                  connect(controller, &RelayController::SetLCD, this, &RelayFrame::SetLCD);
                  and
                  connect(controller2, &RelayController::SetLCD, this, &RelayFrame::SetLCD);

                  the syntax is

                  connect ( pointer to object, function address , pointer to object, function address )

                  (unless you are using lambdas)

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    Aesgarth
                    wrote on last edited by
                    #28

                    Thanks, that looks better but i'm back to

                    /home/pi/LampTesterV2/relayframe.cpp:17: error: ‘void RelayController::SetLCD(int)’ is protected within this context
                      connect(&RelayController::SetLCD, this, &RelayFrame::SetLCD  );
                                                ^~~~~~
                    
                    /home/pi/LampTesterV2/relayframe.cpp:17: error: no matching function for call to ‘RelayFrame::connect(void (RelayController::*)(int), RelayFrame*, void (RelayFrame::*)(int))’
                      connect(&RelayController::SetLCD, this, &RelayFrame::SetLCD  );
                                                                                   ^
                    

                    And i only have access to the device for the next hour, so... I think i'll have a bit of a practice at home over Christmas and see if i can improve any, and come back to this next year. Thanks for all the help @mrjj and @J.Hilk

                    mrjjM 1 Reply Last reply
                    0
                    • A Aesgarth

                      Thanks, that looks better but i'm back to

                      /home/pi/LampTesterV2/relayframe.cpp:17: error: ‘void RelayController::SetLCD(int)’ is protected within this context
                        connect(&RelayController::SetLCD, this, &RelayFrame::SetLCD  );
                                                  ^~~~~~
                      
                      /home/pi/LampTesterV2/relayframe.cpp:17: error: no matching function for call to ‘RelayFrame::connect(void (RelayController::*)(int), RelayFrame*, void (RelayFrame::*)(int))’
                        connect(&RelayController::SetLCD, this, &RelayFrame::SetLCD  );
                                                                                     ^
                      

                      And i only have access to the device for the next hour, so... I think i'll have a bit of a practice at home over Christmas and see if i can improve any, and come back to this next year. Thanks for all the help @mrjj and @J.Hilk

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #29

                      Hi
                      i think it says your RelayController::SetLCD is PROTECTED and not public.
                      Since you are in another class, you cant use a protected member.

                      Ok. we nail it in 2018 ;)

                      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