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

Plasma

pushbutton.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_PUSHBUTTON_H
00021 #define PLASMA_PUSHBUTTON_H
00022 
00023 #include <QtGui/QGraphicsProxyWidget>
00024 
00025 #include <kicon.h>
00026 
00027 class KPushButton;
00028 
00029 #include <plasma/plasma_export.h>
00030 
00031 namespace Plasma
00032 {
00033 
00034 class PushButtonPrivate;
00035 
00041 class PLASMA_EXPORT PushButton : public QGraphicsProxyWidget
00042 {
00043     Q_OBJECT
00044 
00045     Q_PROPERTY(QGraphicsWidget *parentWidget READ parentWidget)
00046     Q_PROPERTY(QString text READ text WRITE setText)
00047     Q_PROPERTY(QString image READ image WRITE setImage)
00048     Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
00049     Q_PROPERTY(KPushButton *nativeWidget READ nativeWidget)
00050     Q_PROPERTY(QAction *action READ action WRITE setAction)
00051     Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
00052     Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable)
00053     Q_PROPERTY(bool checked READ isChecked WRITE setChecked)
00054     Q_PROPERTY(bool down READ isDown)
00055 
00056 public:
00057     explicit PushButton(QGraphicsWidget *parent = 0);
00058     ~PushButton();
00059 
00065     void setText(const QString &text);
00066 
00070     QString text() const;
00071 
00077     void setImage(const QString &path);
00078 
00087     void setImage(const QString &path, const QString &elementid);
00088 
00092     QString image() const;
00093 
00099     void setStyleSheet(const QString &stylesheet);
00100 
00104     QString styleSheet();
00105 
00113     void setAction(QAction *action);
00114 
00120     QAction *action() const;
00121 
00129     void setIcon(const QIcon &icon);
00130 
00138     void setIcon(const KIcon &icon);
00139 
00145     QIcon icon() const;
00146 
00152     void setCheckable(bool checkable);
00153 
00159     bool isCheckable() const;
00160 
00167     bool isChecked() const;
00168 
00173     bool isDown() const;
00174 
00178     KPushButton *nativeWidget() const;
00179 
00180 Q_SIGNALS:
00186     void pressed();
00187 
00193     void released();
00194 
00198     void clicked();
00199 
00203     void toggled(bool);
00204 
00205 public Q_SLOTS:
00210     void click();
00211 
00217     void setChecked(bool checked);
00218 
00219 protected:
00220     void paint(QPainter *painter,
00221                const QStyleOptionGraphicsItem *option,
00222                QWidget *widget = 0);
00223     void resizeEvent(QGraphicsSceneResizeEvent *event);
00224     void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
00225     void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
00226     void changeEvent(QEvent *event);
00227     QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint) const;
00228 
00229 private:
00230     Q_PRIVATE_SLOT(d, void syncBorders())
00231     Q_PRIVATE_SLOT(d, void setPixmap())
00232     Q_PRIVATE_SLOT(d, void pressedChanged())
00233     Q_PRIVATE_SLOT(d, void syncToAction())
00234     Q_PRIVATE_SLOT(d, void clearAction())
00235     Q_PRIVATE_SLOT(d, void setPalette())
00236 
00237     friend class PushButtonPrivate;
00238     PushButtonPrivate *const d;
00239 };
00240 
00241 } // namespace Plasma
00242 
00243 #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