Qt QSplitter布局

Qt QSplitter布局

#include <QSplitter>

 

 

QVBoxLayout *verticalLayoutMain;
QSplitter *splitterMain = nullptr;
QSplitter *splitterLeft = nullptr;
QSplitter *splitterRight = nullptr;
QSplitter *splitterCenter = nullptr;
QSplitter *splitterMainViewer = nullptr;
QSplitter *splitterBottom = nullptr;


verticalLayoutMain = new QVBoxLayout(main_ui.centralWidget);
splitterMain = new QSplitter(Qt::Horizontal, main_ui.centralWidget);
splitterLeft = new QSplitter(Qt::Vertical, splitterMain);
splitterCenter = new QSplitter(Qt::Vertical, splitterMain);
splitterMainViewer = new QSplitter(Qt::Vertical, splitterCenter);
splitterRight = new QSplitter(Qt::Vertical, splitterMain);
splitterBottom = new QSplitter(Qt::Vertical, splitterCenter);

splitterMainViewer->setMinimumSize(640, 480);
QTextEdit* textleft1 = new QTextEdit(QObject::tr("Left Widget"), splitterLeft);
QTextEdit* textleft2 = new QTextEdit(QObject::tr("Right Widget"), splitterRight);
QTextEdit* textleft3 = new QTextEdit(QObject::tr("Bottom Widget"), splitterBottom);

horizontalLayout = new QHBoxLayout(splitterMainViewer);
horizontalLayout->setSpacing(0);
horizontalLayout->setContentsMargins(0, 0, 0, 0);
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));

verticalLayoutMain->addWidget(splitterMain);

 

 

#########################

posted @ 2021-09-09 16:31  西北逍遥  阅读(190)  评论(0编辑  收藏  举报