KDE 4.2 PyKDE API Reference

- KDE's Python API

# KColorDialog Class Reference

`from PyKDE4.kdeui import *`

Inherits: KDialog → QDialog → QWidget → QObject

## Detailed Description

## Signals

| colorSelected (QColor col)

## Methods

| __init__ (self, QWidget parent=0, bool modal=0)
| __init__ (self, KColorDialog a0)
QColor | color (self)
| colorSelected (self, QColor col)
QColor | defaultColor (self)
bool | eventFilter (self, QObject obj, QEvent ev)
| keyPressEvent (self, QKeyEvent a0)
| mouseMoveEvent (self, QMouseEvent a0)
| mouseReleaseEvent (self, QMouseEvent a0)
| setColor (self, QColor col)
| setDefaultColor (self, QColor defaultCol)

## Static Methods

int | getColor (QColor theColor, QWidget parent=0)
int | getColor (QColor theColor, QColor defaultColor, QWidget parent=0)
QColor | grabColor (QPoint p)

## Method Documentation

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

Constructs a color selection dialog.

__init__ | ( | self, |
|  | KColorDialog | a0
| ) |  |  |

QColor color | ( |  | self ) |

Returns the currently selected color.

colorSelected | ( | self, |
|  | QColor | col
| ) |  |  |

Emitted when a color is selected. Connect to this to monitor the color as it as selected if you are not running modal.

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

QColor defaultColor | ( |  | self ) |

Returns:
  the value passed to setDefaultColor

bool eventFilter | ( | self, |
|  | QObject | obj,
|  | QEvent | ev
| ) |  |  |

int getColor | ( | QColor | theColor,
|  | QWidget | parent=0
| ) |  |  |

Creates a modal color dialog, let the user choose a color, and returns when the dialog is closed.

The selected color is returned in the argument theColor.

Parameters:

  | theColor | if valid, specifies the color to be initially selected. On return, holds the selected color.

Returns:
  QDialog.result().

int getColor | ( | QColor | theColor,
|  | QColor | defaultColor,
|  | QWidget | parent=0
| ) |  |  |

Creates a modal color dialog, lets the user choose a color, and returns when the dialog is closed.

The selected color is returned in the argument theColor.

This version takes a defaultColor argument, which sets the color selected by the "default color" checkbox. When this checkbox is checked, the invalid color (QColor()) is returned into theColor.

Parameters:

  | theColor | if valid, specifies the color to be initially selected. On return, holds the selected color.
  | defaultColor | color selected by the "default color" checkbox

Returns:
  QDialog.result().

QColor grabColor | ( | QPoint | p
| ) |  |  |

Gets the color from the pixel at point p on the screen.

keyPressEvent | ( | self, |
|  | QKeyEvent | a0
| ) |  |  |

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

mouseReleaseEvent | ( | self, |
|  | QMouseEvent | a0
| ) |  |  |

setColor | ( | self, |
|  | QColor | col
| ) |  |  |

Preselects a color.

setDefaultColor | ( | self, |
|  | QColor | defaultCol
| ) |  |  |

Call this to make the dialog show a "Default Color" checkbox. If this checkbox is selected, the dialog will return an "invalid" color (QColor()). This can be used to mean "the default text color", for instance, the one with the KDE text color on screen, but black when printing.