I am trying to implement the following layout
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| | | | | | | | QTABWIDGET | QGLWIDGET | | | | | | | |_______________|________________| | | | | | TEXTEDIT | |________________________________|
Between TabWidget and GLWidget, the layout is controlled by a horizontal orientation QSplitter. It requires another QSplitter with a vertical orientation between the previous splitter and the QTextEdit widgets so that I can hide the textedit.
Currently my implementation is as follows ( this
is a pointer to the 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 works correctly, but when I maximize it, the CPU utilization reaches 90% and higher, and the gui interface is slow!
I found that you cannot put the layout inside QSplitter http://qt-project.org/doc/qt-4.8/qsplitter.html
so I tried to comment out the line glTabSplitterHorizontal->addWidget(ui->tabWidget);
, but the CPU is not loaded. The problem is that I need this tabWidget!
How can I get around this problem by keeping my separator layout?
linello
source share