Change in plasma-framework[master]: never resize a dialog bigger than the screen

Marco Martin (Code Review) noreply at kde.org
Fri Jan 16 11:25:05 UTC 2015


Marco Martin has uploaded a new change for review.

  https://gerrit.vesnicky.cesnet.cz/r/334

Change subject: never resize a dialog bigger than the screen
......................................................................

never resize a dialog bigger than the screen

in cases screen resolution is quite low, and font size is enormous, popups
tend to become bigger than the screen
BUG:337041

Change-Id: I840868dbd7db665a3953687977d30dd6c3b4a386
---
M src/plasmaquick/dialog.cpp
1 file changed, 19 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.vesnicky.cesnet.cz:29418/plasma-framework refs/changes/34/334/1

diff --git a/src/plasmaquick/dialog.cpp b/src/plasmaquick/dialog.cpp
index 8c38f47..95d9497 100644
--- a/src/plasmaquick/dialog.cpp
+++ b/src/plasmaquick/dialog.cpp
@@ -331,6 +331,9 @@
     //on the scene
     auto margin = frameSvgItem->fixedMargins();
     int minimumWidth = mainItemLayout->property("minimumWidth").toInt() + margin->left() + margin->right();
+    if (q->screen()) {
+        minimumWidth = qMin(q->screen()->availableGeometry().width(), minimumWidth);
+    }
     q->contentItem()->setWidth(qMax(q->width(), minimumWidth));
     q->setWidth(qMax(q->width(), minimumWidth));
 
@@ -354,6 +357,10 @@
     //on the scene
     auto margin = frameSvgItem->fixedMargins();
     int minimumHeight = mainItemLayout->property("minimumHeight").toInt() + margin->top() + margin->bottom();
+    if (q->screen()) {
+        minimumHeight = qMin(q->screen()->availableGeometry().height(), minimumHeight);
+        
+    }
     q->contentItem()->setHeight(qMax(q->height(), minimumHeight));
     q->setHeight(qMax(q->height(), minimumHeight));
 
@@ -373,6 +380,9 @@
 
     auto margin = frameSvgItem->fixedMargins();
     int maximumWidth = mainItemLayout->property("maximumWidth").toInt() + margin->left() + margin->right();
+    if (q->screen()) {
+        maximumWidth = qMin(q->screen()->availableGeometry().width(), maximumWidth);
+    }
     q->contentItem()->setWidth(qMax(q->width(), maximumWidth));
     q->setWidth(qMax(q->width(), maximumWidth));
 
@@ -392,6 +402,9 @@
 
     auto margin = frameSvgItem->fixedMargins();
     int maximumHeight = mainItemLayout->property("maximumHeight").toInt() + margin->top() + margin->bottom();
+    if (q->screen()) {
+        maximumHeight = qMin(q->screen()->availableGeometry().height(), maximumHeight);
+    }
     q->contentItem()->setHeight(qMax(q->height(), maximumHeight));
     q->setHeight(qMin(q->height(), maximumHeight));
 
@@ -423,6 +436,12 @@
     minimumWidth += margin->left() + margin->right();
     maximumWidth += margin->left() + margin->right();
 
+    if (q->screen()) {
+        minimumWidth = qMin(q->screen()->availableGeometry().width(), minimumWidth);
+        minimumHeight = qMin(q->screen()->availableGeometry().height(), minimumHeight);
+        maximumWidth = qMin(q->screen()->availableGeometry().width(), maximumWidth);
+        maximumHeight = qMin(q->screen()->availableGeometry().height(), maximumHeight);
+    }
 
     const QSize finalSize(qBound(minimumWidth, q->width(), maximumWidth),
                           qBound(minimumHeight, q->height(), maximumHeight));

-- 
To view, visit https://gerrit.vesnicky.cesnet.cz/r/334
To unsubscribe, visit https://gerrit.vesnicky.cesnet.cz/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I840868dbd7db665a3953687977d30dd6c3b4a386
Gerrit-PatchSet: 1
Gerrit-Project: plasma-framework
Gerrit-Branch: master
Gerrit-Owner: Marco Martin <notmart at gmail.com>


More information about the Plasma-devel mailing list