Hi,
i have a base class like this.
ui_calib_base.h
namespace Ui {
class ui_calib_base;
}
class ui_calib_base
: public QWidget{
Q_OBJECT
public:
explicit ui_calib_base
(QWidget *parent
= 0);
~ui_calib_base();
protected:
Ui::ui_calib_base *ui;
}
namespace Ui {
class ui_calib_base;
}
class ui_calib_base : public QWidget
{
Q_OBJECT
public:
explicit ui_calib_base(QWidget *parent = 0);
~ui_calib_base();
protected:
Ui::ui_calib_base *ui;
}
To copy to clipboard, switch view to plain text mode
ui_calib_base.cpp
ui_calib_base
::ui_calib_base(QWidget *parent
) : QWidget(parent
), ui
(new Ui
::ui_calib_base){
ui->setupUi(this);
ui->tabWidget->setCurrentIndex(0);
}
ui_calib_base::ui_calib_base(QWidget *parent) : QWidget(parent), ui(new Ui::ui_calib_base)
{
ui->setupUi(this);
ui->tabWidget->setCurrentIndex(0);
}
To copy to clipboard, switch view to plain text mode
I have moved the ui pointer to protected.
My derived class looks like this:
calib_analog.h
#include <QObject>
#include <QWidget>
#include <ui/ui_calib_base.h>
class calib_analog : public ui_calib_base
{
Q_OBJECT
public:
explicit calib_analog
(QWidget *parent
= 0);
signals:
public slots:
};
#include <QObject>
#include <QWidget>
#include <ui/ui_calib_base.h>
class calib_analog : public ui_calib_base
{
Q_OBJECT
public:
explicit calib_analog(QWidget *parent = 0);
signals:
public slots:
};
To copy to clipboard, switch view to plain text mode
calib_analog.cpp
#include "calib_analog.h"
calib_analog
::calib_analog(QWidget *parent
) : ui_calib_base
(parent
){
ui->tabWidget->setCurrentIndex(0); // this gives the error
}
#include "calib_analog.h"
calib_analog::calib_analog(QWidget *parent) : ui_calib_base(parent)
{
ui->tabWidget->setCurrentIndex(0); // this gives the error
}
To copy to clipboard, switch view to plain text mode
I'm not able to get access to the ui pointer in my derived class. I got the error
"invalid use of incomplete type 'class Ui::ui_calib_base'
forward declaration of 'class Ui::ui_calib_base'
I have move the ui pointer to protected, but have no access to it in my derived class? What i'm doing wrong?
Thx
Bookmarks