Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
ejdata.cpp 1.33 KB
Copy Edit Web IDE Raw Blame History
unix_chen authored 2018-03-26 07:59 . init
#include "ejdata.h"
#include <QSplitter>
#include <QTextEdit>
#include <QTextCodec>
#include <QPushButton>
#include <QListWidget>
EjData::EjData(QWidget *parent)
:QMainWindow(parent)
{
//分割窗口
auto mainSplitter = new QSplitter(Qt::Horizontal, this);
auto leftEdit = new QTextEdit(QObject::tr("左窗口"), mainSplitter);
leftEdit->setAlignment(Qt::AlignCenter);
//创建右分割窗口
auto rightSplitter= new QSplitter(Qt::Vertical, mainSplitter);
//设定分割窗口的分割条在拖动时是否为实时更新 true为实时更新 false则在拖动时只显示一条灰色的线条
//在拖动到位并弹起鼠标后再显示分隔条
rightSplitter->setOpaqueResize(false);
//开始将其分割成上下两个窗口
QTextEdit *upEdit = new QTextEdit(QObject::tr("上窗口"), rightSplitter);
upEdit->setAlignment(Qt::AlignCenter);
QTextEdit *bottomEdit = new QTextEdit(QObject::tr("下窗口"), rightSplitter);
bottomEdit->setAlignment(Qt::AlignCenter);
//设定可伸缩控件 第一个参数指定控件设置的控件序号,该控件序号按插入的先后次序依次从0开始编号
//第二个参数大于0表示此控件为伸缩控件 此例中设置右部分割窗口为可伸缩控件
mainSplitter->setStretchFactor(0, 1);
setCentralWidget(mainSplitter);
}

Comment ( 0 )

Sign in for post a comment