Commit 89208d71 authored by Ignat Semenov's avatar Ignat Semenov
Browse files

do not scale the folderview icon when in panel

1)Keep the folderview panel icon size constant independent of the panel height / width.
2)Update icon size on panel icon size change using KGlobalSettings.
3)Check for m_iconWidget in the panle branch of constraintsEvent() to avoid creating duplicates / ghost entries on constraintEvent().

BUG:244557
FIXED-IN:4.8.1
REVIEW:103915
parent 84a2cb8b
......@@ -1121,6 +1121,8 @@ void FolderView::iconSettingsChanged(int group)
m_listView->setIconSize(QSize(size, size));
m_listView->markAreaDirty(m_listView->visibleArea());
m_listView->update();
updateGeometry();
}
}
......@@ -1222,7 +1224,7 @@ void FolderView::constraintsEvent(Plasma::Constraints constraints)
setupIconView();
}
setAspectRatioMode(Plasma::IgnoreAspectRatio);
} else {
} else if (!m_iconWidget) {
// Clean up the icon view
delete m_label;
delete m_iconView;
......@@ -1269,8 +1271,12 @@ void FolderView::constraintsEvent(Plasma::Constraints constraints)
layout->addItem(m_iconWidget);
setLayout(layout);
int iconSize = IconSize(KIconLoader::Panel);
setMinimumSize(QSizeF(iconSize, iconSize));
setAspectRatioMode(Plasma::ConstrainedSquare);
}
update();
}
if (constraints & Plasma::ScreenConstraint) {
......@@ -2089,11 +2095,25 @@ void FolderView::timerEvent(QTimerEvent *event)
QSizeF FolderView::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
{
if (which == Qt::PreferredSize) {
if (!constraint.isEmpty()) {
return QSizeF(600, 400).boundedTo(constraint);
} else {
return QSizeF(600, 400);
QSizeF size;
switch (formFactor()) {
case Plasma::Planar:
case Plasma::MediaCenter:
if (!constraint.isEmpty()) {
size = QSizeF(600, 400).boundedTo(constraint);
} else {
size = QSizeF(600, 400);
}
break;
case Plasma::Horizontal:
case Plasma::Vertical:
const int iconSize = IconSize(KIconLoader::Panel);
size = QSizeF(iconSize, iconSize);
break;
}
return size;
}
return Containment::sizeHint(which, constraint);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment