[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.6/kdelibs/plasma
From:       Marco Martin <notmart () gmail ! com>
Date:       2011-01-04 16:55:00
Message-ID: 20110104165500.73E2CAC8AE () svn ! kde ! org
[Download RAW message or body]

SVN commit 1211688 by mart:

backport borders fix in case of dialog at edge of screen + extenders


 M  +15 -3     dialog.cpp  
 M  +1 -12     extenders/extender.cpp  


--- branches/KDE/4.6/kdelibs/plasma/dialog.cpp #1211687:1211688
@@ -53,6 +53,7 @@
 #include "plasma/private/extender_p.h"
 #include "plasma/framesvg.h"
 #include "plasma/theme.h"
+#include "plasma/widgets/scrollwidget.h"
 #include "plasma/windoweffects.h"
 
 #ifdef Q_WS_X11
@@ -239,9 +240,7 @@
 
     background->setEnabledBorders(borders);
 
-    if (!extender) {
-        background->getMargins(leftWidth, topHeight, rightWidth, bottomHeight);
-    } else {
+    if (extender)  {
         FrameSvg::EnabledBorders disabledBorders = FrameSvg::NoBorder;
         if (!(borders & FrameSvg::LeftBorder)) {
             disabledBorders |= FrameSvg::LeftBorder;
@@ -250,7 +249,20 @@
             disabledBorders |= FrameSvg::RightBorder;
         }
         extender->d->setDisabledBordersHint(disabledBorders);
+
+        //if there is a scrollbar, reserve a margin to not draw it over the shadow
+        qreal left, top, right, bottom;
+        background->getMargins(left, top, right, bottom);
+        if (extender->d->scrollWidget->viewportGeometry().height() < \
extender->d->scrollWidget->contentsSize().height()) { +            if \
(QApplication::layoutDirection() == Qt::RightToLeft) { +                leftWidth = \
left; +            } else {
+                rightWidth = right;
     }
+        }
+    } else {
+        background->getMargins(leftWidth, topHeight, rightWidth, bottomHeight);
+    }
 
     //kDebug() << leftWidth << topHeight << rightWidth << bottomHeight;
     q->setContentsMargins(leftWidth, topHeight, rightWidth, bottomHeight);
--- branches/KDE/4.6/kdelibs/plasma/extenders/extender.cpp #1211687:1211688
@@ -884,18 +884,7 @@
         return;
     }
 
-    bool scroll;
-    if (rect.height() >= mainWidget->boundingRect().height()) {
-        scroll = false;
-        scrollWidget->setContentsMargins(0, 0, 0, 0);
-    } else {
-        scroll = true;
-        if (QApplication::layoutDirection() == Qt::RightToLeft) {
-            scrollWidget->setContentsMargins(background->marginSize(RightMargin), 0, \
                0, 0);
-        } else {
-            scrollWidget->setContentsMargins(0, 0, \
                background->marginSize(RightMargin), 0);
-        }
-    }
+    bool scroll = !(rect.height() >= mainWidget->boundingRect().height());
 
     if (scroll != scrollbarVisible) {
         scrollbarVisible = scroll;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic