
Originally Posted by
anda_skoa
This is the usual approach.
The widget that holds the stack widget only has to deal with the stack widget (or any sibling widgets).
The contents of each page are handled by their respective implementation classes.
Cheers,
_
Thank you, I'll pursue this. So I'd have (for example) a base.ui/cpp/h combination of source files which would hold the qstackedwidget and my main menu, then I'd have to have each page's widgets added (using addWidget) in the constructor? Doesn't seem to me like there's any way to (in Designer) look at how the whole UI looks like (the base.ui stackedwidget and menu and whatever other widgets are there plus the contents of the qstackedwidget), is that correct?
Edit: I can't seem to addWidget, but I'm able to (for my base.ui qStackedWidget) add a new page and promote the QWidget in that page to be my own widget. Is there an error with my widget code? It's just the basic code created by the Qt 'add item' wizard.
#ifndef MAINPAGE_H
#define MAINPAGE_H
#include <QWidget>
namespace Ui {
class mainPage;
}
{
Q_OBJECT
public:
explicit mainPage
(QWidget *parent
= 0);
~mainPage();
private:
Ui::mainPage *ui;
};
#endif // MAINPAGE_H
#ifndef MAINPAGE_H
#define MAINPAGE_H
#include <QWidget>
namespace Ui {
class mainPage;
}
class mainPage : public QWidget
{
Q_OBJECT
public:
explicit mainPage(QWidget *parent = 0);
~mainPage();
private:
Ui::mainPage *ui;
};
#endif // MAINPAGE_H
To copy to clipboard, switch view to plain text mode
#include "mainpage.h"
#include "ui_mainpage.h"
mainPage
::mainPage(QWidget *parent
) : ui(new Ui::mainPage)
{
ui->setupUi(this);
}
mainPage::~mainPage()
{
delete ui;
}
#include "mainpage.h"
#include "ui_mainpage.h"
mainPage::mainPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::mainPage)
{
ui->setupUi(this);
}
mainPage::~mainPage()
{
delete ui;
}
To copy to clipboard, switch view to plain text mode
Bookmarks