Add saveable labels for parts and connectors
This commit is contained in:
23
Label.h
23
Label.h
@@ -1,11 +1,30 @@
|
||||
#ifndef LABEL_H
|
||||
#define LABEL_H
|
||||
|
||||
#include <QGraphicsTextItem>
|
||||
#include <QPointF>
|
||||
|
||||
class Label : public QGraphicsTextItem
|
||||
#include "eAlignMode.h"
|
||||
|
||||
class Label : private QGraphicsTextItem
|
||||
{
|
||||
public:
|
||||
Label();
|
||||
Label(QGraphicsItem* parent);
|
||||
|
||||
void setEditable(bool value);
|
||||
void setText(const QString& text);
|
||||
QString text() const;
|
||||
void alignText(QPointF anchorPos, AlignMode::AlignMode mode = AlignMode::Default);
|
||||
|
||||
private:
|
||||
QGraphicsItem* m_parentItem;
|
||||
|
||||
QPointF m_textAnchor;
|
||||
AlignMode::AlignMode m_alignMode;
|
||||
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
|
||||
void recalculateTextAlignment();
|
||||
};
|
||||
|
||||
#endif // LABEL_H
|
||||
|
||||
Reference in New Issue
Block a user