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. Qt5.3 Signal and Slots + Parameters
Forum Updated to NodeBB v4.3 + New Features

Qt5.3 Signal and Slots + Parameters

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 831 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.
  • I Offline
    I Offline
    ion_knight
    wrote on last edited by
    #1

    Ok having a bit of problems with connecting two parts of my program together firstly we have below the emitted signal being used (which i presume is correct).

    @CCTVForm * lCCTVForm = fFormController->getGUIForm();
    const uint8_t * lLCID = aLCID.value();

        *lCCTVForm << "LC Select - Check\r\n"
                   << "\tSequence Number: " << static_cast< int >(aSequenceNumber.value()) << "\r\n"
                   << "\tLCID: " << static_cast< int >(lLCID[0])
                                 << static_cast< int >(lLCID[1])
                                 << static_cast< int >(lLCID[2])
                                 << static_cast< int >(lLCID[3])
                                 << "\r\n"
                   << "\tLC Name: " << aName << "\r\n" 
                   << "\tCamera 1: " << aCamera1.lcid().id() << "\r\n"
                   << "\tCamera 2: " << aCamera2.lcid().id() << "\r\n"
                   << sendToForm;
    
        emit emit_camera_info(aCamera1.lcid().id(),aCamera2.lcid().id());@
    

    Inside the .hpp file
    @signals:
    void emit_camera_info(QString,QString);@

    Then on my cctv form I want to be able to pass the two camera LCID's to CCTVForm.

    @ // Create the widgets
    cctv_mplayer_wrapper *Cameras = new cctv_mplayer_wrapper();

    // Add to the form
    centralWidget()->layout()->addWidget(Cameras);
    CCTVController *Control = new CCTVController();
    
        QObject::connect(Control,&CCTVController::emit_camera_info(QString,QString),
                     this,&CCTVForm::update_camera_info(QString,QString));
    

    //
    //
    Cameras->set_rtsp_path_cam_1("rtsp://169.254.133.191/output");
    Cameras->set_rtsp_path_cam_2("rtsp://169.254.133.193/output");
    Cameras->start_mplayer();@

    .hpp file
    @void update_camera_info(QString Camera1, QString Camera2);@

    It's currently failing with
    bq. C:\Software\lxc - Copy\cctv\src\cctv_form.cpp:274: error: expected primary-expression before ',' token
    QObject::connect(Control,&CCTVController::emit_camera_info(QString,QString),this,&CCTVForm::update_camera_info(QString,QString));

    As you can imagine I'm a bit lost on this as it seems to me to be a correct connect statement. If anyone has an idea how this is caused I would be very grateful.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      t3685
      wrote on last edited by
      #2

      Hi,

      You are mixing up the two syntaxes to connect signals and slots.

      The first form uses macros and needs function parameters:

      @QObject::connect(&a, SIGNAL(valueChanged(int)),&b, SLOT(setValue(int)));@

      The second form uses pointer to member functions and doesn't parameters:

      @ QObject::connect(&a, &Counter::valueChanged,&b, &Counter::setValue);@

      Good luck!

      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