KDE 4.9 PyKDE API Reference

- KDE's Python API

# KXYSelector Class Reference

`from PyKDE4.kdeui import *`

Inherits: QWidget → QObject
Subclasses: KHueSaturationSelector

## Detailed Description

KXYSelector is the base class for other widgets which provides the ability to choose from a two-dimensional range of values. The currently chosen value is indicated by a cross. An example is the KHSSelector which allows to choose from a range of colors, and which is used in KColorDialog.

A custom drawing routine for the widget surface has to be provided by the subclass.

## Signals

| valueChanged (int x, int y)

## Methods

| __init__ (self, QWidget parent=0)
| __init__ (self, KXYSelector a0)
QRect | contentsRect (self)
| drawContents (self, QPainter a0)
| drawMarker (self, QPainter p, int xp, int yp)
QSize | minimumSizeHint (self)
| mouseMoveEvent (self, QMouseEvent e)
| mousePressEvent (self, QMouseEvent e)
| paintEvent (self, QPaintEvent e)
| setMarkerColor (self, QColor col)
| setRange (self, int minX, int minY, int maxX, int maxY)
| setValues (self, int xPos, int yPos)
| setXValue (self, int xPos)
| setYValue (self, int yPos)
int xVal, int yVal | valuesFromPosition (self, int x, int y)
| wheelEvent (self, QWheelEvent a0)
int | xValue (self)
int | yValue (self)

## Signal Documentation

valueChanged | ( | int | x,
|  | int | y
| ) |  |  |

This signal is emitted whenever the user chooses a value, e.g. by clicking with the mouse on the widget.

Signal syntax:
  `QObject.connect(source, SIGNAL("valueChanged(int, int)"), target_slot)`

## Method Documentation

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

Constructs a two-dimensional selector widget which has a value range of [0..100] in both directions.

__init__ | ( | self, |
|  | KXYSelector | a0
| ) |  |  |

QRect contentsRect | ( |  | self ) |

Returns:
  the rectangle on which subclasses should draw.

drawContents | ( | self, |
|  | QPainter | a0
| ) |  |  |

Override this function to draw the contents of the widget. The default implementation does nothing.

Draw within contentsRect() only.

drawMarker | ( | self, |
|  | QPainter | p,
|  | int | xp,
|  | int | yp
| ) |  |  |

Override this function to draw the marker which indicates the currently selected value pair.

QSize minimumSizeHint | ( |  | self ) |

Reimplemented to give the widget a minimum size

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

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

paintEvent | ( | self, |
|  | QPaintEvent | e
| ) |  |  |

setMarkerColor | ( | self, |
|  | QColor | col
| ) |  |  |

Sets the color used to draw the marker

Parameters:

  | col | the color

setRange | ( | self, |
|  | int | minX,
|  | int | minY,
|  | int | maxX,
|  | int | maxY
| ) |  |  |

Sets the range of possible values.

setValues | ( | self, |
|  | int | xPos,
|  | int | yPos
| ) |  |  |

Sets the current values in horizontal and vertical direction.

Parameters:

  | xPos | the horizontal value
  | yPos | the vertical value

setXValue | ( | self, |
|  | int | xPos
| ) |  |  |

Sets the current horizontal value

Parameters:

  | xPos | the horizontal value

setYValue | ( | self, |
|  | int | yPos
| ) |  |  |

Sets the current vertical value

Parameters:

  | yPos | the vertical value

int xVal, int yVal valuesFromPosition | ( | self, |
|  | int | x,
|  | int | y
| ) |  |  |

Converts a pixel position to its corresponding values.

wheelEvent | ( | self, |
|  | QWheelEvent | a0
| ) |  |  |

int xValue | ( |  | self ) |

Returns:
  the current value in horizontal direction.

int yValue | ( |  | self ) |

Returns:
  the current value in vertical direction.