OpenMS
Annotation1DTextItem Class Reference

An annotation item which represents an arbitrary text on the canvas. More...

#include <OpenMS/VISUAL/ANNOTATION/Annotation1DTextItem.h>

Inheritance diagram for Annotation1DTextItem:
[legend]
Collaboration diagram for Annotation1DTextItem:
[legend]

Public Member Functions

 Annotation1DTextItem (const PointXYType &position, const QString &text, const int flags=Qt::AlignCenter)
 Constructor. More...
 
 Annotation1DTextItem (const Annotation1DTextItem &rhs)=default
 Copy constructor. More...
 
 ~Annotation1DTextItem () override=default
 Destructor. More...
 
void ensureWithinDataRange (Plot1DCanvas *const canvas, const int layer_index) override
 Ensures that the item has coordinates within the visible area of the canvas. More...
 
void draw (Plot1DCanvas *const canvas, QPainter &painter, bool flipped=false) override
 Draws the item on painter. More...
 
void move (const PointXYType delta, const Gravitator &gr, const DimMapper< 2 > &dim_mapper) override
 Moves the item on the drawing canvas; behavior depends on item type and is implemented in the subclasses. More...
 
void setPosition (const PointXYType &position)
 Sets the position of the item (in X-Y coordinates) More...
 
const PointXYTypegetPosition () const
 Returns the position of the item (in X-Y coordinates) More...
 
void setFlags (int flags)
 Set Qt flags (default: Qt::AlignCenter) More...
 
int getFlags () const
 Get Qt flags. More...
 
Annotation1DItemclone () const override
 Creates a copy of the item on the heap and returns a pointer. More...
 
- Public Member Functions inherited from Annotation1DItem
virtual ~Annotation1DItem ()
 Destructor. More...
 
const QRectF & boundingBox () const
 Returns the current bounding box of this item on the canvas where it has last been drawn. More...
 
bool isSelected () const
 Returns true if this item is currently selected on the canvas, else false. More...
 
void setSelected (bool selected)
 Sets whether this item is currently selected on the canvas or not. More...
 
void setText (const QString &text)
 Sets the text of the item. More...
 
const QString & getText () const
 Returns the text of the item. More...
 
bool editText ()
 

Protected Attributes

PointXYType position_
 The position of the item as a datatype, e.g. Peak1D. More...
 
int flags_
 
- Protected Attributes inherited from Annotation1DItem
QRectF bounding_box_
 The current bounding box of this item on the canvas where it has last been drawn. More...
 
bool selected_
 Determines whether this item is currently selected on the canvas. More...
 
QString text_
 The displayed text. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Annotation1DItem
 Annotation1DItem (const QString &text)
 Constructor. More...
 
 Annotation1DItem (const Annotation1DItem &rhs)
 Copy constructor. More...
 
void drawBoundingBox_ (QPainter &painter)
 Draws the bounding_box_. More...
 

Detailed Description

An annotation item which represents an arbitrary text on the canvas.

See also
Annotation1DItem

Constructor & Destructor Documentation

◆ Annotation1DTextItem() [1/2]

Annotation1DTextItem ( const PointXYType position,
const QString &  text,
const int  flags = Qt::AlignCenter 
)
inline

Constructor.

Referenced by Annotation1DTextItem::clone().

◆ Annotation1DTextItem() [2/2]

Annotation1DTextItem ( const Annotation1DTextItem rhs)
default

Copy constructor.

◆ ~Annotation1DTextItem()

~Annotation1DTextItem ( )
overridedefault

Destructor.

Member Function Documentation

◆ clone()

Annotation1DItem* clone ( ) const
inlineoverridevirtual

Creates a copy of the item on the heap and returns a pointer.

Implements Annotation1DItem.

References Annotation1DTextItem::Annotation1DTextItem().

◆ draw()

void draw ( Plot1DCanvas *const  canvas,
QPainter &  painter,
bool  flipped = false 
)
overridevirtual

Draws the item on painter.

Implements Annotation1DItem.

◆ ensureWithinDataRange()

void ensureWithinDataRange ( Plot1DCanvas *const  canvas,
const int  layer_index 
)
overridevirtual

Ensures that the item has coordinates within the visible area of the canvas.

Implements Annotation1DItem.

◆ getFlags()

int getFlags ( ) const
inline

Get Qt flags.

References Annotation1DTextItem::flags_.

◆ getPosition()

const PointXYType& getPosition ( ) const
inline

Returns the position of the item (in X-Y coordinates)

References Annotation1DTextItem::position_.

◆ move()

void move ( const PointXYType  delta,
const Gravitator gr,
const DimMapper< 2 > &  dim_mapper 
)
overridevirtual

Moves the item on the drawing canvas; behavior depends on item type and is implemented in the subclasses.

Implements Annotation1DItem.

◆ setFlags()

void setFlags ( int  flags)
inline

Set Qt flags (default: Qt::AlignCenter)

References Annotation1DTextItem::flags_.

◆ setPosition()

void setPosition ( const PointXYType position)
inline

Sets the position of the item (in X-Y coordinates)

References Annotation1DTextItem::position_.

Member Data Documentation

◆ flags_

int flags_
protected

◆ position_

PointXYType position_
protected

The position of the item as a datatype, e.g. Peak1D.

Referenced by Annotation1DTextItem::getPosition(), and Annotation1DTextItem::setPosition().