QSplitter测试

很久没用过了,今天又用了

QSplitter *splitterMain;
    QTextEdit *textleft;
    QSplitter *splitterRight;
    QTextEdit *textUp;
    QTextEdit *textBottom;
    QVBoxLayout *vLayout=new QVBoxLayout(ui.centralWidget);

    splitterMain = new QSplitter(Qt::Horizontal, ui.centralWidget);                   //Horizontal:水平的
    textleft = new QTextEdit(QObject::tr("Left Widget"), splitterMain);
    textleft->setAlignment(Qt::AlignCenter);
    //右部分分割窗口
    splitterRight = new QSplitter(Qt::Vertical, splitterMain);        //Vertical:垂直的
    splitterRight->setOpaqueResize(false);                                    //Opaque:不透明的
    textUp = new QTextEdit(QObject::tr("Top Widget"), splitterRight);
    textUp->setAlignment(Qt::AlignCenter);
    textBottom = new QTextEdit(QObject::tr("Bottom Widget"), splitterRight);
    textBottom->setAlignment(Qt::AlignCenter);
    splitterMain->setStretchFactor(0, 1);

    vLayout->addWidget(splitterMain);

 

参考:https://www.cnblogs.com/fuqia/p/8882994.html

 

#####################33

posted @ 2021-09-04 17:45  西北逍遥  阅读(57)  评论(0编辑  收藏  举报