Witam,
Zamieszam częściowy kod w QT , mam problem gdy staram się uruchomić program kompilator wyrzuca mi taki o to błąd:
C:\Test_oryginal\test\test.cpp:30: błąd: cannot allocate an object of abstract type 'WidgetWithBackground'
bar = new WidgetWithBackground(widget);
^
class WidgetWithBackground : public QWidget
{
public:
WidgetWithBackground(QWidget * parent = 0);
virtual ~WidgetWithBackground ();
protected:
virtual void paintBackground(QPainter & painter) = 0;
class WidgetWithBackground;
class TestWidget : public QMainWindow, private Ui::TestForm
{
Q_OBJECT
public:
TestWidget(QMainWindow *parent = 0);
void initialize();
void connections();
public slots:
void ComboBoxChoiceChanged(int index );
void SpinBoxValueChanged(double val);
private slots:
void on_tab_destroyed();
void on_stackedWidget_destroyed();
private:
void closeEvent ( QCloseEvent * e );
QTabWidget *tabWidget;
WidgetWithBackground *bar;
};
I w tym momencie wyrzuca mi błąd:
QWidget * widget = stackedWidget->widget(0);
widget = stackedWidget->widget(0);
bar = new WidgetWithBackground(widget);//dokladnie w tym miejscu
bar->setValueFont(font());
bar->resize(120,120);
QLayout * layout = new QVBoxLayout();
layout->addWidget(bar);
widget->setLayout(layout);