I've got a lot of QGroupBox's on a QMainWindow an am showing a QPushbutton in all of them.
The QPushbutton layout is the same in all QGoupBox's, the only difference is the caption and the slot called.
What I'm trying to do is set up a function to construct the QPushButtons.
I'm having trouble getting the returned QPushButton from the function.
This is due to my lack of knowledge of C++!!!
If I call the function, and omit the return statement, it works as expected.
Rather than trying do it this way, would it be more correct to create a class for the QpushButton?
Any help would and advice would be appreciated.
Regards
Code: Select all
Main form:-
myProg::myProg()
myNewButton = showStartButton(G9);
myNewButton->setText("Start");
QObject::connect(myNewButton, SIGNAL(pressed()), this, slot(mySub()));
Code: Select all
header:-
private:
QPushButton *myNewButton, *myButton;
Code: Select all
QPushButton myProg::showStartButton(QWidget *parent)
{
myButton = new QPushButton(parent) ;
myButton->setGeometry(5,
parent->height() - 30,
40,
24);
return(myButton);
}
Code: Select all
Error message:-
could not convert '((myProg*(this)->myProg::myButton' from 'QPushButton*' to 'QPushButton'