| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KPushButton Class Reference

This is nothing but a QPushButton with drag-support and KGuiItem support. A QPushButton with drag-support and KGuiItem support. More...

`#include <kpushbutton.h>`

Inheritance diagram for KPushButton:

[legend]
Collaboration diagram for KPushButton:

[legend]
List of all members.

## Public Member Functions
| KPushButton (QWidget *parent, const char *name=0)
| Default constructor.
| KPushButton (const QString &text, QWidget *parent, const char *name=0)
| Constructor, that sets the button-text to `text`.
| KPushButton (const QIconSet &icon, const QString &text, QWidget *parent, const char *name=0)
| Constructor, that sets an icon and the button-text to `text`.
| KPushButton (const KGuiItem &item, QWidget *parent, const char *name=0)
| Constructor that takes a KGuiItem for the text, the icon, the tooltip and the what's this help.
| ~KPushButton ()
| Destructs the button.
void | setDragEnabled (bool enable)
| Enables/disables drag-support.
bool | isDragEnabled () const
void | setGuiItem (const KGuiItem &item)
| Sets the KGuiItem for this button.
## Protected Member Functions
virtual QDragObject * | dragObject ()
| Reimplement this and return the QDragObject that should be used for the drag.
virtual void | mousePressEvent (QMouseEvent *)
| Reimplemented to add drag-support.
virtual void | mouseMoveEvent (QMouseEvent *)
| Reimplemented to add drag-support.
virtual void | startDrag ()
| Starts a drag (dragCopy() by default) using dragObject().
virtual void | virtual_hook (int id, void *data)

## Detailed Description

This is nothing but a QPushButton with drag-support and KGuiItem support. A QPushButton with drag-support and KGuiItem support.

You have to call setDragEnabled( true ) and override the virtual method dragObject() to specify the QDragObject to be used.

Author:
  Carsten Pfeiffer <pfeiffer@kde.org>

Definition at line 37 of file kpushbutton.h.

## Constructor & Destructor Documentation

KPushButton::KPushButton | ( | QWidget * | parent,
|  | const char * | name = 0
| ) |

| Default constructor. Definition at line 37 of file kpushbutton.cpp. References KStdAccel::name().

KPushButton::KPushButton | ( | const QString & | text,
|  | QWidget * | parent,
|  | const char * | name = 0
| ) |

| Constructor, that sets the button-text to `text`. Definition at line 44 of file kpushbutton.cpp. References KStdAccel::name().

KPushButton::KPushButton | ( | const QIconSet & | icon,
|  | const QString & | text,
|  | QWidget * | parent,
|  | const char * | name = 0
| ) |

| Constructor, that sets an icon and the button-text to `text`. Definition at line 52 of file kpushbutton.cpp. References KStdAccel::name().

KPushButton::KPushButton | ( | const KGuiItem & | item,
|  | QWidget * | parent,
|  | const char * | name = 0
| ) |

| Constructor that takes a KGuiItem for the text, the icon, the tooltip and the what's this help. Definition at line 60 of file kpushbutton.cpp. References KStdAccel::name().

KPushButton::~KPushButton | ( |  | ) |

| Destructs the button. Definition at line 68 of file kpushbutton.cpp.

## Member Function Documentation

void KPushButton::setDragEnabled | ( | bool | enable | ) |

| Enables/disables drag-support. Default is enabled. Definition at line 130 of file kpushbutton.cpp.

bool KPushButton::isDragEnabled | ( |  | ) | const`[inline]`

| Returns: if drag support is enabled or not. Definition at line 77 of file kpushbutton.h.

void KPushButton::setGuiItem | ( | const KGuiItem & | item | ) |

| Sets the KGuiItem for this button. Definition at line 113 of file kpushbutton.cpp. References QPushButton::setIconSet(), and QPushButton::setText().

QDragObject * KPushButton::dragObject | ( |  | ) | `[protected, virtual]`

| Reimplement this and return the QDragObject that should be used for the drag. Default implementation returns 0L, so that no drag is initiated. Definition at line 158 of file kpushbutton.cpp. Referenced by startDrag().

void KPushButton::mousePressEvent | ( | QMouseEvent * |  | ) | `[protected, virtual]`

| Reimplemented to add drag-support. Definition at line 135 of file kpushbutton.cpp. References QMouseEvent::pos().

void KPushButton::mouseMoveEvent | ( | QMouseEvent * |  | ) | `[protected, virtual]`

| Reimplemented to add drag-support. Definition at line 142 of file kpushbutton.cpp. References KGlobalSettings::dndEventDelay(), QMouseEvent::pos(), QPushButton::setDown(), startDrag(), and QMouseEvent::state().

void KPushButton::startDrag | ( |  | ) | `[protected, virtual]`

| Starts a drag (dragCopy() by default) using dragObject(). Definition at line 163 of file kpushbutton.cpp. References QDragObject::dragCopy(), and dragObject(). Referenced by mouseMoveEvent().

The documentation for this class was generated from the following files:

- kpushbutton.h
- kpushbutton.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:04:10 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001