You have provided no constructor for the class, so the compiler has generated one for you: myButton::myButton(); And it takes no string, which is why it throws an error.
For what you want to happen, you need to provide a constructor which takes a const reference to a QString and in the constructor's implementation pass it along to the base QPushButton class's constructor, like this:
//class declaration (MyButton.h)
{
Q_OBJECT //don't forget this macro, or your signals/slots won't work
public:
virtual ~MyButton();
};
//class implementation (MyButton.cpp)
{
}
MyButton::~MyButton(){}
//class declaration (MyButton.h)
class MyButton : public QPushButton
{
Q_OBJECT //don't forget this macro, or your signals/slots won't work
public:
MyButton(const QString & text, QWidget * parent = 0);
virtual ~MyButton();
};
//class implementation (MyButton.cpp)
MyButton::MyButton(const QString & text, QWidget * parent) : QPushButton(text, parent)
{
}
MyButton::~MyButton(){}
To copy to clipboard, switch view to plain text mode
Bookmarks