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

List:       kde-commits
Subject:    branches/KDE/4.2/kdelibs/kio/kio
From:       Fredrik Höglund <fredrik () kde ! org>
Date:       2009-02-24 23:47:23
Message-ID: 1235519243.903352.26023.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 931214 by fredrik:

Make sure the active margins are initialized in all functions that
need to do layout computations.


 M  +8 -1      kfileitemdelegate.cpp  


--- branches/KDE/4.2/kdelibs/kio/kio/kfileitemdelegate.cpp #931213:931214
@@ -130,7 +130,7 @@
 KFileItemDelegate::Private::Private(KFileItemDelegate *parent)
      : shadowColor(Qt::transparent), shadowOffset(1, 1), shadowBlur(2), maximumSize(0, 0),
        showToolTipWhenElided(true), q(parent),
-       animationHandler(new KIO::DelegateAnimationHandler(parent))
+       animationHandler(new KIO::DelegateAnimationHandler(parent)), activeMargins(0)
 {
 }
 
@@ -174,6 +174,7 @@
 
 QRect KFileItemDelegate::Private::addMargin(const QRect &rect, MarginType type) const
 {
+    Q_ASSERT(activeMargins != 0);
     const Margin &m = activeMargins[type];
     return rect.adjusted(-m.left, -m.top, m.right, m.bottom);
 }
@@ -181,6 +182,7 @@
 
 QRect KFileItemDelegate::Private::subtractMargin(const QRect &rect, MarginType type) const
 {
+    Q_ASSERT(activeMargins != 0);
     const Margin &m = activeMargins[type];
     return rect.adjusted(m.left, m.top, -m.right, -m.bottom);
 }
@@ -188,6 +190,7 @@
 
 QSize KFileItemDelegate::Private::addMargin(const QSize &size, MarginType type) const
 {
+    Q_ASSERT(activeMargins != 0);
     const Margin &m = activeMargins[type];
     return QSize(size.width() + m.left + m.right, size.height() + m.top + m.bottom);
 }
@@ -195,6 +198,7 @@
 
 QSize KFileItemDelegate::Private::subtractMargin(const QSize &size, MarginType type) const
 {
+    Q_ASSERT(activeMargins != 0);
     const Margin &m = activeMargins[type];
     return QSize(size.width() - m.left - m.right, size.height() - m.top - m.bottom);
 }
@@ -1315,6 +1319,7 @@
 {
     QStyleOptionViewItemV4 opt(option);
     d->initStyleOption(&opt, index);
+    d->setActiveMargins(d->verticalLayout(opt) ? Qt::Vertical : Qt::Horizontal);
 
     QRect r = d->labelRectangle(opt);
 
@@ -1360,6 +1365,7 @@
     // show it only in the case the display information is elided
     QStyleOptionViewItemV4 opt(option);
     d->initStyleOption(&opt, index);
+    d->setActiveMargins(d->verticalLayout(opt) ? Qt::Vertical : Qt::Horizontal);
 
     QTextLayout labelLayout;
     QTextLayout infoLayout;
@@ -1378,6 +1384,7 @@
 {
     QStyleOptionViewItemV4 opt(option);
     d->initStyleOption(&opt, index);
+    d->setActiveMargins(d->verticalLayout(opt) ? Qt::Vertical : Qt::Horizontal);
 
     QTextLayout labelLayout;
     QTextLayout infoLayout;
[prev in list] [next in list] [prev in thread] [next in thread] 

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