mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
ElementEditor: parttext.h code style
This commit is contained in:
committed by
Laurent Trinques
parent
3b4237f21f
commit
9bc6f7fa94
@@ -20,16 +20,15 @@
|
|||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#include "customelementpart.h"
|
#include "customelementpart.h"
|
||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
|
|
||||||
class TextEditor;
|
class TextEditor;
|
||||||
class ElementPrimitiveDecorator;
|
class ElementPrimitiveDecorator;
|
||||||
/**
|
/**
|
||||||
This class represents an static text primitive which may be used to compose
|
This class represents an static text primitive which may be used to compose
|
||||||
the drawing of an electrical element within the element editor.
|
the drawing of an electrical element within the element editor.
|
||||||
*/
|
*/
|
||||||
class PartText : public QGraphicsTextItem, public CustomElementPart
|
class PartText : public QGraphicsTextItem, public CustomElementPart {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY(qreal real_size READ realSize WRITE setRealSize)
|
Q_PROPERTY(qreal real_size READ realSize WRITE setRealSize)
|
||||||
Q_PROPERTY(QColor color READ defaultTextColor WRITE setDefaultTextColor NOTIFY colorChanged)
|
Q_PROPERTY(QColor color READ defaultTextColor WRITE setDefaultTextColor NOTIFY colorChanged)
|
||||||
Q_PROPERTY(QString text READ toPlainText WRITE setPlainText NOTIFY plainTextChanged)
|
Q_PROPERTY(QString text READ toPlainText WRITE setPlainText NOTIFY plainTextChanged)
|
||||||
@@ -39,15 +38,15 @@ class PartText : public QGraphicsTextItem, public CustomElementPart
|
|||||||
void fontChanged(const QFont &font);
|
void fontChanged(const QFont &font);
|
||||||
void colorChanged(const QColor &color);
|
void colorChanged(const QColor &color);
|
||||||
void plainTextChanged(const QString &text);
|
void plainTextChanged(const QString &text);
|
||||||
|
|
||||||
// constructors, destructor
|
// constructors, destructor
|
||||||
public:
|
public:
|
||||||
PartText(QETElementEditor *, QGraphicsItem * = nullptr);
|
PartText(QETElementEditor *, QGraphicsItem * = nullptr);
|
||||||
~PartText() override;
|
~PartText() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PartText(const PartText &);
|
PartText(const PartText &);
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
public:
|
public:
|
||||||
enum { Type = UserType + 1107 };
|
enum { Type = UserType + 1107 };
|
||||||
@@ -75,31 +74,31 @@ class PartText : public QGraphicsTextItem, public CustomElementPart
|
|||||||
void setDefaultTextColor(const QColor &color);
|
void setDefaultTextColor(const QColor &color);
|
||||||
void setPlainText(const QString &text);
|
void setPlainText(const QString &text);
|
||||||
void setFont(const QFont &font);
|
void setFont(const QFont &font);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void adjustItemPosition(int = 0);
|
void adjustItemPosition(int = 0);
|
||||||
void setEditable(bool);
|
void setEditable(bool);
|
||||||
void startEdition();
|
void startEdition();
|
||||||
void endEdition();
|
void endEdition();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
void focusInEvent(QFocusEvent *) override;
|
void focusInEvent(QFocusEvent *) override;
|
||||||
void focusOutEvent(QFocusEvent *) override;
|
void focusOutEvent(QFocusEvent *) override;
|
||||||
void keyPressEvent(QKeyEvent *) override;
|
void keyPressEvent(QKeyEvent *) override;
|
||||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) override;
|
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) override;
|
||||||
QVariant itemChange(GraphicsItemChange, const QVariant &) override;
|
QVariant itemChange(GraphicsItemChange, const QVariant &) override;
|
||||||
QRectF boundingRect() const override;
|
QRectF boundingRect() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointF margin() const;
|
QPointF margin() const;
|
||||||
QString previous_text;
|
QString previous_text;
|
||||||
qreal real_font_size_;
|
qreal real_font_size_;
|
||||||
QPointF saved_point_;
|
QPointF saved_point_;
|
||||||
qreal saved_font_size_;
|
qreal saved_font_size_;
|
||||||
QGraphicsItem *decorator_;
|
QGraphicsItem *decorator_;
|
||||||
QPointF m_origine_pos;
|
QPointF m_origine_pos;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user