KPushButton

KDE 4.9 PyKDE API Reference

- KDE's Python API

# KPushButton Class Reference

`from PyKDE4.kdeui import *`

Inherits: QPushButton → QAbstractButton → QWidget → QObject

## Detailed Description

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.

"KDE Push Button"

Author:
  Carsten Pfeiffer <pfeiffer@kde.org>

## Signals
| authorized (KAuth.Action action)
## Methods
| __init__ (self, QWidget parent=0)
| __init__ (self, QString text, QWidget parent=0)
| __init__ (self, KIcon icon, QString text, QWidget parent=0)
| __init__ (self, KGuiItem item, QWidget parent=0)
KAuth.Action | authAction (self)
QMenu | delayedMenu (self)
QDrag | dragObject (self)
KStandardGuiItem.StandardItem | guiItem (self)
bool | isDragEnabled (self)
| mouseMoveEvent (self, QMouseEvent a0)
| mousePressEvent (self, QMouseEvent a0)
| paintEvent (self, QPaintEvent a0)
| setAuthAction (self, KAuth.Action action)
| setAuthAction (self, QString actionName)
| setDelayedMenu (self, QMenu delayed_menu)
| setDragEnabled (self, bool enable)
| setGuiItem (self, KGuiItem item)
| setGuiItem (self, KStandardGuiItem.StandardItem item)
| setIcon (self, KIcon icon)
| setIcon (self, QIcon pix)
| setText (self, QString text)
QSize | sizeHint (self)
| startDrag (self)

## Signal Documentation

authorized | ( | KAuth.Action | action
| ) |  |  |

Signal emitted when the button is triggered and authorized

If the button needs authorization, whenever the user triggers it, the authorization process automatically begins. If it succeeds, this signal is emitted. The KAuth.Action object is provided for convenience if you have multiple Action objects, but of course it's always the same set with setAuthAction().

WARNING: If your button needs authorization you should connect eventual slots processing stuff to this signal, and NOT clicked. Clicked will be emitted even if the user has not been authorized

Parameters:

  | action | The object set with setAuthAction()

Signal syntax:
  `QObject.connect(source, SIGNAL("authorized(KAuth::Action*)"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | QWidget | parent=0
| ) |  |  |

Default constructor.

__init__ | ( | self, |
|  | QString | text,
|  | QWidget | parent=0
| ) |  |  |

Constructor, that sets the button-text to text

__init__ | ( | self, |
|  | KIcon | icon,
|  | QString | text,
|  | QWidget | parent=0
| ) |  |  |

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

__init__ | ( | self, |
|  | KGuiItem | item,
|  | QWidget | parent=0
| ) |  |  |

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

KAuth.Action authAction | ( |  | self ) |

Returns the action object associated with this button, or 0 if it does not have one

Returns:
  the KAuth.Action associated with this button.

QMenu delayedMenu | ( |  | self ) |

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

QDrag dragObject | ( |  | self ) |

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.

KStandardGuiItem.StandardItem guiItem | ( |  | self ) |

Reads the standard KGuiItem for this button.

bool isDragEnabled | ( |  | self ) |

Returns:
  if drag support is enabled or not.

mouseMoveEvent | ( | self, |
|  | QMouseEvent | a0
| ) |  |  |

Reimplemented to add drag-support

mousePressEvent | ( | self, |
|  | QMouseEvent | a0
| ) |  |  |

Reimplemented to add drag-support

paintEvent | ( | self, |
|  | QPaintEvent | a0
| ) |  |  |

Reimplemented to add arrow for delayed menu

Since:
  4.4

setAuthAction | ( | self, |
|  | KAuth.Action | action
| ) |  |  |

Sets the action object associated with this button

Overloaded member to allow creating the action by name

Parameters:

  | actionName | the name of the action to associate

setAuthAction | ( | self, |
|  | QString | actionName
| ) |  |  |

Sets the action object associated with this button

Overloaded member to allow creating the action by name

Parameters:

  | actionName | the name of the action to associate

setDelayedMenu | ( | self, |
|  | QMenu | delayed_menu
| ) |  |  |

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

setDragEnabled | ( | self, |
|  | bool | enable
| ) |  |  |

Enables/disables drag-support. Default is disabled.

setGuiItem | ( | self, |
|  | KGuiItem | item
| ) |  |  |

Sets the standard KGuiItem for this button.

setGuiItem | ( | self, |
|  | KStandardGuiItem.StandardItem | item
| ) |  |  |

Sets the standard KGuiItem for this button.

setIcon | ( | self, |
|  | KIcon | icon
| ) |  |  |

Sets the pixmap for this button. This one exists mostly for usage in Qt designer.

setIcon | ( | self, |
|  | QIcon | pix
| ) |  |  |

Sets the pixmap for this button. This one exists mostly for usage in Qt designer.

setText | ( | self, |
|  | QString | text
| ) |  |  |

Sets the text of the button

QSize sizeHint | ( |  | self ) |

Reimplemented to add arrow for delayed menu

Since:
  4.4

startDrag | ( |  | self ) |

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