QtNovelUI/u_test/main.cpp

59 lines
1.5 KiB
C++
Raw Normal View History

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>
2023-08-26 12:40:57 +00:00
#include <baseview.h>
#include <splitpanel.h>
2023-08-20 17:22:48 +00:00
#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 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
2023-08-24 15:00:31 +00:00
auto conv = new ViewPresent();
2023-08-26 12:40:57 +00:00
auto aview = new XWidget(conv, Qt::black);
auto bview = new XWidget(conv, Qt::green);
auto cview = new XWidget(conv, Qt::yellow);
auto dview = new YWidget(conv);
auto rect0 = conv->appendView(aview, "hello0");
auto rect1 = conv->appendView(bview, "hello1");
auto rect2 = conv->appendView(cview, "hello2");
auto rect3 = conv->appendView(dview, "hello3");
conv->markFreedom(rect0);
conv->markFreedom(rect1);
conv->markFreedom(rect2);
conv->markFreedom(rect3);
2023-08-24 15:00:31 +00:00
conv->objsRelateRebuild();
2023-08-26 12:40:57 +00:00
conv->resetEngross(static_cast<RectCom *>(rect3));
win->setCentralWidget(conv->bind());
2023-08-24 15:00:31 +00:00
win->connect(b, &QAction::triggered, [=](bool v) {
2023-08-26 12:40:57 +00:00
auto items = conv->freedomViews();
if (items.size()) {
conv->temporaryVisible(items.last());
}
2023-08-24 15:00:31 +00:00
});
2023-08-20 17:22:48 +00:00
win->show();
2023-08-13 10:02:21 +00:00
return a.exec();
}