Previous topic

qarbon.qt.gui.objectinfowidget

Next topic

qarbon.qt.gui.propertyeditor

This Page

qarbon.qt.gui.pixmapwidget

A widget that displays an image (pixmap).

You can adjust properties like the aligment inside the widget space, aspect ratio and transformation mode (quality).

Example:

from qarbon.external.qt import QtGui
from qarbon.qt.gui.application import Application
from qarbon.qt.gui.icon import Pixmap
from qarbon.qt.gui.pixmapwidget import PixmapWidget

app = Application()
panel = QtGui.QWidget()
layout = QtGui.QGridLayout()
panel.setLayout(layout)
img = PixmapWidget()
layout.addWidget(img)

img.setPixmap(Pixmap(":/led/led_red_on.png"))
img.show()
app.exec_()

Inheritance diagram of PixmapWidget

Classes

PixmapWidget This widget displays an image (pixmap).
class qarbon.qt.gui.pixmapwidget.PixmapWidget(parent=None)[source]

Bases: PyQt4.QtGui.QWidget

This widget displays an image (pixmap). By default the pixmap is scaled to the widget size and the aspect ratio is kept. The default alignment of the pixmap inside the widget space is horizontal left, vertical center.

DefaultAlignment = 129
DefaultAspectRatioMode = 1
DefaultTransformationMode = 1
pixmapChanged = <PyQt4.QtCore.pyqtSignal object at 0x36dda50>

Signal emited when pixmap source changes

recalculatePixmap()[source]
paintEvent(paintEvent)[source]

Overwrite the paintEvent from QWidget to draw the pixmap

resizeEvent(event)[source]
sizeHint()[source]
getPixmap()[source]

Returns the pixmap.Returns None if no pixmap is set.

Returns:the current pixmap
Return type:QtGui.QPixmap
setPixmap(pixmap)[source]

Sets the pixmap for this widget. Setting it to None disables pixmap

Parameters:pixmap (QtGui.QPixmap) – the new pixmap
resetPixmap()[source]

Resets the pixmap for this widget.

getAspectRatioMode()[source]

Returns the aspect ratio to apply when drawing the pixmap.

Returns:the current aspect ratio
Return type:QtCore.Qt.AspectRatioMode
setAspectRatioMode(aspect)[source]

Sets the aspect ratio mode to apply when drawing the pixmap.

Parameters:pixmap (QtCore.Qt.AspectRatioMode) – the new aspect ratio mode
resetAspectRatioMode()[source]

Resets the aspect ratio mode to KeepAspectRatio

getTransformationMode()[source]

Returns the transformation mode to apply when drawing the pixmap.

Returns:the current transformation mode
Return type:QtCore.Qt.TransformationMode
setTransformationMode(transformation)[source]

Sets the transformation mode to apply when drawing the pixmap.

Parameters:pixmap (QtCore.Qt.TransformationMode) – the new transformation mode
resetTransformationMode()[source]

Resets the transformation mode to SmoothTransformation

getAlignment()[source]

Returns the alignment to apply when drawing the pixmap.

Returns:the current alignment
Return type:QtCore.Qt.Alignment
setAlignment(alignment)[source]

Sets the alignment to apply when drawing the pixmap.

Parameters:pixmap (QtCore.Qt.Alignment) – the new alignment
resetAlignment()[source]

Resets the transformation mode to QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter

pixmap = <PyQt4.QtCore.pyqtProperty object at 0x36ddb10>

This property holds the widget’s pixmap

Access functions:

aspectRatioMode = <PyQt4.QtCore.pyqtProperty object at 0x36ddb50>

This property holds the widget’s pixmap aspect ratio mode

Access functions:

transformationMode = <PyQt4.QtCore.pyqtProperty object at 0x36ddb90>

This property holds the widget’s pixmap transformation mode

Access functions:

alignment = <PyQt4.QtCore.pyqtProperty object at 0x36ddbd0>

This property holds the widget’s pixmap alignment

Access functions: