MCPcopy Create free account
hub / github.com/KDE/labplot / restoreState

Method restoreState

src/3rdparty/Qt-Advanced-Docking-System/src/DockAreaWidget.cpp:956–1049  ·  view source on GitHub ↗

============================================================================

Source from the content-addressed store, hash-verified

954
955//============================================================================
956bool CDockAreaWidget::restoreState(CDockingStateReader& s, CDockAreaWidget*& CreatedWidget,
957 bool Testing, CDockContainerWidget* Container)
958{
959 bool Ok;
960#ifdef ADS_DEBUG_PRINT
961 int Tabs = s.attributes().value("Tabs").toInt(&Ok);
962 if (!Ok)
963 {
964 return false;
965 }
966#endif
967
968 QString CurrentDockWidget = s.attributes().value("Current").toString();
969 ADS_PRINT("Restore NodeDockArea Tabs: " << Tabs << " Current: "
970 << CurrentDockWidget);
971
972 auto DockManager = Container->dockManager();
973 CDockAreaWidget* DockArea = nullptr;
974 if (!Testing)
975 {
976 DockArea = new CDockAreaWidget(DockManager, Container);
977 const auto AllowedAreasAttribute = s.attributes().value("AllowedAreas");
978 if (!AllowedAreasAttribute.isEmpty())
979 {
980 DockArea->setAllowedAreas((DockWidgetArea)AllowedAreasAttribute.toInt(nullptr, 16));
981 }
982
983 const auto FlagsAttribute = s.attributes().value("Flags");
984 if (!FlagsAttribute.isEmpty())
985 {
986 DockArea->setDockAreaFlags((CDockAreaWidget::DockAreaFlags)FlagsAttribute.toInt(nullptr, 16));
987 }
988 }
989
990 while (s.readNextStartElement())
991 {
992 if (s.name() != QLatin1String("Widget"))
993 {
994 continue;
995 }
996
997 auto ObjectName = s.attributes().value("Name");
998 if (ObjectName.isEmpty())
999 {
1000 return false;
1001 }
1002
1003 bool Closed = s.attributes().value("Closed").toInt(&Ok);
1004 if (!Ok)
1005 {
1006 return false;
1007 }
1008
1009 s.skipCurrentElement();
1010 CDockWidget* DockWidget = DockManager->findDockWidget(ObjectName.toString());
1011 if (!DockWidget || Testing)
1012 {
1013 continue;

Callers

nothing calls this directly

Calls 15

setDockAreaFlagsMethod · 0.80
findDockWidgetMethod · 0.80
cleanupAndDeleteMethod · 0.80
setClosedStateMethod · 0.80
dockWidgetsCountMethod · 0.80
valueMethod · 0.45
toStringMethod · 0.45
dockManagerMethod · 0.45
isEmptyMethod · 0.45
setAllowedAreasMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected