Changeset View
Changeset View
Standalone View
Standalone View
src/plasmaquick/dialog.cpp
Show First 20 Lines • Show All 173 Lines • ▼ Show 20 Line(s) | |||||
174 | { | 174 | { | ||
175 | // FIXME: QWindow::screen() never ever changes if the window is moved across | 175 | // FIXME: QWindow::screen() never ever changes if the window is moved across | ||
176 | // virtual screens (normal two screens with X), this seems to be intentional | 176 | // virtual screens (normal two screens with X), this seems to be intentional | ||
177 | // as it's explicitly mentioned in the docs. Until that's changed or some | 177 | // as it's explicitly mentioned in the docs. Until that's changed or some | ||
178 | // more proper way of howto get the current QScreen for given QWindow is found, | 178 | // more proper way of howto get the current QScreen for given QWindow is found, | ||
179 | // we simply iterate over the virtual screens and pick the one our QWindow | 179 | // we simply iterate over the virtual screens and pick the one our QWindow | ||
180 | // says it's at. | 180 | // says it's at. | ||
181 | QRect avail; | 181 | QRect avail; | ||
182 | Q_FOREACH (QScreen *screen, QGuiApplication::screens()) { | 182 | const auto screens = QGuiApplication::screens(); | ||
183 | for (QScreen *screen : screens) { | ||||
183 | //we check geometry() but then take availableGeometry() | 184 | //we check geometry() but then take availableGeometry() | ||
184 | //to reliably check in which screen a position is, we need the full | 185 | //to reliably check in which screen a position is, we need the full | ||
185 | //geometry, including areas for panels | 186 | //geometry, including areas for panels | ||
186 | if (screen->geometry().contains(pos)) { | 187 | if (screen->geometry().contains(pos)) { | ||
187 | avail = screen->availableGeometry(); | 188 | avail = screen->availableGeometry(); | ||
188 | break; | 189 | break; | ||
189 | } | 190 | } | ||
190 | } | 191 | } | ||
▲ Show 20 Lines • Show All 679 Lines • ▼ Show 20 Line(s) | 865 | if (mainItem) { | |||
870 | 871 | | |||
871 | //Extract the representation's Layout, if any | 872 | //Extract the representation's Layout, if any | ||
872 | QObject *layout = nullptr; | 873 | QObject *layout = nullptr; | ||
873 | setMinimumSize(QSize(0, 0)); | 874 | setMinimumSize(QSize(0, 0)); | ||
874 | setMaximumSize(QSize(DIALOGSIZE_MAX, DIALOGSIZE_MAX)); | 875 | setMaximumSize(QSize(DIALOGSIZE_MAX, DIALOGSIZE_MAX)); | ||
875 | 876 | | |||
876 | //Search a child that has the needed Layout properties | 877 | //Search a child that has the needed Layout properties | ||
877 | //HACK: here we are not type safe, but is the only way to access to a pointer of Layout | 878 | //HACK: here we are not type safe, but is the only way to access to a pointer of Layout | ||
878 | foreach (QObject *child, mainItem->children()) { | 879 | const auto lstChild = mainItem->children(); | ||
880 | for (QObject *child : lstChild) { | ||||
879 | //find for the needed property of Layout: minimum/maximum/preferred sizes and fillWidth/fillHeight | 881 | //find for the needed property of Layout: minimum/maximum/preferred sizes and fillWidth/fillHeight | ||
880 | if (child->property("minimumWidth").isValid() && child->property("minimumHeight").isValid() && | 882 | if (child->property("minimumWidth").isValid() && child->property("minimumHeight").isValid() && | ||
881 | child->property("preferredWidth").isValid() && child->property("preferredHeight").isValid() && | 883 | child->property("preferredWidth").isValid() && child->property("preferredHeight").isValid() && | ||
882 | child->property("maximumWidth").isValid() && child->property("maximumHeight").isValid() && | 884 | child->property("maximumWidth").isValid() && child->property("maximumHeight").isValid() && | ||
883 | child->property("fillWidth").isValid() && child->property("fillHeight").isValid() | 885 | child->property("fillWidth").isValid() && child->property("fillHeight").isValid() | ||
884 | ) { | 886 | ) { | ||
885 | layout = child; | 887 | layout = child; | ||
886 | break; | 888 | break; | ||
▲ Show 20 Lines • Show All 569 Lines • Show Last 20 Lines |