┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/pixmapviewer.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-05-03 05:52:11 +0000
committerPeter Penz <[email protected]>2007-05-03 05:52:11 +0000
commit0bdc4821e4d3f426711185516347e1ae0ad88943 (patch)
tree2b25febdcebf368d1ee14230d8054d24772ca555 /src/pixmapviewer.cpp
parent7f2033899d72527c5fcb533644f4068eeb2f332a (diff)
allow to specify a transition type
svn path=/trunk/KDE/kdebase/apps/; revision=660579
Diffstat (limited to 'src/pixmapviewer.cpp')
-rw-r--r--src/pixmapviewer.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/pixmapviewer.cpp b/src/pixmapviewer.cpp
index e4d417d47..4e3aa4830 100644
--- a/src/pixmapviewer.cpp
+++ b/src/pixmapviewer.cpp
@@ -1,6 +1,5 @@
/***************************************************************************
- * Copyright (C) 2006 by Peter Penz *
+ * Copyright (C) 2006 by Peter Penz <[email protected]> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -25,8 +24,9 @@
#include <QtGui/QPixmap>
#include <QtGui/QPaintEvent>
-PixmapViewer::PixmapViewer(QWidget* parent) :
+PixmapViewer::PixmapViewer(QWidget* parent, Transition transition) :
QWidget(parent),
+ m_transition(transition),
m_animationStep(0)
{
setMinimumWidth(K3Icon::SizeEnormous);
@@ -48,8 +48,11 @@ void PixmapViewer::setPixmap(const QPixmap& pixmap)
m_oldPixmap = m_pixmap.isNull() ? pixmap : m_pixmap;
m_pixmap = pixmap;
+ update();
- m_animation.start();
+ if (m_transition != NoTransition) {
+ m_animation.start();
+ }
}
void PixmapViewer::paintEvent(QPaintEvent* event)
@@ -65,7 +68,9 @@ void PixmapViewer::paintEvent(QPaintEvent* event)
const int x = (width() - scaledWidth ) / 2;
const int y = (height() - scaledHeight) / 2;
- const QPixmap& largePixmap = (m_oldPixmap.width() > m_pixmap.width()) ? m_oldPixmap : m_pixmap;
+ const bool useOldPixmap = (m_transition == SizeTransition) &&
+ (m_oldPixmap.width() > m_pixmap.width());
+ const QPixmap& largePixmap = useOldPixmap ? m_oldPixmap : m_pixmap;
const QPixmap scaledPixmap = largePixmap.scaled(scaledWidth,
scaledHeight,
Qt::IgnoreAspectRatio,