# class KPushButton

###

Module | kdeui
Namespace |
Class | KPushButton
Inherits | QPushButton

A QPushButton with drag-support and KGuiItem support

This is nothing but a QPushButton with drag-support and KGuiItem support. You must call #setDragEnabled (true) and override the virtual method dragObject() to specify the QDragObject to be used.

Author Carsten Pfeiffer <pfeiffer@kde.org>

### methods

- KPushButton (parent)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  parent | QWidget | 0

  Default constructor.

- KPushButton (text, parent)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  text | QString |
  parent | QWidget | 0

  Constructor, that sets the button-text to text

- KPushButton (icon, text, parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  icon | KIcon |
  text | QString |
  parent | QWidget | 0

  Constructor, that sets an icon and the button-text to text

- KPushButton (item, parent)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  item | KGuiItem |
  parent | QWidget | 0

  Constructor that takes a KGuiItem for the text, the icon, the tooltip and the what's this help

- KPushButton (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget | 0

- KPushButton (a0, a1)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QString |
  a1 | QWidget | 0

- KPushButton (a0, a1)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | KGuiItem |
  a1 | QWidget | 0

- delayedMenu ( )

  returns QMenu

  returns a delayed popup menu since menu() isn't virtual

- dragObject ( )

  returns QDrag

  Reimplement this and return the QDrag object that should be used for the drag. Remember to give it "this" as parent.

  Default implementation returns 0, so that no drag is initiated.

- guiItem ( )

  returns KStandardGuiItem.StandardItem

  Reads the standard KGuiItem for this button.

- isDragEnabled ( )

  returns bool

  Returns if drag support is enabled or not.

- mouseMoveEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QMouseEvent |

  Reimplemented to add drag-support

- mousePressEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QMouseEvent |

  Reimplemented to add drag-support

- setDelayedMenu (delayed_menu)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  delayed_menu | QMenu |

  Sets a delayed popup menu for consistency, since menu() isn't virtual

- setDragEnabled (enable)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  enable | bool |

  Enables/disables drag-support. Default is disabled.

- setGuiItem (item)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  item | KGuiItem |

  Sets the KGuiItem for this button.

- setGuiItem (item)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  item | KStandardGuiItem.StandardItem |

  Sets the standard KGuiItem for this button.

- setIcon (icon)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  icon | KIcon |

  Sets the Icon Set for this button. It also takes into account hte KGlobalSettings.showIconsOnPushButtons() setting.

- setIcon (pix)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  pix | QIcon |

  Sets the pixmap for this button. Rarely used. This one exists mostly for usage in Qt designer, with icons embedded into the ui file. But you should rather save them separately, and load them with KIcon("name") so that the icons are themeable.

- setText (text)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  text | QString |

  Sets the text of the button

- startDrag ( )

  returns Nothing

  Starts a drag (dragCopy() by default) using dragObject()