diff --git a/src/designer/src/components/formeditor/formwindowmanager.cpp b/src/designer/src/components/formeditor/formwindowmanager.cpp index 68c467407402c030913f1edfe9212c345adea093..ecb348ade14ebb7cadc94ff22454dbbbd6106cc9 100644 --- a/src/designer/src/components/formeditor/formwindowmanager.cpp +++ b/src/designer/src/components/formeditor/formwindowmanager.cpp @@ -742,10 +742,10 @@ QWidgetList FormWindowManager::layoutsToBeBroken(QWidget *w) const } -QMap<QWidget *, bool> FormWindowManager::getUnsortedLayoutsToBeBroken(bool firstOnly) const +QSet<QWidget *> FormWindowManager::getUnsortedLayoutsToBeBroken(bool firstOnly) const { // Return a set of layouts to be broken. - QMap<QWidget *, bool> layouts; + QSet<QWidget *> layouts; QWidgetList selection = m_activeFormWindow->selectedWidgets(); if (selection.isEmpty() && m_activeFormWindow->mainContainer()) @@ -756,7 +756,7 @@ QMap<QWidget *, bool> FormWindowManager::getUnsortedLayoutsToBeBroken(bool first const QWidgetList &list = layoutsToBeBroken(selectedWidget); if (!list.empty()) { for (QWidget *widget : list) - layouts.insert(widget, true); + layouts.insert(widget); if (firstOnly) return layouts; } @@ -774,12 +774,10 @@ QWidgetList FormWindowManager::layoutsToBeBroken() const { // Get all layouts. This is a list of all 'red' layouts (QLayoutWidgets) // up to the first 'real' widget with a layout in hierarchy order. - QMap<QWidget *, bool> unsortedLayouts = getUnsortedLayoutsToBeBroken(false); + const QSet<QWidget *> unsortedLayouts = getUnsortedLayoutsToBeBroken(false); // Sort in order of hierarchy QWidgetList orderedLayoutList; - const QMap<QWidget *, bool>::const_iterator lscend = unsortedLayouts.constEnd(); - for (QMap<QWidget *, bool>::const_iterator itLay = unsortedLayouts.constBegin(); itLay != lscend; ++itLay) { - QWidget *wToBeInserted = itLay.key(); + for (QWidget *wToBeInserted : unsortedLayouts) { if (!orderedLayoutList.contains(wToBeInserted)) { // try to find first child, use as insertion position, else append const QWidgetList::iterator firstChildPos = findFirstChildOf(orderedLayoutList.begin(), orderedLayoutList.end(), wToBeInserted); diff --git a/src/designer/src/components/formeditor/formwindowmanager.h b/src/designer/src/components/formeditor/formwindowmanager.h index c6f19d210fa79746a363ff0321b23f222162941a..fb8d58bd99886ce67a9c203835ba5bee7ac8838b 100644 --- a/src/designer/src/components/formeditor/formwindowmanager.h +++ b/src/designer/src/components/formeditor/formwindowmanager.h @@ -37,6 +37,7 @@ #include <QtCore/qlist.h> #include <QtCore/qpointer.h> #include <QtCore/qmap.h> +#include <QtCore/qset.h> QT_BEGIN_NAMESPACE @@ -158,7 +159,7 @@ private: QAction *m_actionUndo; QAction *m_actionRedo; - QMap<QWidget *,bool> getUnsortedLayoutsToBeBroken(bool firstOnly) const; + QSet<QWidget *> getUnsortedLayoutsToBeBroken(bool firstOnly) const; bool hasLayoutsToBeBroken() const; QWidgetList layoutsToBeBroken(QWidget *w) const; QWidgetList layoutsToBeBroken() const;