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

List:       kde-commits
Subject:    branches/KDE/4.6/kdebase/runtime/plasma/containments/newspaper
From:       Marco Martin <notmart () gmail ! com>
Date:       2011-01-22 22:24:49
Message-ID: 20110122222449.1F6B4AC8B9 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1216381 by mart:

backport the resizing strategy based on hints: a quite of a behaviour change but \
fixes the terrible misbehaviour of the newspaper containment in enormous desktops \
(since it wasn't meant for them)


 M  +19 -0     appletscontainer.cpp  
 M  +1 -0      appletsview.cpp  


--- branches/KDE/4.6/kdebase/runtime/plasma/containments/newspaper/appletscontainer.cpp \
#1216380:1216381 @@ -107,7 +107,26 @@
     const int margin = 4 + (m_mainLayout->count() - 1) * m_mainLayout->spacing();
 
     QSizeF viewportSize = m_scrollWidget->viewportGeometry().size();
+    QSizeF maxSize;
 
+    //try to figure out the column size from the applets size hints
+    if (m_orientation == Qt::Vertical && m_containment) {
+        foreach (Plasma::Applet *applet, m_containment->applets()) {
+            QSizeF appletSize = applet->effectiveSizeHint(Qt::PreferredSize);
+            if (appletSize.width() > maxSize.width()) {
+                maxSize.setWidth(appletSize.width());
+            }
+            if (appletSize.height() > maxSize.height()) {
+                maxSize.setHeight(appletSize.height());
+            }
+        }
+        const QSizeF sizeFromHints = maxSize * m_mainLayout->count();
+        //a bit of snap to avoid contents just too large
+        if (qAbs(sizeFromHints.width() - viewportSize.width()) > 128) {
+            viewportSize = sizeFromHints;
+        }
+    }
+
     for (int i = 0; i < m_mainLayout->count(); ++i) {
         QGraphicsLinearLayout *lay = dynamic_cast<QGraphicsLinearLayout \
*>(m_mainLayout->itemAt(i));  
--- branches/KDE/4.6/kdebase/runtime/plasma/containments/newspaper/appletsview.cpp \
#1216380:1216381 @@ -42,6 +42,7 @@
       m_dragTimeout(1000)
 {
     m_dragCountdown = new DragCountdown(this);
+    setAlignment(Qt::AlignCenter);
 
     connect(m_dragCountdown, SIGNAL(dragRequested()), this, \
SLOT(appletDragRequested()));  


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

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