How to toggle four QSplliter layout in a single layout?



  • Hello all, i'm a Qt newbie.
    I want to simulate Autodesk maya 2012 QGLWidget in my Qt practice.
    How to toggle four QSplliter layout in a single layout?
    Sorry for my poor english.
    Hope someone can help me, thanks.

    !http://i.imgbox.com/aafwkZsA.jpg(figure1)!
    !http://i.imgbox.com/aafYzXAn.jpg(figure2)!
    !http://i.imgbox.com/aahP3wUF.jpg(figure3)!

    Here's some code:

    MayaFourView.h
    @#pragma once
    #include <QtGui>
    #include "MayaSimFrame.h"

    class QSplitter;
    class MayaSimFrame;

    class MayaFourView :
    public QWidget
    {
    Q_OBJECT
    public:
    MayaFourView(QWidget *parent = 0);
    ~MayaFourView(void);
    private:
    MayaSimFrame *openGLSceneViewLeft;
    MayaSimFrame *openGLSceneViewTop;
    MayaSimFrame *openGLSceneViewFront;
    MayaSimFrame *openGLSceneViewPerspective;
    QSplitter *newSplitter1;
    QSplitter *newSplitter2;
    void loadStyleSheet(const QString &sheetName);

    };
    @

    MayaFourView.cpp
    @#include "MayaFourView.h"

    MayaFourView::MayaFourView(QWidget *parent)
    : QWidget(parent)
    {

    newSplitter1 = new QSplitter;
    newSplitter2 = new QSplitter;

    /newSplitter1->setOpaqueResize(false);/

    newSplitter1->setAttribute(Qt::WA_PaintOnScreen);

    /newSplitter2->setOpaqueResize(false);/

    newSplitter2->setAttribute(Qt::WA_PaintOnScreen);

    QSplitter *vSplitter = new QSplitter;
    vSplitter->setOrientation(Qt::Vertical);
    vSplitter->addWidget(newSplitter1);
    vSplitter->addWidget(newSplitter2);
    setAttribute(Qt::WA_PaintOnScreen);

    /vSplitter->setOpaqueResize(false);/

    vSplitter->setAttribute(Qt::WA_PaintOnScreen);
    setAutoFillBackground(false);
    openGLSceneViewTop = new MayaSimFrame("Top left view");
    newSplitter1->addWidget(openGLSceneViewTop);

    openGLSceneViewPerspective=new MayaSimFrame("Top right view");
    newSplitter1->addWidget(openGLSceneViewPerspective);

    openGLSceneViewLeft=new MayaSimFrame("Bottom left view");
    newSplitter2->addWidget(openGLSceneViewLeft);

    openGLSceneViewFront=new MayaSimFrame("Bottom right view");
    newSplitter2->addWidget(openGLSceneViewFront);

    QHBoxLayout *layout = new QHBoxLayout;
    layout->addWidget(vSplitter);

    layout->setSpacing(0);
    layout->setMargin(0);
    setLayout(layout);
    setWindowTitle(tr("QtGLFrame"));
    resize(800,600);
    }

    MayaFourView::~MayaFourView(void)
    {
    }

    void MayaFourView::loadStyleSheet(const QString &sheetName)
    {
    QFile file(":/theme/"+ sheetName.toLower()+".qss");
    file.open(QFile::ReadOnly);

    QString styleSheet = QLatin1String(file.readAll());
    qApp->setStyleSheet(styleSheet);
    }
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.