|
| | DImgChildItem (QGraphicsItem *const parent=nullptr) |
| | This is a base class for items that are positioned on top of a GraphicsDImgItem, positioned in relative coordinates, i.e.
|
| QRectF | boundingRect () const override |
| | Reimplemented.
|
|
void | moveBy (qreal dx, qreal dy) |
|
QPoint | originalPos () const |
| QRect | originalRect () const |
|
QSize | originalSize () const |
|
GraphicsDImgItem * | parentDImgItem () const |
| | If the parent item is a GraphicsDImgItem, return it, if the parent item is null or of a different class, returns nullptr.
|
| QRectF | rect () const |
|
QPointF | relativePos () const |
| QRectF | relativeRect () const |
|
QSizeF | relativeSize () const |
| void | setOriginalPos (const QPointF &posInOriginal) |
| | Sets the position and size of this item, in coordinates of the original image.
|
|
void | setOriginalPos (qreal x, qreal y) |
|
void | setOriginalRect (const QRectF &rect) |
|
void | setOriginalRect (qreal x, qreal y, qreal width, qreal height) |
|
void | setOriginalSize (const QSizeF &sizeInOriginal) |
|
void | setOriginalSize (qreal width, qreal height) |
| void | setPos (const QPointF &zoomedPos) |
| | Sets the position and size of this item, in coordinates of the parent DImg item.
|
|
void | setPos (qreal x, qreal y) |
|
void | setRect (const QRectF &rect) |
|
void | setRect (qreal x, qreal y, qreal width, qreal height) |
|
void | setRectInSceneCoordinates (const QRectF &rect) |
| | Equivalent to mapping the scene coordinates to the parent item, and calling setRect().
|
| void | setRelativePos (const QPointF &relativePosition) |
| | Sets the position and size of this item, relative to the DImg displayed in the parent item.
|
|
void | setRelativePos (qreal x, qreal y) |
|
void | setRelativeRect (const QRectF &rect) |
|
void | setRelativeRect (qreal x, qreal y, qreal width, qreal height) |
|
void | setRelativeSize (const QSizeF &relativeSize) |
|
void | setRelativeSize (qreal width, qreal height) |
|
void | setSize (const QSizeF &zoomedSize) |
|
void | setSize (qreal width, qreal height) |
|
QSizeF | size () const |
| Digikam::DImgChildItem::DImgChildItem |
( |
QGraphicsItem *const | parent = nullptr | ) |
|
|
explicit |
[0;1], on the image. From the set relative size, the boundingRect() is calculated.
This is a simple example. Just create new SimpleRectChildItem(item); where item is a GrahpicsDImgItem, and at the center of the image, a rectangle of 1% the size of the image will be drawn.
class SimpleRectChildItem : public DImgChildItem { public:
SimpleRectChildItem(QGraphicsItem* const parent)
: DImgChildItem(parent)
{
setRelativePos(0.5, 0.5);
setRelativeSize(0.01, 0.01);
}
void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*)
{
painter->setPen(Qt::red);
painter->drawRect(boundingRect());
}
};