Seamly2D
Code documentation
VPieceItem Class Referenceabstract

#include <vpieceitem.h>

Inheritance diagram for VPieceItem:
Collaboration diagram for VPieceItem:

Public Types

enum  MoveType {
  NotMovable = 0x0 , IsRotatable = 0x1 , IsResizable = 0x2 , IsMovable = 0x4 ,
  AllModifications = IsRotatable | IsResizable | IsMovable , Error = 0x8
}
 
enum  { Type = UserType + static_cast<int>(Vis::PieceItem) }
 

Signals

void itemMoved (const QPointF &ptPos)
 

Public Member Functions

 VPieceItem (QGraphicsItem *pParent=nullptr)
 
virtual ~VPieceItem ()
 
virtual QRectF boundingRect () const Q_DECL_OVERRIDE
 boundingRect returns the item bounding box More...
 
virtual void Update ()=0
 
void Reset ()
 Reset resets the item, putting the mode and z coordinate to normal and redraws it. More...
 
bool IsIdle () const
 IsIdle returns the idle flag. More...
 
VPieceItem::MoveTypes GetMoveType () const
 
void SetMoveType (const VPieceItem::MoveTypes &moveType)
 
virtual int type () const Q_DECL_OVERRIDE
 

Protected Types

enum  Mode { mNormal , mMove , mResize , mRotate }
 

Protected Member Functions

virtual double GetAngle (const QPointF &pt) const
 GetAngle calculates the angle between the line, which goes from rotation center to pt and x axis. More...
 

Protected Attributes

QRectF m_rectBoundingBox
 
Mode m_eMode
 
bool m_bReleased
 
QPointF m_ptRotCenter
 
VPieceItem::MoveTypes m_moveType
 
qreal m_inactiveZ
 

Detailed Description

Definition at line 60 of file vpieceitem.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Definition at line 89 of file vpieceitem.h.

◆ Mode

enum VPieceItem::Mode
protected
Enumerator
mNormal 
mMove 
mResize 
mRotate 

Definition at line 95 of file vpieceitem.h.

◆ MoveType

Enumerator
NotMovable 
IsRotatable 
IsResizable 
IsMovable 
AllModifications 
Error 

Definition at line 64 of file vpieceitem.h.

Constructor & Destructor Documentation

◆ VPieceItem()

VPieceItem::VPieceItem ( QGraphicsItem *  pParent = nullptr)
explicit

Definition at line 58 of file vpieceitem.cpp.

References m_rectBoundingBox.

◆ ~VPieceItem()

VPieceItem::~VPieceItem ( )
virtual

Definition at line 72 of file vpieceitem.cpp.

Member Function Documentation

◆ boundingRect()

QRectF VPieceItem::boundingRect ( ) const
virtual

boundingRect returns the item bounding box

Returns
item bounding box

Definition at line 81 of file vpieceitem.cpp.

References m_rectBoundingBox.

Referenced by VTextGraphicsItem::paint(), PatternPieceTool::SaveResizePattern(), PatternPieceTool::saveResizePiece(), VTextGraphicsItem::setSize(), and PatternPieceTool::UpdateLabelItem().

◆ GetAngle()

double VPieceItem::GetAngle ( const QPointF &  pt) const
protectedvirtual

GetAngle calculates the angle between the line, which goes from rotation center to pt and x axis.

Parameters
ptpoint of interest
Returns
the angle between line from rotation center and point of interest and x axis

Reimplemented in VGrainlineItem.

Definition at line 118 of file vpieceitem.cpp.

References m_ptRotCenter.

Referenced by VGrainlineItem::GetAngle(), VTextGraphicsItem::mouseMoveEvent(), and VTextGraphicsItem::mousePressEvent().

◆ GetMoveType()

VPieceItem::MoveTypes VPieceItem::GetMoveType ( ) const

Definition at line 134 of file vpieceitem.cpp.

References m_moveType.

◆ IsIdle()

bool VPieceItem::IsIdle ( ) const

IsIdle returns the idle flag.

Returns
true, if item mode is normal and false otherwise.

Definition at line 107 of file vpieceitem.cpp.

References m_eMode, and mNormal.

Referenced by PatternPieceTool::paint().

◆ itemMoved

void VPieceItem::itemMoved ( const QPointF &  ptPos)
signal

◆ Reset()

void VPieceItem::Reset ( )

Reset resets the item, putting the mode and z coordinate to normal and redraws it.

Definition at line 90 of file vpieceitem.cpp.

References m_bReleased, m_eMode, m_inactiveZ, mNormal, and Update().

Referenced by PatternPieceTool::ResetChildren(), and VGrainlineItem::VGrainlineItem().

◆ SetMoveType()

void VPieceItem::SetMoveType ( const VPieceItem::MoveTypes &  moveType)

Definition at line 140 of file vpieceitem.cpp.

References m_moveType, and NotMovable.

Referenced by PatternPieceTool::PrepareLabelData(), and PatternPieceTool::UpdateGrainline().

◆ type()

virtual int VPieceItem::type ( ) const
inlinevirtual

Reimplemented in VTextGraphicsItem, and VGrainlineItem.

Definition at line 88 of file vpieceitem.h.

References Type.

◆ Update()

virtual void VPieceItem::Update ( )
pure virtual

Implemented in VTextGraphicsItem, and VGrainlineItem.

Referenced by Reset().

Member Data Documentation

◆ m_bReleased

bool VPieceItem::m_bReleased
protected

◆ m_eMode

◆ m_inactiveZ

qreal VPieceItem::m_inactiveZ
protected

◆ m_moveType

◆ m_ptRotCenter

◆ m_rectBoundingBox


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