I want to subclass QPushButton
somefile.h
//--------------------------------------
{
Q_OBJECT
public:
};
somefile.cpp
/*------------------------------------------------------------------------------------*/
{
this->setText(text);
}
/*------------------------------------------------------------------------------------*/
{
}
somefile.h
//--------------------------------------
class Button : public QPushButton
{
Q_OBJECT
public:
Button(QWidget *parent);
Button(const QString &text, QWidget *parent);
};
somefile.cpp
/*------------------------------------------------------------------------------------*/
Button::Button(const QString & text, QWidget * parent = 0 )
{
this->setText(text);
}
/*------------------------------------------------------------------------------------*/
Button::Button(QWidget *parent) : QPushButton(parent)
{
}
To copy to clipboard, switch view to plain text mode
However, I get 'no matching function for call to char[]' errors on code that calls them like this: okButton = new Button("Ok");
How is this done, it should convert the char[] somehow to const QString?
If I call them with okButton = new Button(QString("ok")); I also get the error because of the missing parent.
I'm obviously new at this.
Thanks.
Bookmarks