mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
Information Panel: If the width of the panel is increased, also increase the size of the item preview to take advantege of the additional space.
BUG: 156046 svn path=/trunk/KDE/kdebase/apps/; revision=770173
This commit is contained in:
parent
a6d36df99e
commit
cd65336b8c
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue