summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-02-10 15:51:30 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-10 10:45:46 -0800
commit9b547e6c718146ab73122a1b1f5d1c94e1ce7e3a (patch)
tree325e99fa0cfa200a6b8a68f7c08555e581cceab2 /qt-ui
parent7b46a8fddfce8d9c47c0220b426adcd7b8eecd84 (diff)
downloadsubsurface-9b547e6c718146ab73122a1b1f5d1c94e1ce7e3a.tar.gz
Remove the flicker issue and the resize issue.
The flicker was caused by removing all widgets (and thus setting the size of the splitter to zero) and then re-adding them. I've added four QStackedWdigets that have a consistent size and the only thing I do now is to set the corresponding widget to visible without removing / readding anything, and thus, not messing with the sizes. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/mainwindow.cpp36
-rw-r--r--qt-ui/mainwindow.ui12
2 files changed, 24 insertions, 24 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 550fd386f..c9915ad22 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1516,6 +1516,18 @@ void MainWindow::checkForUndoAndRedo()
void MainWindow::registerApplicationState(const QByteArray& state, QWidget *topLeft, QWidget *bottomLeft, QWidget *topRight, QWidget *bottomRight)
{
applicationState[state] = WidgetForBorder(topLeft, bottomLeft, topRight, bottomRight);
+ if (ui.topLeft->indexOf(topLeft) == -1) {
+ ui.topLeft->addWidget(topLeft);
+ }
+ if (ui.topRight->indexOf(topRight) == -1) {
+ ui.topRight->addWidget(topRight);
+ }
+ if (ui.bottomLeft->indexOf(bottomLeft) == -1) {
+ ui.bottomLeft->addWidget(bottomLeft);
+ }
+ if(ui.bottomRight->indexOf(bottomRight) == -1) {
+ ui.bottomRight->addWidget(bottomRight);
+ }
}
void MainWindow::setApplicationState(const QByteArray& state) {
@@ -1526,24 +1538,8 @@ void MainWindow::setApplicationState(const QByteArray& state) {
return;
currentApplicationState = state;
- QList<int> topSize = ui.topSplitter->sizes();
- QList<int> bottomSize = ui.bottomSplitter->sizes();
-
- // yes, index is zero both times. please don't change it.
- if (ui.topSplitter->count() >= 2) {
- ui.topSplitter->widget(0)->setParent(NULL);
- ui.topSplitter->widget(0)->setParent(NULL);
- }
- if (ui.bottomSplitter->count() >= 2) {
- ui.bottomSplitter->widget(0)->setParent(NULL);
- ui.bottomSplitter->widget(0)->setParent(NULL);
- }
-
- WidgetForBorder curr = applicationState[state];
- ui.topSplitter->addWidget(curr.topLeft);
- ui.topSplitter->addWidget(curr.topRight);
- ui.bottomSplitter->addWidget(curr.bottomLeft);
- ui.bottomSplitter->addWidget(curr.bottomRight);
- ui.topSplitter->setSizes(topSize);
- ui.bottomSplitter->setSizes(bottomSize);
+ ui.topLeft->setCurrentWidget( applicationState[state].topLeft);
+ ui.bottomLeft->setCurrentWidget( applicationState[state].bottomLeft);
+ ui.topRight->setCurrentWidget( applicationState[state].topRight);
+ ui.bottomRight->setCurrentWidget( applicationState[state].bottomRight);
}
diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui
index ac0e92d94..ced02c964 100644
--- a/qt-ui/mainwindow.ui
+++ b/qt-ui/mainwindow.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>1682</width>
- <height>1151</height>
+ <width>861</width>
+ <height>800</height>
</rect>
</property>
<widget class="QWidget" name="centralwidget">
@@ -27,11 +27,15 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
+ <widget class="QStackedWidget" name="topLeft"/>
+ <widget class="QStackedWidget" name="topRight"/>
</widget>
<widget class="QSplitter" name="bottomSplitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
+ <widget class="QStackedWidget" name="bottomLeft"/>
+ <widget class="QStackedWidget" name="bottomRight"/>
</widget>
</widget>
</item>
@@ -45,8 +49,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>1682</width>
- <height>25</height>
+ <width>861</width>
+ <height>32</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">