┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/infosidebarpage.cpp11
-rw-r--r--src/pixmapviewer.cpp17
-rw-r--r--src/pixmapviewer.h8
3 files changed, 32 insertions, 4 deletions
diff --git a/src/infosidebarpage.cpp b/src/infosidebarpage.cpp
index bcb28aa19..767c3278e 100644
--- a/src/infosidebarpage.cpp
+++ b/src/infosidebarpage.cpp
@@ -69,7 +69,7 @@ InfoSidebarPage::InfoSidebarPage(QWidget* parent) :
// preview
m_preview = new PixmapViewer(this);
m_preview->setMinimumWidth(KIconLoader::SizeEnormous);
- m_preview->setFixedHeight(KIconLoader::SizeEnormous);
+ m_preview->setMinimumHeight(KIconLoader::SizeEnormous);
// name
m_nameLabel = new QLabel(this);
@@ -169,6 +169,11 @@ void InfoSidebarPage::resizeEvent(QResizeEvent* event)
const int maxWidth = event->size().width() - KDialog::spacingHint() * 4;
m_nameLabel->setMaximumWidth(maxWidth);
m_infoLabel->setMaximumWidth(maxWidth);
+
+ // try to increase the preview as large as possible
+ m_preview->setSizeHint(QSize(maxWidth, maxWidth));
+ m_timer->start(TimerDelay);
+
SidebarPage::resizeEvent(event);
}
@@ -196,7 +201,7 @@ void InfoSidebarPage::showItemInfo()
KIconLoader iconLoader;
QPixmap icon = iconLoader.loadIcon("system-run",
KIconLoader::NoGroup,
- KIconLoader::SizeEnormous);
+ m_preview->width());
m_preview->setPixmap(icon);
m_nameLabel->setText(i18ncp("@info", "%1 item selected", "%1 items selected", selectedItems.count()));
} else if (!applyPlace(file)) {
@@ -209,7 +214,7 @@ void InfoSidebarPage::showItemInfo()
KIO::PreviewJob* job = KIO::filePreview(list,
m_preview->width(),
- KIconLoader::SizeEnormous,
+ m_preview->height(),
0,
0,
true,
diff --git a/src/pixmapviewer.cpp b/src/pixmapviewer.cpp
index a7a593bb0..f535475aa 100644
--- a/src/pixmapviewer.cpp
+++ b/src/pixmapviewer.cpp
@@ -21,6 +21,7 @@
#include <kiconloader.h>
+#include <QLayout>
#include <QPainter>
#include <QPixmap>
#include <QKeyEvent>
@@ -28,7 +29,8 @@
PixmapViewer::PixmapViewer(QWidget* parent, Transition transition) :
QWidget(parent),
m_transition(transition),
- m_animationStep(0)
+ m_animationStep(0),
+ m_sizeHint()
{
setMinimumWidth(KIconLoader::SizeEnormous);
setMinimumHeight(KIconLoader::SizeEnormous);
@@ -72,6 +74,19 @@ void PixmapViewer::setPixmap(const QPixmap& pixmap)
}
}
+void PixmapViewer::setSizeHint(const QSize& size)
+{
+ m_sizeHint = size;
+ if ((parentWidget() != 0) && (parentWidget()->layout() != 0)) {
+ parentWidget()->layout()->activate();
+ }
+}
+
+QSize PixmapViewer::sizeHint() const
+{
+ return m_sizeHint;
+}
+
void PixmapViewer::paintEvent(QPaintEvent* event)
{
QWidget::paintEvent(event);
diff --git a/src/pixmapviewer.h b/src/pixmapviewer.h
index 01d8cf1c1..26e520aab 100644
--- a/src/pixmapviewer.h
+++ b/src/pixmapviewer.h
@@ -66,6 +66,13 @@ public:
void setPixmap(const QPixmap& pixmap);
const QPixmap& pixmap() const;
+ /**
+ * Sets the size hint to \a size and triggers a relayout
+ * of the parent widget. Per default no size hint is given.
+ */
+ void setSizeHint(const QSize& size);
+ virtual QSize sizeHint() const;
+
protected:
virtual void paintEvent(QPaintEvent* event);
@@ -79,6 +86,7 @@ private:
QTimeLine m_animation;
Transition m_transition;
int m_animationStep;
+ QSize m_sizeHint;
};
inline const QPixmap& PixmapViewer::pixmap() const