MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / restoreDocks

Method restoreDocks

src/settings.cpp:1021–1050  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1019}
1020
1021void GeometrySettings::restoreDocks(QMainWindow* mw) const
1022{
1023 struct DockInfo
1024 {
1025 QDockWidget* d;
1026 int size = 0;
1027 Qt::Orientation ori;
1028 };
1029
1030 std::vector<DockInfo> dockInfos;
1031
1032 // for each dock
1033 for (auto* dock : mw->findChildren<QDockWidget*>()) {
1034 if (auto size = getOptional<int>(m_Settings, "Geometry", dockSettingName(dock))) {
1035 // remember this dock, its size and orientation
1036 dockInfos.push_back({dock, *size, dockOrientation(mw, dock)});
1037 }
1038 }
1039
1040 // the main window must have had time to process the settings from
1041 // readSettings() or it seems to override whatever is set here
1042 //
1043 // some people said a single processEvents() call is enough, but it doesn't
1044 // look like it
1045 QTimer::singleShot(5, [=] {
1046 for (const auto& info : dockInfos) {
1047 mw->resizeDocks({info.d}, {info.size}, info.ori);
1048 }
1049 });
1050}
1051
1052WidgetSettings::WidgetSettings(QSettings& s, bool globalInstance) : m_Settings(s)
1053{

Callers 1

readSettingsMethod · 0.80

Calls 2

dockSettingNameFunction · 0.85
dockOrientationFunction · 0.85

Tested by

no test coverage detected