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

Plasma

  • plasma
  • widgets
pushbutton.h
Go to the documentation of this file.
1/*
2 * Copyright 2008 Aaron Seigo <aseigo@kde.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef PLASMA_PUSHBUTTON_H
21#define PLASMA_PUSHBUTTON_H
22
23#include <QtGui/QGraphicsProxyWidget>
24
25#include <kicon.h>
26
27class KPushButton;
28
29#include <plasma/plasma_export.h>
30
31namespace Plasma
32{
33
34class PushButtonPrivate;
35
41class PLASMA_EXPORT PushButton : public QGraphicsProxyWidget
42{
43 Q_OBJECT
44
45 Q_PROPERTY(QGraphicsWidget *parentWidget READ parentWidget)
46 Q_PROPERTY(QString text READ text WRITE setText)
47 Q_PROPERTY(QString image READ image WRITE setImage)
48 Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
49 Q_PROPERTY(KPushButton *nativeWidget READ nativeWidget)
50 Q_PROPERTY(QAction *action READ action WRITE setAction)
51 Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
52 Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable)
53 Q_PROPERTY(bool checked READ isChecked WRITE setChecked)
54 Q_PROPERTY(bool down READ isDown)
55
56public:
57 explicit PushButton(QGraphicsWidget *parent = 0);
58 ~PushButton();
59
65 void setText(const QString &text);
66
70 QString text() const;
71
77 void setImage(const QString &path);
78
87 void setImage(const QString &path, const QString &elementid);
88
92 QString image() const;
93
99 void setStyleSheet(const QString &stylesheet);
100
104 QString styleSheet();
105
113 void setAction(QAction *action);
114
120 QAction *action() const;
121
129 void setIcon(const QIcon &icon);
130
138 void setIcon(const KIcon &icon);
139
145 QIcon icon() const;
146
152 void setCheckable(bool checkable);
153
159 bool isCheckable() const;
160
167 bool isChecked() const;
168
173 bool isDown() const;
174
178 KPushButton *nativeWidget() const;
179
180Q_SIGNALS:
186 void pressed();
187
193 void released();
194
198 void clicked();
199
203 void toggled(bool);
204
205public Q_SLOTS:
210 void click();
211
217 void setChecked(bool checked);
218
219protected:
220 void paint(QPainter *painter,
221 const QStyleOptionGraphicsItem *option,
222 QWidget *widget = 0);
223 void resizeEvent(QGraphicsSceneResizeEvent *event);
224 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
225 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
226 void changeEvent(QEvent *event);
227 QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint) const;
228
229private:
230 Q_PRIVATE_SLOT(d, void syncBorders())
231 Q_PRIVATE_SLOT(d, void setPixmap())
232 Q_PRIVATE_SLOT(d, void pressedChanged())
233 Q_PRIVATE_SLOT(d, void syncToAction())
234 Q_PRIVATE_SLOT(d, void clearAction())
235 Q_PRIVATE_SLOT(d, void setPalette())
236
237 friend class PushButtonPrivate;
238 PushButtonPrivate *const d;
239};
240
241} // namespace Plasma
242
243#endif // multiple inclusion guard
Plasma::PushButton
Provides a plasma-themed KPushButton.
Definition: pushbutton.h:42
Plasma::PushButton::toggled
void toggled(bool)
Emitted when the button changes state from up to down.
Plasma::PushButton::clicked
void clicked()
Emitted when the button is pressed then released, completing a click.
Plasma::PushButton::styleSheet
QString styleSheet()
Plasma::PushButton::pressed
void pressed()
Emitted when the button is pressed down; usually the clicked() signal will suffice,...
Plasma::PushButton::released
void released()
Emitted when the button is released; usually the clicked() signal will suffice, however.
QGraphicsProxyWidget
QGraphicsWidget
QStyleOptionGraphicsItem
QWidget
Plasma
Namespace for everything in libplasma.
Definition: abstractdialogmanager.cpp:25
plasma_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • 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
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal