Plasma
flashinglabel.h
Go to the documentation of this file.
00001 /* 00002 * Copyright 2007 by André Duffeck <duffeck@kde.org> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Library General Public License as 00006 * published by the Free Software Foundation; either version 2, or 00007 * (at your option) any later version. 00008 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 Library General Public 00016 * License 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 PLASMA_FLASHINGLABEL_H 00022 #define PLASMA_FLASHINGLABEL_H 00023 00024 #include <QtGui/QGraphicsWidget> 00025 #include <QtGui/QTextOption> 00026 00027 #include <plasma/plasma_export.h> 00028 00029 namespace Plasma 00030 { 00031 00032 class FlashingLabelPrivate; 00033 00039 class PLASMA_EXPORT FlashingLabel : public QGraphicsWidget 00040 { 00041 Q_OBJECT 00042 Q_PROPERTY(bool autohide READ autohide WRITE setAutohide) 00043 Q_PROPERTY(QFont font READ font WRITE setFont) 00044 Q_PROPERTY(QColor color READ color WRITE setColor) 00045 Q_PROPERTY(int duration READ duration WRITE setDuration) 00046 00047 public: 00048 explicit FlashingLabel(QGraphicsItem *parent = 0); 00049 virtual ~FlashingLabel(); 00050 00051 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); 00052 00053 QFont font() const; 00054 void setFont(const QFont &); 00055 00056 QColor color() const; 00057 void setColor(const QColor &); 00058 00059 int duration() const; 00060 void setDuration(int duration); 00061 00062 Q_INVOKABLE void flash(const QString &text, int duration = 0, 00063 const QTextOption &option = QTextOption(Qt::AlignCenter)); 00064 Q_INVOKABLE void flash(const QPixmap &pixmap, int duration = 0, 00065 Qt::Alignment align = Qt::AlignCenter); 00066 00067 void setAutohide(bool autohide); 00068 bool autohide() const; 00069 00070 protected: 00071 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const; 00072 00073 public Q_SLOTS: 00074 void kill(); 00075 00076 protected Q_SLOTS: 00077 void fadeIn(); 00078 void fadeOut(); 00079 00080 private: 00081 Q_PRIVATE_SLOT(d, void elementAnimationFinished()) 00082 Q_PRIVATE_SLOT(d, void setPalette()) 00083 FlashingLabelPrivate *const d; 00084 }; 00085 00086 } 00087 00088 #endif
KDE 4.6 API Reference