I'm trying to implement the following layout
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| | |
| | |
| QTABWIDGET | QGLWIDGET |
| | |
| | |
|_______________|________________|
| |
| |
| TEXTEDIT |
|________________________________|
Between the TabWidget and GLWidget the layout is governed by a QSplitter with horizontal orientation. Another QSplitter with vertical orientation is needed between the previous splitter and QTextEdit widget so that I can choose to hide the textedit.
Currently my implementation is the following (this
is the pointer to MainWindow
class):
QVBoxLayout *mainWindowLayout = new QVBoxLayout(ui->centralWidget);
// Here we setup an horizontal splitter between the TabWidget and the QGLWidget
QSplitter *glTabSplitterHorizontal = new QSplitter(Qt::Horizontal,this);
glTabSplitterHorizontal->addWidget(ui->tabWidget); // seems to produce the high CPU load
glTabSplitterHorizontal->addWidget(this->glWidget);
// add the horizontal splitter as first row of the layout
QSplitter *splitterConsoleVertical = new QSplitter(Qt::Vertical,this);
splitterConsoleVertical->setOrientation(Qt::Vertical);
// as first row it must be the previously allocated horizontal layout tabWidget
splitterConsoleVertical->addWidget(glTabSplitterHorizontal);
mainWindowLayout->addWidget(glTabSplitterHorizontal);
My application seems to work correctly, but when I maximize it, the CPU load jumps to 90% and above and the gui interface is slow!
I've found that you can't put a layout inside a QSplitter http://qt-project.org/doc/qt-4.8/qsplitter.html
so I've tried to comment the line glTabSplitterHorizontal->addWidget(ui->tabWidget);
and the CPU is not heavy loaded.
The problem is that I need that tabWidget!
How can I work around this issue, keeping my layout with splitters?