[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/runtime/plasma/containments/newspaper
From: Marco Martin <notmart () gmail ! com>
Date: 2011-01-22 22:00:00
Message-ID: 20110122220000.42398AC8B9 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1216375 by mart:
try to reize columns based on applets hints.
center if the contents are smaller than the view
this fixes the behaviour of newspaper in plasma-desktop quite a lot, is probably worth backporting
M +19 -0 appletscontainer.cpp
M +1 -0 appletsview.cpp
--- trunk/KDE/kdebase/runtime/plasma/containments/newspaper/appletscontainer.cpp #1216374:1216375
@@ -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));
--- trunk/KDE/kdebase/runtime/plasma/containments/newspaper/appletsview.cpp #1216374:1216375
@@ -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