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

KDEUI

  • kdeui
  • widgets
kpushbutton.h
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KPUSHBUTTON_H
21#define KPUSHBUTTON_H
22
23#include <QtGui/QPushButton>
24
25#include <kstandardguiitem.h>
26
27class QDrag;
28class QMenu;
29class KIcon;
30
31namespace KAuth {
32 class Action;
33}
34
46class KDEUI_EXPORT KPushButton : public QPushButton
47{
48 Q_OBJECT
49 Q_PROPERTY(bool isDragEnabled READ isDragEnabled WRITE setDragEnabled)
50
51public:
52
56 explicit KPushButton( QWidget *parent = 0 );
57
61 explicit KPushButton( const QString &text, QWidget *parent = 0 );
62
66 KPushButton( const KIcon &icon, const QString &text, QWidget *parent = 0 );
67
72 explicit KPushButton( const KGuiItem &item, QWidget *parent = 0 );
73
77 ~KPushButton();
78
82 void setDragEnabled( bool enable );
83
87 bool isDragEnabled() const;
88
92 void setGuiItem( const KGuiItem& item );
93
97 void setGuiItem( KStandardGuiItem::StandardItem item );
98
102 KStandardGuiItem::StandardItem guiItem() const;
103
108 void setIcon( const KIcon &icon );
109
113 void setIcon( const QIcon &pix );
114
118 void setText( const QString &text );
119
124 void setDelayedMenu(QMenu *delayed_menu);
125
130 QMenu *delayedMenu();
131
136 virtual QSize sizeHint() const;
137
143 KAuth::Action *authAction() const;
144
155 void setAuthAction(KAuth::Action *action);
156
164 void setAuthAction(const QString &actionName);
165
166protected:
173 virtual QDrag * dragObject();
174
178 virtual void mousePressEvent( QMouseEvent * );
182 virtual void mouseMoveEvent( QMouseEvent * );
183
188 virtual void paintEvent( QPaintEvent * );
189
193 virtual void startDrag();
194
195Q_SIGNALS:
211 void authorized(KAuth::Action *action);
212
213private:
218 void init( const KGuiItem &item );
219
220private:
221 class KPushButtonPrivate;
222 KPushButtonPrivate * const d;
223
224 Q_PRIVATE_SLOT(d, void slotSettingsChanged( int ))
225 Q_PRIVATE_SLOT(d, void slotPressedInternal())
226 Q_PRIVATE_SLOT(d, void slotClickedInternal())
227 Q_PRIVATE_SLOT(d, void slotDelayedMenuTimeout())
228 Q_PRIVATE_SLOT(d, void authStatusChanged(int))
229};
230
231#endif // KPUSHBUTTON_H
KAuth::Action
KGuiItem
An abstract class for GUI data such as ToolTip and Icon.
Definition kguiitem.h:37
KIcon
A wrapper around QIcon that provides KDE icon features.
Definition kicon.h:41
KPushButton::dragObject
virtual QDrag * dragObject()
Reimplement this and return the QDrag object that should be used for the drag.
Definition kpushbutton.cpp:295
KPushButton::setIcon
void setIcon(const KIcon &icon)
Sets the Icon Set for this button.
Definition kpushbutton.cpp:251
KPushButton::delayedMenu
QMenu * delayedMenu()
returns a delayed popup menu since menu() isn't virtual
Definition kpushbutton.cpp:312
KPushButton::setDelayedMenu
void setDelayedMenu(QMenu *delayed_menu)
Sets a delayed popup menu for consistency, since menu() isn't virtual.
Definition kpushbutton.cpp:307
KPushButton::isDragEnabled
bool isDragEnabled
Definition kpushbutton.h:49
KPushButton::KPushButton
KPushButton(QWidget *parent=0)
Default constructor.
Definition kpushbutton.cpp:152
KPushButton::guiItem
KStandardGuiItem::StandardItem guiItem() const
Reads the standard KGuiItem for this button.
Definition kpushbutton.cpp:234
KPushButton::setAuthAction
void setAuthAction(KAuth::Action *action)
Sets the action object associated with this button.
Definition kpushbutton.cpp:331
KPushButton::mouseMoveEvent
virtual void mouseMoveEvent(QMouseEvent *)
Reimplemented to add drag-support.
Definition kpushbutton.cpp:278
KPushButton::paintEvent
virtual void paintEvent(QPaintEvent *)
Reimplemented to add arrow for delayed menu.
Definition kpushbutton.cpp:371
KPushButton::authorized
void authorized(KAuth::Action *action)
Signal emitted when the button is triggered and authorized.
KPushButton::authAction
KAuth::Action * authAction() const
Returns the action object associated with this button, or 0 if it does not have one.
Definition kpushbutton.cpp:317
KPushButton::setGuiItem
void setGuiItem(const KGuiItem &item)
Sets the KGuiItem for this button.
Definition kpushbutton.cpp:215
KPushButton::setDragEnabled
void setDragEnabled(bool enable)
Enables/disables drag-support.
Definition kpushbutton.cpp:266
KPushButton::mousePressEvent
virtual void mousePressEvent(QMouseEvent *)
Reimplemented to add drag-support.
Definition kpushbutton.cpp:271
KPushButton::setText
void setText(const QString &text)
Sets the text of the button.
Definition kpushbutton.cpp:239
KPushButton::sizeHint
virtual QSize sizeHint() const
Reimplemented to add arrow for delayed menu.
Definition kpushbutton.cpp:360
KPushButton::startDrag
virtual void startDrag()
Starts a drag (dragCopy() by default) using dragObject()
Definition kpushbutton.cpp:300
QMenu
QPushButton
QWidget
kstandardguiitem.h
KAuth
KStandardGuiItem::StandardItem
StandardItem
Definition kstandardguiitem.h:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Tue Mar 25 2025 00:00:00 by doxygen 1.14.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • 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