学习了一遍QDockWidget类的使用,堆栈窗口,选择基类为“QDialog”
在工程名的h文件中
#ifndef QTSTACKEDWIDGET_H
#define QTSTACKEDWIDGET_H
#include <QtWidgets/QDialog>
#include "ui_qtstackedwidget.h"
#include <QListWidget>
#include <QStackedWidget>
#include <QLabel>
#include <QHBoxLayout>
class QtStackedWidget : public QDialog
{
Q_OBJECT
public:
QtStackedWidget(QWidget *parent = 0);
~QtStackedWidget();
private:
Ui::QtStackedWidgetClass ui;
private:
QListWidget *list;
QStackedWidget *stack;
QLabel *label1;
QLabel *label2;
QLabel *label3;
};
在工程名的cpp文件中
#include "qtstackedwidget.h"
QtStackedWidget::QtStackedWidget(QWidget *parent)
: QDialog