37
37
#include < QDebug>
38
38
#include < QFile>
39
39
#include < QApplication>
40
+ #include < QAction>
40
41
41
42
#include " FloatingDockContainer.h"
42
43
#include " DockOverlay.h"
43
44
#include " DockWidget.h"
44
45
#include " ads_globals.h"
45
46
#include " DockStateSerialization.h"
46
47
#include " DockWidgetTitleBar.h"
48
+ #include " DockAreaWidget.h"
47
49
48
50
namespace ads
49
51
{
@@ -199,9 +201,11 @@ bool DockManagerPrivate::restoreState(const QByteArray &state, int version)
199
201
// Delete remaining empty floating widgets
200
202
int FloatingWidgetIndex = i - 1 ;
201
203
int DeleteCount = FloatingWidgets.count () - FloatingWidgetIndex;
204
+ /* std::cout << "DeleteCount " << DeleteCount << " FloatingWidgets.count() "
205
+ << FloatingWidgets.count() << " FloatingWdgetIndex " << FloatingWidgetIndex << std::endl;*/
202
206
for (int i = 0 ; i < DeleteCount; ++i)
203
207
{
204
- FloatingWidgets[FloatingWidgetIndex]->deleteLater ();
208
+ FloatingWidgets[FloatingWidgetIndex + i ]->deleteLater ();
205
209
}
206
210
207
211
return Result;
@@ -335,17 +339,11 @@ bool CDockManager::restoreState(const QByteArray &state, int version)
335
339
DockWidget->setProperty (" dirty" , true );
336
340
}
337
341
338
- // this->hide();
339
- QMainWindow* MainWindow = internal::findParent<QMainWindow*>(this );
340
- MainWindow->hide ();
341
- QApplication::processEvents ();
342
342
if (!d->restoreState (state, version))
343
343
{
344
344
qDebug () << " restoreState: Error restoring state!!!!!!!" ;
345
345
return false ;
346
346
}
347
- MainWindow->show ();
348
- // this->show();
349
347
350
348
// All dock widgets, that have not been processed in the restore state
351
349
// function are invisible to the user now and have no assigned dock area
@@ -357,6 +355,23 @@ bool CDockManager::restoreState(const QByteArray &state, int version)
357
355
{
358
356
DockWidget->flagAsUnassigned ();
359
357
}
358
+ else if (!DockWidget->property (" closed" ).toBool ())
359
+ {
360
+ DockWidget->toggleView (true );
361
+ }
362
+ }
363
+
364
+ for (auto DockContainer : d->Containers )
365
+ {
366
+ for (int i = 0 ; i < DockContainer->dockAreaCount (); ++i)
367
+ {
368
+ CDockAreaWidget* DockArea = DockContainer->dockArea (i);
369
+ int CurrentIndex = DockArea->property (" currentIndex" ).toInt ();
370
+ if (CurrentIndex < DockArea->count () && DockArea->count () > 1 && CurrentIndex > -1 )
371
+ {
372
+ DockArea->setCurrentIndex (CurrentIndex);
373
+ }
374
+ }
360
375
}
361
376
362
377
return true ;
0 commit comments