Results 1 to 7 of 7

Thread: Linking label mouse info with radio buttons & variables between classes

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Jun 2013
    Posts
    58
    Thanks
    26
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Windows

    Post Re: Linking label mouse info with radio buttons & variables between classes

    Normal variables are created in my_qlabel class (point1, point2, result)
    If radioButton.Checked() saves it to the corresponding array in mainWindow class

    That info is stored in an array(initial point, end point, result)
    same for other radio button(initial point, end point, diffCalculationResult) // stored in a different arrays as the 2 arrays will be written to 2 different files


    Using getters & setters to send variables(my_qlabel) to arrays(mainWindow) as suggested(thanks)

    Please check my code out:
    Correct me where need be(most of it)

    Created getters and setters in my_qlabel class
    Qt Code:
    1. int my_qlabel::getStartPoint()
    2. {
    3. return x1;
    4. }
    5.  
    6. int my_qlabel::getEndPoint()
    7. {
    8. return y1;
    9. }
    10.  
    11.  
    12. int my_qlabel::getOrientation()
    13. {
    14. return theta;
    15. }
    To copy to clipboard, switch view to plain text mode 

    RadioButtons: radioButton_1, radioButton_2

    my connect statement
    Qt Code:
    1. connect(ui->radioButton_1, SIGNAL(clicked()), this, SLOT(getInfo()));
    2. connect(ui->radioButton_1, SIGNAL(clicked()), this, SLOT(getInfo()));
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void Dialog::getInfo()
    2. {
    3. if(ui->radioButton_1->clicked(true))
    4. {
    5. reCounter += 1;
    6. reX[reCounter] = my_qlabel::getStartPoint();
    7. reY[reCounter] = my_qlabel::getEndPoint();
    8. reO[reCounter] = my_qlabel::getOrientation();
    9. radioButton_1->setChecked(false);
    10. }
    11. else if(ui->radioButton_1->clicked(true))
    12. {
    To copy to clipboard, switch view to plain text mode 

    when Build -> 10 errors
    1) QAbstractButton::clicked(bool) is protected
    2)radioButtons 1& 2 not declared -> they are!
    3)error in if statement with regards to radioButton
    4) cannot call member functions of my_qlabel with out object
    Qt Code:
    1. reX[reCounter] = my_qlabel::getStartPoint();
    2. ... in if statement above
    To copy to clipboard, switch view to plain text mode 


    help!
    Last edited by ebsaith; 12th June 2013 at 09:06. Reason: updated contents

Similar Threads

  1. QTableWidget radio buttons
    By Pettson in forum Newbie
    Replies: 4
    Last Post: 15th December 2011, 09:51
  2. Non editable Radio Buttons
    By babu198649 in forum Newbie
    Replies: 9
    Last Post: 11th November 2009, 11:48
  3. Replies: 2
    Last Post: 11th August 2009, 16:01
  4. array of radio buttons
    By amulya in forum Qt Programming
    Replies: 4
    Last Post: 5th October 2006, 12:59
  5. How to get larger radio buttons on XP?
    By Ben.Hines in forum Qt Programming
    Replies: 9
    Last Post: 24th April 2006, 19:00

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.