Plasma
itembackground.h
Go to the documentation of this file.
00001 /*************************************************************************** 00002 * Copyright 2009 by Alessandro Diaferia <alediaferia@gmail.com> * 00003 * Copyright 2009 by Marco Martin <notmart@gmail.com> * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU Library General Public License as * 00007 * published by the Free Software Foundation; either version 2, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 00019 ***************************************************************************/ 00020 00021 #ifndef ITEMBACKGROUND_H 00022 #define ITEMBACKGROUND_H 00023 00024 #include <QtGui/QGraphicsWidget> 00025 00026 #include <plasma/plasma_export.h> 00027 00035 namespace Plasma { 00036 00037 class FrameSvg; 00038 class ItemBackgroundPrivate; 00039 00040 class PLASMA_EXPORT ItemBackground : public QGraphicsWidget 00041 { 00042 Q_OBJECT 00043 Q_PROPERTY(QRectF target READ target WRITE setTarget) 00044 Q_PROPERTY(QGraphicsItem* targetItem READ targetItem WRITE setTargetItem) 00045 00046 Q_PROPERTY(qreal animationUpdate READ animationUpdate WRITE setAnimationUpdate) 00047 00048 public: 00049 ItemBackground(QGraphicsWidget *parent = 0); 00050 ~ItemBackground(); 00051 00057 void setTarget(const QRectF &newGeometry); 00058 00062 QRectF target() const; 00063 00067 void setTargetItem(QGraphicsItem *target); 00068 00072 QGraphicsItem *targetItem() const; 00073 00077 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); 00078 00079 Q_SIGNALS: 00084 void appearanceChanged(); 00085 00089 void animationStep(qreal progress); 00090 00095 void targetReached(QRectF); 00096 00101 void targetItemReached(QGraphicsItem *); 00102 00103 protected: 00107 QVariant itemChange(GraphicsItemChange change, const QVariant &value); 00108 00112 bool eventFilter(QObject *watched, QEvent *event); 00113 00117 bool sceneEventFilter(QGraphicsItem *watched, QEvent *event); 00118 00122 void resizeEvent(QGraphicsSceneResizeEvent *); 00123 00124 private: 00125 void setAnimationUpdate(qreal progress); 00126 qreal animationUpdate() const; 00127 00128 private: 00129 Q_PRIVATE_SLOT(d, void targetDestroyed(QObject*)) 00130 Q_PRIVATE_SLOT(d, void frameSvgChanged()) 00131 Q_PRIVATE_SLOT(d, void refreshCurrentTarget()) 00132 00133 friend class ItemBackgroundPrivate; 00134 ItemBackgroundPrivate * const d; 00135 }; 00136 } 00137 00138 #endif
KDE 4.6 API Reference