plasma: remove check for non-existing iconRepresentation property in widget snapshotter

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-05-20 21:09:08 +03:00
parent 3586873aa9
commit b0becab9c2
3 changed files with 9 additions and 41 deletions

View file

@ -22,7 +22,7 @@
#include <QGraphicsWidget>
#include <QParallelAnimationGroup>
#include <QPropertyAnimation>
#include <QtCore/qsharedpointer.h>
#include <QWeakPointer>
#include <kdebug.h>
@ -63,7 +63,7 @@ void PulseAnimation::setCopy()
}
if (!m_under.data()) {
m_under = new WidgetSnapShot;
m_under = new WidgetSnapShot();
}
m_under.data()->setTarget(target);
@ -97,14 +97,8 @@ void PulseAnimation::updateState(QAbstractAnimation::State newState, QAbstractAn
setCopy();
}
if (m_under.data()->isIconBigger()) {
m_under.data()->setScale(0);
m_endScale = 1.0;
} else {
m_scale = 0;
m_endScale = 1.5;
}
if (m_under.data()->isVisible() == false) {
m_under.data()->setVisible(true);
@ -122,13 +116,9 @@ void PulseAnimation::updateEffectiveTime(int currentTime)
if (m_under.data()) {
qreal delta = currentTime / qreal(duration());
if (m_under.data()->isIconBigger()) {
m_under.data()->setScale(delta);
} else {
m_under.data()->setScale(delta);
delta = (1 - m_endScale) * delta;
m_under.data()->setScale(1 - delta);
}
delta = currentTime / qreal(duration());
if (direction() == Forward) {

View file

@ -20,7 +20,7 @@
#include <QPainter>
#include <QImage>
#include <QPixmap>
#include <QtGui/qstyleoption.h>
#include <QStyleOptionGraphicsItem>
#include <QDebug>
static const int RECURSION_MAX = 20;
@ -30,9 +30,8 @@ namespace Plasma
WidgetSnapShot::WidgetSnapShot(QGraphicsItem *parent)
: QGraphicsWidget(parent),
m_iconBig(false),
stack(0),
m_target(0)
m_target(nullptr)
{
}
@ -77,18 +76,6 @@ void WidgetSnapShot::setTarget(QGraphicsWidget *target)
m_target = target;
setParentItem(target);
QSize size(target->size().toSize());
m_iconBig = false;
if (m_target->property("iconRepresentation").isValid()) {
m_iconBig = true;
m_snapShot = QPixmap::fromImage(
m_target->property("iconRepresentation").value<QImage>());
if ((m_snapShot.height() > 0) && (m_snapShot.width() > 0)) {
resize(m_snapShot.size());
setTransformOriginPoint(target->geometry().center());
return;
}
}
resize(target->size());
@ -114,12 +101,6 @@ QGraphicsWidget *WidgetSnapShot::target() const
return m_target;
}
bool WidgetSnapShot::isIconBigger() const
{
return m_iconBig;
}
QPixmap WidgetSnapShot::snapShot() const
{
return m_snapShot;

View file

@ -39,8 +39,6 @@ public:
const QStyleOptionGraphicsItem *option,
QWidget *widget);
bool isIconBigger() const;
QPixmap snapShot() const;
private:
@ -48,7 +46,6 @@ private:
const QStyleOptionGraphicsItem *option,
QGraphicsItem *target);
bool m_iconBig;
int stack;
QPixmap m_snapShot;
QGraphicsWidget *m_target;