Widget used to edit text item group can edit the pos of the group.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5408 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2018-06-21 18:44:13 +00:00
parent 4cdd17e21f
commit de9096d8a2
4 changed files with 95 additions and 10 deletions

View File

@@ -465,6 +465,26 @@ void ElementTextItemGroup::setRotation(qreal angle)
emit rotationChanged(angle);
}
void ElementTextItemGroup::setPos(const QPointF &pos)
{
QPointF old_pos = this->pos();
QGraphicsItemGroup::setPos(pos);
if (old_pos.x() != this->pos().x())
emit xChanged();
if (old_pos.y() != this->pos().y())
emit yChanged();
}
void ElementTextItemGroup::setPos(qreal x, qreal y)
{
QPointF old_pos = this->pos();
QGraphicsItemGroup::setPos(x,y);
if (old_pos.x() != this->pos().x())
emit xChanged();
if (old_pos.y() != this->pos().y())
emit yChanged();
}
/**
* @brief ElementTextItemGroup::mousePressEvent
* @param event

View File

@@ -50,6 +50,8 @@ class ElementTextItemGroup : public QObject, public QGraphicsItemGroup
void alignmentChanged(Qt::Alignment);
void nameChanged(QString);
void holdToBottomPageChanged(bool);
void xChanged();
void yChanged();
public:
ElementTextItemGroup(const QString &name, Element *parent);
@@ -78,6 +80,8 @@ class ElementTextItemGroup : public QObject, public QGraphicsItemGroup
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
QRectF boundingRect() const override;
void setRotation(qreal angle);
void setPos(const QPointF &pos);
void setPos(qreal x, qreal y);
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;