Better explanation for #21

On Tue, Feb 10, 2015 at 4:03 PM, Tomaz Canabrava <[email protected]> wrote:

> this fixes a broken connection
>
> On Tue, Feb 10, 2015 at 3:56 PM, Tomaz Canabrava <[email protected]>
> wrote:
>
>> Those extra patches fixes the resize and the flickering issues.
>>
>> On Tue, Feb 10, 2015 at 1:40 PM, Tomaz Canabrava <[email protected]>
>> wrote:
>>
>>>
>>>
>>> On Tue, Feb 10, 2015 at 1:21 PM, Dirk Hohndel <[email protected]> wrote:
>>>
>>>> On Tue, Feb 10, 2015 at 12:36:34PM -0200, Tomaz Canabrava wrote:
>>>> > There are obvious bugs that i'm working on.
>>>> > most notably, it forgets the size of the widgets.
>>>>
>>>> So do these get us back to a "mostly working" state? I don't want master
>>>> to be completely unusable...
>>>>
>>>
>>> not completely.
>>>
>>>
>>>>
>>>> /D
>>>>
>>>>
>>>
>>
>
From 5ff7689f77757536577593cc6a4ec5916c62e7e5 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 10 Feb 2015 15:51:30 -0200
Subject: [PATCH 21/23] Remove the flickr issue and the resize issue.

The flickr was caused by removing all widgets ( and thus setting 
the size of the splitter to zero ) and then readding them.
I'v 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 <[email protected]>
---
 qt-ui/mainwindow.cpp | 36 ++++++++++++++++--------------------
 qt-ui/mainwindow.ui  | 10 +++++++---
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index e7e0bf0..25b2517 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1497,6 +1497,18 @@ void MainWindow::on_actionFilterTags_triggered()
 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) {
@@ -1507,24 +1519,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 e345c64..5d2e888 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,7 +49,7 @@
     <rect>
      <x>0</x>
      <y>0</y>
-     <width>1682</width>
+     <width>861</width>
      <height>32</height>
     </rect>
    </property>
-- 
2.3.0

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to