2023-08-20 17:22:48 +00:00
|
|
|
#include "unnnn.h"
|
|
|
|
#include <QApplication>
|
2023-08-13 10:02:21 +00:00
|
|
|
#include <QDebug>
|
2023-08-20 17:22:48 +00:00
|
|
|
#include <QDir>
|
2023-08-13 10:02:21 +00:00
|
|
|
#include <QDomDocument>
|
2023-08-20 17:22:48 +00:00
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QMenuBar>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QStyle>
|
|
|
|
#include <QToolBar>
|
|
|
|
#include <splitview.h>
|
2023-08-13 10:02:21 +00:00
|
|
|
|
2023-08-20 17:22:48 +00:00
|
|
|
using namespace SplitFrame;
|
2023-08-13 10:02:21 +00:00
|
|
|
|
2023-08-20 17:22:48 +00:00
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
QApplication a(argc, argv);
|
2023-08-13 10:02:21 +00:00
|
|
|
|
2023-08-20 17:22:48 +00:00
|
|
|
// auto z = new QWidget();
|
|
|
|
|
|
|
|
// auto v = new XWidget();
|
|
|
|
// v->setParent(z);
|
|
|
|
// v->setGeometry(0, 50, 200, 100);
|
|
|
|
|
|
|
|
// z->show();
|
|
|
|
|
|
|
|
auto win = new QMainWindow();
|
|
|
|
win->setMinimumSize(800, 600);
|
|
|
|
win->menuBar()->addMenu("文件");
|
|
|
|
auto tbar = new QToolBar();
|
|
|
|
win->addToolBar(Qt::ToolBarArea::LeftToolBarArea, tbar);
|
2023-08-24 15:00:31 +00:00
|
|
|
auto b = tbar->addAction("添加");
|
2023-08-20 17:22:48 +00:00
|
|
|
|
|
|
|
auto aview = new BaseView("hello", new QWidget);
|
|
|
|
auto bview = new BaseView("world", new QWidget);
|
|
|
|
auto cview = new BaseView("everyone", new QWidget);
|
2023-08-24 15:00:31 +00:00
|
|
|
auto dview = new BaseView("forth", new XWidget);
|
2023-08-20 17:22:48 +00:00
|
|
|
|
|
|
|
auto conv0 = new SplitView(aview, bview);
|
|
|
|
conv0->setSplitInfo(SplitType::SPLIT_V, 100, 8, true);
|
2023-08-24 15:00:31 +00:00
|
|
|
auto conv = new ViewPresent();
|
2023-08-20 17:22:48 +00:00
|
|
|
win->setCentralWidget(conv);
|
2023-08-24 15:00:31 +00:00
|
|
|
conv->resetViews(conv0, cview);
|
2023-08-20 17:22:48 +00:00
|
|
|
|
2023-08-21 03:28:03 +00:00
|
|
|
conv->registViewComp(aview);
|
|
|
|
conv->registViewComp(bview);
|
|
|
|
conv->registViewComp(cview);
|
2023-08-24 15:00:31 +00:00
|
|
|
conv->registViewComp(dview);
|
|
|
|
conv->markFreedom(dview);
|
|
|
|
|
|
|
|
conv->objsRelateRebuild();
|
|
|
|
|
|
|
|
b->setCheckable(true);
|
|
|
|
win->connect(b, &QAction::triggered, [=](bool v) {
|
|
|
|
if (v)
|
|
|
|
conv->setTempVisible(dview);
|
|
|
|
else
|
|
|
|
conv->setTempVisible(nullptr);
|
|
|
|
});
|
2023-08-20 17:22:48 +00:00
|
|
|
|
|
|
|
win->show();
|
|
|
|
|
|
|
|
// auto w = new QWidget();
|
|
|
|
// QLabel w0, w1;
|
|
|
|
// w0.setPixmap(a.style()->standardIcon(QStyle::StandardPixmap::SP_ArrowUp).pixmap(QSize(20, 20)));
|
|
|
|
// w1.setText("hello");
|
|
|
|
// auto v = new QHBoxLayout(w);
|
|
|
|
// v->setMargin(0);
|
|
|
|
// v->setSpacing(1);
|
|
|
|
// v->addWidget(&w0, 0);
|
|
|
|
// v->addWidget(&w1, 1);
|
|
|
|
// w->show();
|
2023-08-13 10:02:21 +00:00
|
|
|
|
|
|
|
return a.exec();
|
|
|
|
}
|