Changeset View
Changeset View
Standalone View
Standalone View
src/plasmaquick/dialog.cpp
Show First 20 Lines • Show All 167 Lines • ▼ Show 20 Line(s) | |||||
168 | { | 168 | { | ||
169 | // FIXME: QWindow::screen() never ever changes if the window is moved across | 169 | // FIXME: QWindow::screen() never ever changes if the window is moved across | ||
170 | // virtual screens (normal two screens with X), this seems to be intentional | 170 | // virtual screens (normal two screens with X), this seems to be intentional | ||
171 | // as it's explicitly mentioned in the docs. Until that's changed or some | 171 | // as it's explicitly mentioned in the docs. Until that's changed or some | ||
172 | // more proper way of howto get the current QScreen for given QWindow is found, | 172 | // more proper way of howto get the current QScreen for given QWindow is found, | ||
173 | // we simply iterate over the virtual screens and pick the one our QWindow | 173 | // we simply iterate over the virtual screens and pick the one our QWindow | ||
174 | // says it's at. | 174 | // says it's at. | ||
175 | QRect avail; | 175 | QRect avail; | ||
176 | Q_FOREACH (QScreen *screen, QGuiApplication::screens()) { | 176 | const auto screens = QGuiApplication::screens(); | ||
177 | for (QScreen *screen : screens) { | ||||
177 | //we check geometry() but then take availableGeometry() | 178 | //we check geometry() but then take availableGeometry() | ||
178 | //to reliably check in which screen a position is, we need the full | 179 | //to reliably check in which screen a position is, we need the full | ||
179 | //geometry, including areas for panels | 180 | //geometry, including areas for panels | ||
180 | if (screen->geometry().contains(pos)) { | 181 | if (screen->geometry().contains(pos)) { | ||
181 | avail = screen->availableGeometry(); | 182 | avail = screen->availableGeometry(); | ||
182 | break; | 183 | break; | ||
183 | } | 184 | } | ||
184 | } | 185 | } | ||
▲ Show 20 Lines • Show All 612 Lines • ▼ Show 20 Line(s) | 792 | if (mainItem) { | |||
797 | 798 | | |||
798 | //Extract the representation's Layout, if any | 799 | //Extract the representation's Layout, if any | ||
799 | QObject *layout = nullptr; | 800 | QObject *layout = nullptr; | ||
800 | setMinimumSize(QSize(0, 0)); | 801 | setMinimumSize(QSize(0, 0)); | ||
801 | setMaximumSize(QSize(DIALOGSIZE_MAX, DIALOGSIZE_MAX)); | 802 | setMaximumSize(QSize(DIALOGSIZE_MAX, DIALOGSIZE_MAX)); | ||
802 | 803 | | |||
803 | //Search a child that has the needed Layout properties | 804 | //Search a child that has the needed Layout properties | ||
804 | //HACK: here we are not type safe, but is the only way to access to a pointer of Layout | 805 | //HACK: here we are not type safe, but is the only way to access to a pointer of Layout | ||
805 | foreach (QObject *child, mainItem->children()) { | 806 | const auto lstChild = mainItem->children(); | ||
807 | for (QObject *child : lstChild) { | ||||
806 | //find for the needed property of Layout: minimum/maximum/preferred sizes and fillWidth/fillHeight | 808 | //find for the needed property of Layout: minimum/maximum/preferred sizes and fillWidth/fillHeight | ||
807 | if (child->property("minimumWidth").isValid() && child->property("minimumHeight").isValid() && | 809 | if (child->property("minimumWidth").isValid() && child->property("minimumHeight").isValid() && | ||
808 | child->property("preferredWidth").isValid() && child->property("preferredHeight").isValid() && | 810 | child->property("preferredWidth").isValid() && child->property("preferredHeight").isValid() && | ||
809 | child->property("maximumWidth").isValid() && child->property("maximumHeight").isValid() && | 811 | child->property("maximumWidth").isValid() && child->property("maximumHeight").isValid() && | ||
810 | child->property("fillWidth").isValid() && child->property("fillHeight").isValid() | 812 | child->property("fillWidth").isValid() && child->property("fillHeight").isValid() | ||
811 | ) { | 813 | ) { | ||
812 | layout = child; | 814 | layout = child; | ||
813 | break; | 815 | break; | ||
▲ Show 20 Lines • Show All 581 Lines • Show Last 20 Lines |