KDE 4.5 PyKDE API Reference

- KDE's Python API

# KPixmapRegionSelectorWidget Class Reference

`from PyKDE4.kdeui import *`

Inherits: QWidget → QObject

## Detailed Description

KPixmapRegionSelectorWidget is a widget that shows a picture and provides the user with a friendly way to select a rectangular subregion of the pixmap.

NOTE: There are two copies of this .h and the .cpp file, with subtle differences. One copy is in kdelibs/kdeui, and the other copy is in kdepim/libkdepim This is because kdepim has to remain backwards compatible. Any changes to either file should be made to the other.

"KDE Pixmap Region Selector"

Author:
  Antonio Larrosa <larrosa@kde.org>

## Enumerations
RotateDirection | { Rotate90, Rotate180, Rotate270 }
## Signals
| pixmapRotated ()
## Methods
| __init__ (self, QWidget parent=0)
| __init__ (self, KPixmapRegionSelectorWidget a0)
KMenu | createPopupMenu (self)
QPixmap | pixmap (self)
| resetSelection (self)
| rotate (self, KPixmapRegionSelectorWidget.RotateDirection direction)
| rotateClockwise (self)
| rotateCounterclockwise (self)
QImage | selectedImage (self)
QRect | selectedRegion (self)
| setFreeSelectionAspectRatio (self)
| setMaximumWidgetSize (self, int width, int height)
| setPixmap (self, QPixmap pixmap)
| setSelectedRegion (self, QRect rect)
| setSelectionAspectRatio (self, int width, int height)
QRect | unzoomedSelectedRegion (self)

## Signal Documentation

pixmapRotated | ( |  | ) |

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

## Method Documentation

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

Constructor for a KPixmapRegionSelectorWidget.

__init__ | ( | self, |
|  | KPixmapRegionSelectorWidget | a0
| ) |  |  |

KMenu createPopupMenu | ( |  | self ) |

Creates a KMenu with the menu that appears when clicking with the right button on the label

QPixmap pixmap | ( |  | self ) |

Returns:
  the original whole pixmap that we're using in this widget as the pixmap the user is selecting a region from.

resetSelection | ( |  | self ) |

Resets the selection to use the whole image

rotate | ( | self, |
|  | KPixmapRegionSelectorWidget.RotateDirection | direction
| ) |  |  |

Rotates the image as specified by the direction parameter, also tries to rotate the selected region so that it doesn't change, as long as the forced aspect ratio setting is respected, in other case, the selected region is reset.

rotateClockwise | ( |  | self ) |

Rotates the current image 90º clockwise

rotateCounterclockwise | ( |  | self ) |

Rotates the current image 90º counterclockwise

QImage selectedImage | ( |  | self ) |

Returns:
  a QImage object with just the region the user selected from the image

QRect selectedRegion | ( |  | self ) |

Returns the selected region ( in zoomed pixmap coordinates )

setFreeSelectionAspectRatio | ( |  | self ) |

Allows the user to do a selection which has any aspect ratio. This is the default.

See also:
  setSelectionAspectRatio()

setMaximumWidgetSize | ( | self, |
|  | int | width,
|  | int | height
| ) |  |  |

Sets the maximum size for the widget. If the image is larger than this (either horizontally or vertically), it's scaled to adjust to the maximum size (preserving the aspect ratio)

setPixmap | ( | self, |
|  | QPixmap | pixmap
| ) |  |  |

Sets the pixmap which will be shown for the user to select a region from.

Parameters:

  | pixmap | The pixmap. Must be non-null.

setSelectedRegion | ( | self, |
|  | QRect | rect
| ) |  |  |

Sets the selected region to be rect (in zoomed pixmap coordinates)

setSelectionAspectRatio | ( | self, |
|  | int | width,
|  | int | height
| ) |  |  |

Sets the aspect ration that the selected subimage should have. The way to select it, is specifying an example valid width and height.

See also:
  setFreeSelectionAspectRatio()

QRect unzoomedSelectedRegion | ( |  | self ) |

Returns the selected region ( in unzoomed, original pixmap coordinates )

## Enumeration Documentation

RotateDirection

This enum provides a rotation direction.

See also:
  KPixmapRegionSelectorWidget.rotate()

Enumerator:

  Rotate90 |
  Rotate180 |
  Rotate270 |