#include "mainwindow.h"
#include <QApplication>
#include<QSplitter>
#include<QTextEdit>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSplitter *SplitMain = new QSplitter(Qt::Horizontal,0);//主分割窗口,水平
QTextEdit * textLeft = new QTextEdit(QObject::tr("Left Widget"),SplitMain);
textLeft->setAlignment(Qt::AlignCenter);
//右
QSplitter *SplitRight=new QSplitter(Qt::Vertical,SplitMain);
SplitRight->setOpaqueResize(false);//设置分割窗口的分割条在拖拽时是否实时更新显示
QTextEdit *textUp = new QTextEdit(QObject::tr("Top Widget"),SplitRight);
textUp->setAlignment(Qt::AlignCenter);
QTextEdit *textBottom = new QTextEdit(QObject::tr("Bottom Widget"),SplitRight);
textBottom->setAlignment(Qt::AlignCenter);
SplitMain->setWindowTitle(QObject::tr("Splitter"));
SplitMain->setStretchFactor(1,1);//用于设定可伸缩控件,第一个参数为指定控件序号,按插入顺序从0编号。第二个参数为大于0的值表示此控件可伸缩
SplitMain->show();
// MainWindow w;
// w.show();
return a.exec();
}
#include <QApplication>
#include<QSplitter>
#include<QTextEdit>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSplitter *SplitMain = new QSplitter(Qt::Horizontal,0);//主分割窗口,水平
QTextEdit * textLeft = new QTextEdit(QObject::tr("Left Widget"),SplitMain);
textLeft->setAlignment(Qt::AlignCenter);
//右
QSplitter *SplitRight=new QSplitter(Qt::Vertical,SplitMain);
SplitRight->setOpaqueResize(false);//设置分割窗口的分割条在拖拽时是否实时更新显示
QTextEdit *textUp = new QTextEdit(QObject::tr("Top Widget"),SplitRight);
textUp->setAlignment(Qt::AlignCenter);
QTextEdit *textBottom = new QTextEdit(QObject::tr("Bottom Widget"),SplitRight);
textBottom->setAlignment(Qt::AlignCenter);
SplitMain->setWindowTitle(QObject::tr("Splitter"));
SplitMain->setStretchFactor(1,1);//用于设定可伸缩控件,第一个参数为指定控件序号,按插入顺序从0编号。第二个参数为大于0的值表示此控件可伸缩
SplitMain->show();
// MainWindow w;
// w.show();
return a.exec();
}