• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

Plasma

label.h

Go to the documentation of this file.
00001 /*
00002  *   Copyright 2008 Aaron Seigo <aseigo@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  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details
00013  *
00014  *   You should have received a copy of the GNU Library General Public
00015  *   License along with this program; if not, write to the
00016  *   Free Software Foundation, Inc.,
00017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  */
00019 
00020 #ifndef PLASMA_LABEL_H
00021 #define PLASMA_LABEL_H
00022 
00023 #include <QtGui/QGraphicsProxyWidget>
00024 
00025 #include <plasma/plasma_export.h>
00026 #include <plasma/dataengine.h>
00027 
00028 class QLabel;
00029 
00030 namespace Plasma
00031 {
00032 
00033 class LabelPrivate;
00034 
00040 class PLASMA_EXPORT Label : public QGraphicsProxyWidget
00041 {
00042     Q_OBJECT
00043 
00044     Q_PROPERTY(QGraphicsWidget *parentWidget READ parentWidget)
00045     Q_PROPERTY(QString text READ text WRITE setText)
00046     Q_PROPERTY(QString image READ image WRITE setImage)
00047     Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
00048     Q_PROPERTY(bool hasScaledContents READ hasScaledContents WRITE setScaledContents)
00049     Q_PROPERTY(bool textSelectable READ textSelectable WRITE setTextSelectable)
00050     Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap)
00051     Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
00052     Q_PROPERTY(QLabel *nativeWidget READ nativeWidget)
00053 
00054 public:
00060     explicit Label(QGraphicsWidget *parent = 0);
00061     ~Label();
00062 
00068     void setText(const QString &text);
00069 
00073     QString text() const;
00074 
00080     void setImage(const QString &path);
00081 
00085     QString image() const;
00086 
00092     void setAlignment(Qt::Alignment alignment);
00093 
00097     Qt::Alignment alignment() const;
00098 
00104     void setScaledContents(bool scaled);
00105 
00109     bool hasScaledContents() const;
00110 
00117     void setTextSelectable(bool enable);
00118     
00123     bool textSelectable() const;
00124 
00131     void setWordWrap(bool wrap);
00132 
00137     bool wordWrap() const;
00138 
00144     void setStyleSheet(const QString &stylesheet);
00145 
00149     QString styleSheet();
00150 
00154     QLabel *nativeWidget() const;
00155 
00156 Q_SIGNALS:
00157     void linkActivated(const QString &link);
00158     void linkHovered(const QString &link);
00159 
00160 public Q_SLOTS:
00161     void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data);
00162 
00163 protected:
00164     void resizeEvent(QGraphicsSceneResizeEvent *event);
00165     void mousePressEvent(QGraphicsSceneMouseEvent *event);
00166     void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
00167     void paint(QPainter *painter,
00168                const QStyleOptionGraphicsItem *option,
00169                QWidget *widget);
00170     void changeEvent(QEvent *event);
00171     bool event(QEvent *event);
00172     QVariant itemChange(GraphicsItemChange change, const QVariant & value);
00173     void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
00174     QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
00175 
00176 private:
00177     Q_PRIVATE_SLOT(d, void setPalette())
00178     Q_PRIVATE_SLOT(d, void setPixmap())
00179 
00180     LabelPrivate * const d;
00181 };
00182 
00183 } // namespace Plasma
00184 
00185 #endif // multiple inclusion guard

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal