I have some difficulties to create my UI.
What I need :
1 QTabWidget with 3 QWidget as tabs. One of these Widget contains QPushButtons, QLineEdits, and have to contain another QTabWidget.
My problem :
Where I've sucess on my other QTabWidget, this one is not appearing. I've manually put QPushButton and QLineEdit in the .ui file. Now I want to dynamically create a QTabWidget on this same page.
My page code :
namespace Ui
{
class cImageInterface;
}
class cImageInterface : public QWidget
{
Q_OBJECT
public:
cImageInterface();
~cImageInterface();
private:
Ui::cImageInterface* ui;
cAppTabWidget* tabW_Application;
};
Constructor :
cImageInterface::cImageInterface() : ui(new Ui::cImageInterface)
{
tabW_Application = new cAppTabWidget(this);
ui->setupUi(this);
}
QTabWidget code :
class cAppTabWidget : public QTabWidget
{
Q_OBJECT
public:
explicit cAppTabWidget(QWidget* parent);
~cAppTabWidget();
protected:
private:
Ui::cAppTabWidget* ui;
cAppInterface* tab_Application;
int m_NbTab;
};
Contructor :
cAppTabWidget::cAppTabWidget(QWidget* parent)
: ui(new Ui::cAppTabWidget)
, tab_Application(new cAppInterface)
, m_NbTab(1)
{
this->setGeometry(0, 230, 800, 360);
this->addTab(tab_Application, "App5896");
}
cAppInterface is just a QWidget derived class, with only a setupUi in the constructor. I'm able to see my QTabWidget with show()
but I'm not able to put it inside my page.
Thanks
ui->appTabLayout->addWidget(tabW_Application);
intocImageInterface
constructor, it's compiling, but I've acore dumped
error – MokaTui->appTabLayout->addWidget(tabW_Application);
beforeui->setupUi(this)
? You cannot accessui
members before you callsetupUi
. – thuga