@@ -129,7 +129,7 @@ static void from_json(const nlohmann::json &json, LayoutSaver::Group &f)
129129 f.id = jsonValue (json, " id" , QString ());
130130 f.isNull = jsonValue (json, " isNull" , true );
131131 f.objectName = jsonValue (json, " objectName" , QString ());
132- f.geometry = jsonValue (json, " geometry" , Rect ());
132+ f.geometry = jsonValue (json, " geometry" , QRect ());
133133 f.options = jsonValue (json, " options" , QFlags<FrameOption>::Int {});
134134 f.currentTabIndex = jsonValue (json, " currentTabIndex" , 0 );
135135 f.mainWindowUniqueName = jsonValue (json, " mainWindowUniqueName" , QString ());
@@ -193,7 +193,7 @@ static void to_json(nlohmann::json &json, const LayoutSaver::MainWindow &mw)
193193
194194 for (SideBarLocation loc : { SideBarLocation::North, SideBarLocation::East,
195195 SideBarLocation::West, SideBarLocation::South }) {
196- const Vector <QString> dockWidgets = mw.dockWidgetsForSideBar (loc);
196+ const QVector <QString> dockWidgets = mw.dockWidgetsForSideBar (loc);
197197 if (!dockWidgets.isEmpty ()) {
198198 std::string key = std::string (" sidebar-" ) + std::to_string (( int )loc);
199199 json[key] = dockWidgets;
@@ -206,12 +206,12 @@ static void from_json(const nlohmann::json &json, LayoutSaver::MainWindow &mw)
206206 mw.options = static_cast <decltype (mw.options )>(jsonValue (json, " options" , 0 ));
207207 mw.multiSplitterLayout = jsonValue (json, " multiSplitterLayout" , LayoutSaver::MultiSplitter ());
208208 mw.uniqueName = jsonValue (json, " uniqueName" , QString ());
209- mw.geometry = jsonValue (json, " geometry" , Rect ());
210- mw.normalGeometry = jsonValue (json, " normalGeometry" , Rect ());
209+ mw.geometry = jsonValue (json, " geometry" , QRect ());
210+ mw.normalGeometry = jsonValue (json, " normalGeometry" , QRect ());
211211 mw.screenIndex = jsonValue (json, " screenIndex" , 0 );
212- mw.screenSize = jsonValue (json, " screenSize" , Size (800 , 600 ));
212+ mw.screenSize = jsonValue (json, " screenSize" , QSize (800 , 600 ));
213213 mw.isVisible = jsonValue (json, " isVisible" , false );
214- mw.affinities = jsonValue (json, " affinities" , Vector <QString>());
214+ mw.affinities = jsonValue (json, " affinities" , QVector <QString>());
215215 mw.windowState = ( WindowState )jsonValue (json, " windowState" , 0 );
216216
217217 // Compatibility hack. Old json format had a single "affinityName" instead of an "affinities"
@@ -231,7 +231,7 @@ static void from_json(const nlohmann::json &json, LayoutSaver::MainWindow &mw)
231231 continue ;
232232 auto &val = *it;
233233 if (val.is_array () && !val.empty ()) {
234- mw.dockWidgetsPerSideBar [loc] = val.get <Vector <QString>>();
234+ mw.dockWidgetsPerSideBar [loc] = val.get <QVector <QString>>();
235235 }
236236 }
237237}
@@ -257,14 +257,14 @@ static void from_json(const nlohmann::json &json, LayoutSaver::FloatingWindow &w
257257{
258258 window.multiSplitterLayout = jsonValue (json, " multiSplitterLayout" , LayoutSaver::MultiSplitter ());
259259 window.parentIndex = jsonValue (json, " parentIndex" , -1 );
260- window.geometry = jsonValue (json, " geometry" , Rect ());
261- window.normalGeometry = jsonValue (json, " normalGeometry" , Rect ());
260+ window.geometry = jsonValue (json, " geometry" , QRect ());
261+ window.normalGeometry = jsonValue (json, " normalGeometry" , QRect ());
262262 window.screenIndex = jsonValue (json, " screenIndex" , 0 );
263- window.screenSize = jsonValue (json, " screenSize" , Size (800 , 600 ));
263+ window.screenSize = jsonValue (json, " screenSize" , QSize (800 , 600 ));
264264 window.isVisible = jsonValue (json, " isVisible" , false );
265265 window.flags = jsonValue (json, " flags" , int (FloatingWindowFlag::FromGlobalConfig));
266266 window.windowState = ( WindowState )jsonValue (json, " windowState" , 0 );
267- window.affinities = jsonValue (json, " affinities" , Vector <QString>());
267+ window.affinities = jsonValue (json, " affinities" , QVector <QString>());
268268
269269 // Compatibility hack. Old json format had a single "affinityName" instead of an "affinities"
270270 // list:
@@ -285,7 +285,7 @@ static void to_json(nlohmann::json &json, const LayoutSaver::ScreenInfo &screenI
285285static void from_json (const nlohmann::json &j, LayoutSaver::ScreenInfo &screenInfo)
286286{
287287 screenInfo.index = j.value (" index" , 0 );
288- screenInfo.geometry = j.value (" geometry" , Rect ());
288+ screenInfo.geometry = j.value (" geometry" , QRect ());
289289 screenInfo.name = j.value (" name" , QString ());
290290 screenInfo.devicePixelRatio = j.value (" devicePixelRatio" , 1.0 );
291291}
@@ -319,8 +319,8 @@ static void to_json(nlohmann::json &json, const LayoutSaver::Position &pos)
319319
320320static void from_json (const nlohmann::json &json, LayoutSaver::Position &pos)
321321{
322- pos.lastFloatingGeometry = jsonValue (json, " lastFloatingGeometry" , Rect ());
323- pos.lastOverlayedGeometries = jsonValue (json, " lastOverlayedGeometries" , std::unordered_map<KDDockWidgets::SideBarLocation, Rect >());
322+ pos.lastFloatingGeometry = jsonValue (json, " lastFloatingGeometry" , QRect ());
323+ pos.lastOverlayedGeometries = jsonValue (json, " lastOverlayedGeometries" , std::unordered_map<KDDockWidgets::SideBarLocation, QRect >());
324324 pos.tabIndex = jsonValue (json, " tabIndex" , 0 );
325325 pos.wasFloating = jsonValue (json, " wasFloating" , false );
326326 pos.placeholders = jsonValue (json, " placeholders" , LayoutSaver::Placeholder::List ());
@@ -343,7 +343,7 @@ static void from_json(const nlohmann::json &json, LayoutSaver::DockWidget &dw)
343343{
344344 auto it = json.find (" affinities" );
345345 if (it != json.end ())
346- dw.affinities = it->get <Vector <QString>>();
346+ dw.affinities = it->get <QVector <QString>>();
347347
348348 dw.uniqueName = jsonValue (json, " uniqueName" , QString ());
349349 if (dw.uniqueName .isEmpty ())
@@ -444,7 +444,7 @@ QByteArray LayoutSaver::serializeLayout() const
444444 layout.mainWindows .push_back (mainWindow->serialize ());
445445 }
446446
447- const Vector <Core::FloatingWindow *> floatingWindows =
447+ const QVector <Core::FloatingWindow *> floatingWindows =
448448 d->m_dockRegistry ->floatingWindows (/* includeBeingDeleted=*/ false , /* honourSkipped=*/ true );
449449 layout.floatingWindows .reserve (floatingWindows.size ());
450450 for (Core::FloatingWindow *floatingWindow : floatingWindows) {
@@ -609,7 +609,7 @@ bool LayoutSaver::restoreLayout(const QByteArray &data)
609609 return true ;
610610}
611611
612- void LayoutSaver::setAffinityNames (const Vector <QString> &affinityNames)
612+ void LayoutSaver::setAffinityNames (const QVector <QString> &affinityNames)
613613{
614614 d->m_affinityNames = affinityNames;
615615 if (affinityNames.contains (QString ())) {
@@ -650,7 +650,7 @@ void LayoutSaver::Private::deserializeWindowGeometry(const T &saved, Window::Ptr
650650 // Not simply calling QWidget::setGeometry() here.
651651 // For QtQuick we need to modify the QWindow's geometry.
652652
653- Rect geometry = saved.geometry ;
653+ QRect geometry = saved.geometry ;
654654 if (!isNormalWindowState (saved.windowState )) {
655655 // The window will be maximized. We first set its geometry to normal
656656 // Later it's maximized and will remember this value
@@ -704,13 +704,13 @@ void LayoutSaver::Private::restorePendingPositions(Core::DockWidget *dw)
704704 }
705705}
706706
707- bool LayoutSaver::Private::matchesAffinity (const Vector <QString> &affinities) const
707+ bool LayoutSaver::Private::matchesAffinity (const QVector <QString> &affinities) const
708708{
709709 return m_affinityNames.isEmpty () || affinities.isEmpty ()
710710 || DockRegistry::self ()->affinitiesMatch (m_affinityNames, affinities);
711711}
712712
713- void LayoutSaver::Private::floatWidgetsWhichSkipRestore (const Vector <QString> &mainWindowNames)
713+ void LayoutSaver::Private::floatWidgetsWhichSkipRestore (const QVector <QString> &mainWindowNames)
714714{
715715 // Widgets with the LayoutSaverOptions::Skip flag skip restore completely.
716716 // If they were visible before they need to remain visible now.
@@ -794,7 +794,7 @@ bool LayoutSaver::Layout::isValid() const
794794 return true ;
795795}
796796
797- Vector <QString> LayoutSaver::openedDockWidgetsInLayout (const QString &jsonFilename)
797+ QVector <QString> LayoutSaver::openedDockWidgetsInLayout (const QString &jsonFilename)
798798{
799799 bool ok = false ;
800800 const QByteArray data = Platform::instance ()->readFile (jsonFilename, /* by-ref*/ ok);
@@ -805,13 +805,13 @@ Vector<QString> LayoutSaver::openedDockWidgetsInLayout(const QString &jsonFilena
805805 return openedDockWidgetsInLayout (data);
806806}
807807
808- Vector <QString> LayoutSaver::openedDockWidgetsInLayout (const QByteArray &serialized)
808+ QVector <QString> LayoutSaver::openedDockWidgetsInLayout (const QByteArray &serialized)
809809{
810810 LayoutSaver::Layout layout;
811811 if (!layout.fromJson (serialized))
812812 return {};
813813
814- Vector <QString> names;
814+ QVector <QString> names;
815815 names.reserve (layout.allDockWidgets .size ()); // over-reserve so we have a single allocation
816816
817817 for (const auto &dock : std::as_const (layout.allDockWidgets )) {
@@ -827,7 +827,7 @@ Vector<QString> LayoutSaver::openedDockWidgetsInLayout(const QByteArray &seriali
827827 return names;
828828}
829829
830- Vector <QString> LayoutSaver::sideBarDockWidgetsInLayout (const QString &jsonFilename)
830+ QVector <QString> LayoutSaver::sideBarDockWidgetsInLayout (const QString &jsonFilename)
831831{
832832 bool ok = false ;
833833 const QByteArray data = Platform::instance ()->readFile (jsonFilename, /* by-ref*/ ok);
@@ -838,13 +838,13 @@ Vector<QString> LayoutSaver::sideBarDockWidgetsInLayout(const QString &jsonFilen
838838 return sideBarDockWidgetsInLayout (data);
839839}
840840
841- Vector <QString> LayoutSaver::sideBarDockWidgetsInLayout (const QByteArray &serialized)
841+ QVector <QString> LayoutSaver::sideBarDockWidgetsInLayout (const QByteArray &serialized)
842842{
843843 LayoutSaver::Layout layout;
844844 if (!layout.fromJson (serialized))
845845 return {};
846846
847- Vector <QString> names;
847+ QVector <QString> names;
848848 names.reserve (layout.allDockWidgets .size ()); // over-reserve so we have a single allocation
849849
850850 for (const auto &mainWindow : std::as_const (layout.mainWindows )) {
@@ -876,7 +876,7 @@ static void from_json(const nlohmann::json &j, LayoutSaver::Layout &layout)
876876
877877 layout.closedDockWidgets .clear ();
878878
879- const auto closedDockWidgets = j.value (" closedDockWidgets" , Vector <QString>());
879+ const auto closedDockWidgets = j.value (" closedDockWidgets" , QVector <QString>());
880880 for (const QString &name : closedDockWidgets) {
881881 layout.closedDockWidgets .push_back (
882882 LayoutSaver::DockWidget::dockWidgetForName (name));
@@ -972,9 +972,9 @@ LayoutSaver::FloatingWindow LayoutSaver::Layout::floatingWindowForIndex(int inde
972972 return floatingWindows.at (index);
973973}
974974
975- Vector <QString> LayoutSaver::Layout::mainWindowNames () const
975+ QVector <QString> LayoutSaver::Layout::mainWindowNames () const
976976{
977- Vector <QString> names;
977+ QVector <QString> names;
978978 names.reserve (mainWindows.size ());
979979 for (const auto &mw : mainWindows) {
980980 names.push_back (mw.uniqueName );
@@ -983,9 +983,9 @@ Vector<QString> LayoutSaver::Layout::mainWindowNames() const
983983 return names;
984984}
985985
986- Vector <QString> LayoutSaver::Layout::dockWidgetNames () const
986+ QVector <QString> LayoutSaver::Layout::dockWidgetNames () const
987987{
988- Vector <QString> names;
988+ QVector <QString> names;
989989 names.reserve (allDockWidgets.size ());
990990 for (const auto &dw : allDockWidgets) {
991991 names.push_back (dw->uniqueName );
@@ -994,12 +994,12 @@ Vector<QString> LayoutSaver::Layout::dockWidgetNames() const
994994 return names;
995995}
996996
997- Vector <QString> LayoutSaver::Layout::dockWidgetsToClose () const
997+ QVector <QString> LayoutSaver::Layout::dockWidgetsToClose () const
998998{
999999 // Before restoring a layout we close all dock widgets, unless they're a floating window with
10001000 // the DontCloseBeforeRestore flag
10011001
1002- Vector <QString> names;
1002+ QVector <QString> names;
10031003 names.reserve (allDockWidgets.size ());
10041004 auto registry = DockRegistry::self ();
10051005 for (const auto &dw : allDockWidgets) {
@@ -1146,10 +1146,10 @@ bool LayoutSaver::MainWindow::isValid() const
11461146 return multiSplitterLayout.isValid ();
11471147}
11481148
1149- Vector <QString> LayoutSaver::MainWindow::dockWidgetsForSideBar (SideBarLocation loc) const
1149+ QVector <QString> LayoutSaver::MainWindow::dockWidgetsForSideBar (SideBarLocation loc) const
11501150{
11511151 auto it = dockWidgetsPerSideBar.find (loc);
1152- return it == dockWidgetsPerSideBar.cend () ? Vector <QString>() : it->second ;
1152+ return it == dockWidgetsPerSideBar.cend () ? QVector <QString>() : it->second ;
11531153}
11541154
11551155void LayoutSaver::MainWindow::scaleSizes ()
@@ -1202,7 +1202,7 @@ Core::Screen::Ptr screenForMainWindow(Core::MainWindow *mw)
12021202
12031203}
12041204
1205- LayoutSaver::ScalingInfo::ScalingInfo (const QString &mainWindowId, Rect savedMainWindowGeo,
1205+ LayoutSaver::ScalingInfo::ScalingInfo (const QString &mainWindowId, QRect savedMainWindowGeo,
12061206 int screenIndex)
12071207{
12081208 auto mainWindow = DockRegistry::self ()->mainWindowByName (mainWindowId);
@@ -1233,7 +1233,7 @@ LayoutSaver::ScalingInfo::ScalingInfo(const QString &mainWindowId, Rect savedMai
12331233 mainWindowChangedScreen = currentScreenIndex != screenIndex;
12341234}
12351235
1236- void LayoutSaver::ScalingInfo::translatePos (Point &pt) const
1236+ void LayoutSaver::ScalingInfo::translatePos (QPoint &pt) const
12371237{
12381238 const int deltaX = pt.x () - savedMainWindowGeometry.x ();
12391239 const int deltaY = pt.y () - savedMainWindowGeometry.y ();
@@ -1245,24 +1245,24 @@ void LayoutSaver::ScalingInfo::translatePos(Point &pt) const
12451245 pt.setY (int (std::ceil (savedMainWindowGeometry.y () + newDeltaY)));
12461246}
12471247
1248- void LayoutSaver::ScalingInfo::applyFactorsTo (Point &pt) const
1248+ void LayoutSaver::ScalingInfo::applyFactorsTo (QPoint &pt) const
12491249{
12501250 translatePos (pt);
12511251}
12521252
1253- void LayoutSaver::ScalingInfo::applyFactorsTo (Size &sz) const
1253+ void LayoutSaver::ScalingInfo::applyFactorsTo (QSize &sz) const
12541254{
12551255 sz.setWidth (int (widthFactor * sz.width ()));
12561256 sz.setHeight (int (heightFactor * sz.height ()));
12571257}
12581258
1259- void LayoutSaver::ScalingInfo::applyFactorsTo (Rect &rect) const
1259+ void LayoutSaver::ScalingInfo::applyFactorsTo (QRect &rect) const
12601260{
12611261 if (rect.isEmpty ())
12621262 return ;
12631263
1264- Point pos = rect.topLeft ();
1265- Size size = rect.size ();
1264+ QPoint pos = rect.topLeft ();
1265+ QSize size = rect.size ();
12661266
12671267 applyFactorsTo (/* by-ref*/ size);
12681268
0 commit comments