From kde-commits Fri Jul 03 03:15:47 2009 From: =?utf-8?q?Aaron=20J=2E=20Seigo?= Date: Fri, 03 Jul 2009 03:15:47 +0000 To: kde-commits Subject: KDE/kdebase/workspace/plasma/containments/panel Message-Id: <1246590947.840250.20090.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=124659095527883 SVN commit 990708 by aseigo: we only care about adjusting to the old margin when the theme changes; in all other cases we should simple care about what the borders are now. BUG:198712 M +17 -8 panel.cpp M +1 -1 panel.h --- trunk/KDE/kdebase/workspace/plasma/containments/panel/panel.cpp #990707:990708 @@ -462,7 +462,7 @@ } } -void Panel::updateBorders(const QRect &geom) +void Panel::updateBorders(const QRect &geom, bool themeChange) { Plasma::Location loc = location(); FrameSvg::EnabledBorders enabledBorders = FrameSvg::AllBorders; @@ -509,10 +509,12 @@ enabledBorders ^= FrameSvg::LeftBorder; leftWidth = 0; } + if (geom.y() <= r.y()) { enabledBorders ^= FrameSvg::TopBorder; topHeight = 0; } + if (geom.bottom() >= r.bottom()) { enabledBorders ^= FrameSvg::BottomBorder; bottomHeight = 0; @@ -558,18 +560,25 @@ default: break; } - qreal oldLeft, oldTop, oldRight, oldBottom; - layout()->getContentsMargins(&oldLeft, &oldTop, &oldRight, &oldBottom); + qreal oldLeft = leftWidth; + qreal oldTop = topHeight; + qreal oldRight = rightWidth; + qreal oldBottom = bottomHeight; + + if (themeChange) { + layout()->getContentsMargins(&oldLeft, &oldTop, &oldRight, &oldBottom); + } + layout()->setContentsMargins(leftWidth, topHeight, rightWidth, bottomHeight); - if (formFactor() == Plasma::Vertical) { - setPreferredHeight(preferredHeight() - (oldBottom-bottomHeight)); + setPreferredHeight(preferredHeight() - (oldBottom - bottomHeight)); } else if (QApplication::layoutDirection() == Qt::LeftToRight) { - setPreferredWidth(preferredWidth() - (oldRight-rightWidth)); + setPreferredWidth(preferredWidth() - (oldRight - rightWidth)); } else { - setPreferredWidth(preferredWidth() - (oldLeft-leftWidth)); + setPreferredWidth(preferredWidth() - (oldLeft - leftWidth)); } + layout()->invalidate(); resize(preferredSize()); } @@ -693,7 +702,7 @@ setMinimumHeight(newSize.height()); } - updateBorders(geometry().toRect()); + updateBorders(geometry().toRect(), true); } void Panel::paintInterface(QPainter *painter, --- trunk/KDE/kdebase/workspace/plasma/containments/panel/panel.h #990707:990708 @@ -75,7 +75,7 @@ /** * recalculate which borders to show */ - void updateBorders(const QRect &geom); + void updateBorders(const QRect &geom, bool themeChange = false); Plasma::FrameSvg *m_background; QMenu *m_addPanelsMenu;