KColorButton

KDE 4.7 PyKDE API Reference

- KDE's Python API

# KColorButton Class Reference

`from PyKDE4.kdeui import *`

Inherits: QPushButton → QAbstractButton → QWidget → QObject

## Detailed Description

A pushbutton to display or allow user selection of a color.

This widget can be used to display or allow user selection of a color.

See also:
  KColorDialog

"KDE Color Button"

## Signals
| changed (QColor newColor)
## Methods
| __init__ (self, QWidget parent=0)
| __init__ (self, QColor c, QWidget parent=0)
| __init__ (self, QColor c, QColor defaultColor, QWidget parent=0)
QColor | color (self)
QColor | defaultColor (self)
| dragEnterEvent (self, QDragEnterEvent a0)
| dropEvent (self, QDropEvent a0)
bool | isAlphaChannelEnabled (self)
| keyPressEvent (self, QKeyEvent e)
QSize | minimumSizeHint (self)
| mouseMoveEvent (self, QMouseEvent e)
| mousePressEvent (self, QMouseEvent e)
| paintEvent (self, QPaintEvent pe)
| setAlphaChannelEnabled (self, bool alpha)
| setColor (self, QColor c)
| setDefaultColor (self, QColor c)
QSize | sizeHint (self)

## Signal Documentation

changed | ( | QColor | newColor
| ) |  |  |

Emitted when the color of the widget is changed, either with setColor() or via user selection.

Signal syntax:
  `QObject.connect(source, SIGNAL("changed(const QColor&)"), target_slot)`

## Method Documentation

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

Creates a color button.

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

Creates a color button with an initial color c.

__init__ | ( | self, |
|  | QColor | c,
|  | QColor | defaultColor,
|  | QWidget | parent=0
| ) |  |  |

Creates a color button with an initial color c and default color defaultColor.

QColor color | ( |  | self ) |

Returns the currently chosen color.

QColor defaultColor | ( |  | self ) |

Returns the default color or an invalid color if no default color is set.

dragEnterEvent | ( | self, |
|  | QDragEnterEvent | a0
| ) |  |  |

dropEvent | ( | self, |
|  | QDropEvent | a0
| ) |  |  |

bool isAlphaChannelEnabled | ( |  | self ) |

Returns true if the user is allowed to change the alpha component.

Since:
  4.5

keyPressEvent | ( | self, |
|  | QKeyEvent | e
| ) |  |  |

QSize minimumSizeHint | ( |  | self ) |

mouseMoveEvent | ( | self, |
|  | QMouseEvent | e
| ) |  |  |

mousePressEvent | ( | self, |
|  | QMouseEvent | e
| ) |  |  |

paintEvent | ( | self, |
|  | QPaintEvent | pe
| ) |  |  |

setAlphaChannelEnabled | ( | self, |
|  | bool | alpha
| ) |  |  |

When set to true, allow the user to change the alpha component of the color. The default value is false.

Since:
  4.5

setColor | ( | self, |
|  | QColor | c
| ) |  |  |

Sets the current color to c.

setDefaultColor | ( | self, |
|  | QColor | c
| ) |  |  |

Sets the default color to c.

QSize sizeHint | ( |  | self ) |