LibrePCB Developers Documentation
Loading...
Searching...
No Matches
ImageGraphicsItem Class Referencefinal

The ImageGraphicsItem class is the graphical representation of a librepcb::Image. More...

#include <imagegraphicsitem.h>

Inherits QGraphicsItem.

+ Collaboration diagram for ImageGraphicsItem:

Public Member Functions

 ImageGraphicsItem ()=delete
 
 ImageGraphicsItem (const ImageGraphicsItem &other)=delete
 
 ImageGraphicsItem (const TransactionalDirectory &dir, const std::shared_ptr< Image > &image, const GraphicsLayerList &layers, QGraphicsItem *parent=nullptr) noexcept
 
virtual ~ImageGraphicsItem () noexcept
 
const std::shared_ptr< Image > & getObj () noexcept
 
bool isResizeHandleAtPosition (const Point &pos) const noexcept
 
void setEditable (bool editable) noexcept
 
QRectF boundingRect () const noexcept override
 
QPainterPath shape () const noexcept override
 
ImageGraphicsItemoperator= (const ImageGraphicsItem &rhs)=delete
 

Private Member Functions

QVariant itemChange (GraphicsItemChange change, const QVariant &value) noexcept override
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) noexcept override
 
void imageEdited (const Image &image, Image::Event event) noexcept
 
void updatePixmap () noexcept
 
void updateBoundingRectAndShape () noexcept
 

Private Attributes

const TransactionalDirectorymDir
 
std::shared_ptr< ImagemImage
 
bool mEditable
 
std::shared_ptr< const GraphicsLayermBordersLayer
 
std::unique_ptr< OriginCrossGraphicsItemmOriginCrossGraphicsItem
 
QPixmap mPixmap
 
QRectF mImageRectPx
 
QRectF mBoundingRect
 
QPainterPath mShape
 
qreal mVertexHandleRadiusPx
 
bool mInvalidImage
 
Image::OnEditedSlot mOnEditedSlot
 

Detailed Description

The ImageGraphicsItem class is the graphical representation of a librepcb::Image.

Constructor & Destructor Documentation

◆ ImageGraphicsItem() [1/3]

ImageGraphicsItem ( )
delete

◆ ImageGraphicsItem() [2/3]

ImageGraphicsItem ( const ImageGraphicsItem other)
delete

◆ ImageGraphicsItem() [3/3]

ImageGraphicsItem ( const TransactionalDirectory dir,
const std::shared_ptr< Image > &  image,
const GraphicsLayerList layers,
QGraphicsItem *  parent = nullptr 
)
noexcept

◆ ~ImageGraphicsItem()

~ImageGraphicsItem ( )
virtualnoexcept

Member Function Documentation

◆ getObj()

const std::shared_ptr< Image > & getObj ( )
inlinenoexcept

◆ isResizeHandleAtPosition()

bool isResizeHandleAtPosition ( const Point pos) const
noexcept

Check if the resize handle is at a specific position

Parameters
posThe position to check for the handle.
Returns
True if there is a handle, false if not.
+ Here is the call graph for this function:

◆ setEditable()

void setEditable ( bool  editable)
noexcept

Enable/disable editing mode when selected

If the item is editable and selected, vertex handles will be shown to indicate that they can be moved. If not editable, handles will not be shown.

Parameters
editableWhether the image is (visually) editable or not.

◆ boundingRect()

QRectF boundingRect ( ) const
inlineoverridenoexcept

◆ shape()

QPainterPath shape ( ) const
inlineoverridenoexcept

◆ operator=()

ImageGraphicsItem & operator= ( const ImageGraphicsItem rhs)
delete

◆ itemChange()

QVariant itemChange ( GraphicsItemChange  change,
const QVariant &  value 
)
overrideprivatenoexcept

◆ paint()

void paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget = 0 
)
overrideprivatenoexcept

◆ imageEdited()

void imageEdited ( const Image image,
Image::Event  event 
)
privatenoexcept

◆ updatePixmap()

void updatePixmap ( )
privatenoexcept
+ Here is the call graph for this function:

◆ updateBoundingRectAndShape()

void updateBoundingRectAndShape ( )
privatenoexcept
+ Here is the call graph for this function:

Member Data Documentation

◆ mDir

const TransactionalDirectory& mDir
private

◆ mImage

std::shared_ptr<Image> mImage
private

◆ mEditable

bool mEditable
private

◆ mBordersLayer

std::shared_ptr<const GraphicsLayer> mBordersLayer
private

◆ mOriginCrossGraphicsItem

std::unique_ptr<OriginCrossGraphicsItem> mOriginCrossGraphicsItem
private

◆ mPixmap

QPixmap mPixmap
private

◆ mImageRectPx

QRectF mImageRectPx
private

◆ mBoundingRect

QRectF mBoundingRect
private

◆ mShape

QPainterPath mShape
private

◆ mVertexHandleRadiusPx

qreal mVertexHandleRadiusPx
private

◆ mInvalidImage

bool mInvalidImage
private

◆ mOnEditedSlot

Image::OnEditedSlot mOnEditedSlot
private

The documentation for this class was generated from the following files: