mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
commit
9afc97108b
@ -120,7 +120,7 @@ void ElementPrimitiveDecorator::setItems(const QList<CustomElementPart *> &items
|
|||||||
if (focusItem() != this) {
|
if (focusItem() != this) {
|
||||||
setFocus();
|
setFocus();
|
||||||
}
|
}
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -356,7 +356,7 @@ void ElementPrimitiveDecorator::adjustEffectiveBoundingRect()
|
|||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
effective_bounding_rect_ = modified_bounding_rect_ | effective_bounding_rect_;
|
effective_bounding_rect_ = modified_bounding_rect_ | effective_bounding_rect_;
|
||||||
update();
|
update();
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -492,9 +492,9 @@ QVector<QPointF> ElementPrimitiveDecorator::getResizingsPoints() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief ElementPrimitiveDecorator::adjusteHandlerPos
|
@brief ElementPrimitiveDecorator::adjustHandlerPos
|
||||||
*/
|
*/
|
||||||
void ElementPrimitiveDecorator::adjusteHandlerPos()
|
void ElementPrimitiveDecorator::adjustHandlerPos()
|
||||||
{
|
{
|
||||||
QVector <QPointF> points_vector = mapToScene(getResizingsPoints());
|
QVector <QPointF> points_vector = mapToScene(getResizingsPoints());
|
||||||
for (int i = 0 ; i < points_vector.size() ; ++i)
|
for (int i = 0 ; i < points_vector.size() ; ++i)
|
||||||
|
@ -94,7 +94,7 @@ class ElementPrimitiveDecorator : public QGraphicsObject
|
|||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void adjusteHandlerPos();
|
void adjustHandlerPos();
|
||||||
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
|
@ -207,7 +207,7 @@ QVariant PartArc::itemChange(QGraphicsItem::GraphicsItemChange change, const QVa
|
|||||||
{
|
{
|
||||||
if (change == ItemPositionHasChanged)
|
if (change == ItemPositionHasChanged)
|
||||||
{
|
{
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
}
|
}
|
||||||
else if (change == ItemSceneChange)
|
else if (change == ItemSceneChange)
|
||||||
{
|
{
|
||||||
@ -293,9 +293,9 @@ void PartArc::switchResizeMode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief PartArc::adjusteHandlerPos
|
@brief PartArc::adjustHandlerPos
|
||||||
*/
|
*/
|
||||||
void PartArc::adjusteHandlerPos()
|
void PartArc::adjustHandlerPos()
|
||||||
{
|
{
|
||||||
if (m_handler_vector.isEmpty())
|
if (m_handler_vector.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
@ -56,9 +56,9 @@ class PartArc : public AbstractPartEllipse
|
|||||||
|
|
||||||
QPainterPath shape() const override;
|
QPainterPath shape() const override;
|
||||||
QPainterPath shadowShape() const override;
|
QPainterPath shadowShape() const override;
|
||||||
void setRect(const QRectF &rect) override {AbstractPartEllipse::setRect(rect); adjusteHandlerPos();}
|
void setRect(const QRectF &rect) override {AbstractPartEllipse::setRect(rect); adjustHandlerPos();}
|
||||||
void setStartAngle(const int &start_angle) override {AbstractPartEllipse::setStartAngle(start_angle); adjusteHandlerPos();}
|
void setStartAngle(const int &start_angle) override {AbstractPartEllipse::setStartAngle(start_angle); adjustHandlerPos();}
|
||||||
void setSpanAngle(const int &span_angle) override {AbstractPartEllipse::setSpanAngle(span_angle); adjusteHandlerPos();}
|
void setSpanAngle(const int &span_angle) override {AbstractPartEllipse::setSpanAngle(span_angle); adjustHandlerPos();}
|
||||||
QRectF sceneGeometricRect() const override;
|
QRectF sceneGeometricRect() const override;
|
||||||
|
|
||||||
void addHandler() override;
|
void addHandler() override;
|
||||||
@ -71,7 +71,7 @@ class PartArc : public AbstractPartEllipse
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void switchResizeMode();
|
void switchResizeMode();
|
||||||
void adjusteHandlerPos();
|
void adjustHandlerPos();
|
||||||
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
|
@ -186,7 +186,7 @@ QVariant PartEllipse::itemChange(QGraphicsItem::GraphicsItemChange change, const
|
|||||||
{
|
{
|
||||||
if (change == ItemPositionHasChanged)
|
if (change == ItemPositionHasChanged)
|
||||||
{
|
{
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
}
|
}
|
||||||
else if (change == ItemSceneChange)
|
else if (change == ItemSceneChange)
|
||||||
{
|
{
|
||||||
@ -253,9 +253,9 @@ void PartEllipse::switchResizeMode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief PartEllipse::adjusteHandlerPos
|
@brief PartEllipse::adjustHandlerPos
|
||||||
*/
|
*/
|
||||||
void PartEllipse::adjusteHandlerPos()
|
void PartEllipse::adjustHandlerPos()
|
||||||
{
|
{
|
||||||
if (m_handler_vector.isEmpty())
|
if (m_handler_vector.isEmpty())
|
||||||
return;
|
return;
|
||||||
@ -305,7 +305,7 @@ void PartEllipse::handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphicsS
|
|||||||
else
|
else
|
||||||
setRect(QetGraphicsHandlerUtility::mirrorRectForPosAtIndex(m_rect, new_pos, m_vector_index));
|
setRect(QetGraphicsHandlerUtility::mirrorRectForPosAtIndex(m_rect, new_pos, m_vector_index));
|
||||||
|
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +56,7 @@ class PartEllipse : public AbstractPartEllipse
|
|||||||
void fromXml (const QDomElement &) override;
|
void fromXml (const QDomElement &) override;
|
||||||
QPainterPath shape() const override;
|
QPainterPath shape() const override;
|
||||||
QPainterPath shadowShape() const override;
|
QPainterPath shadowShape() const override;
|
||||||
void setRect(const QRectF &rect) override {AbstractPartEllipse::setRect(rect); adjusteHandlerPos();}
|
void setRect(const QRectF &rect) override {AbstractPartEllipse::setRect(rect); adjustHandlerPos();}
|
||||||
|
|
||||||
void addHandler() override;
|
void addHandler() override;
|
||||||
void removeHandler() override;
|
void removeHandler() override;
|
||||||
@ -68,7 +68,7 @@ class PartEllipse : public AbstractPartEllipse
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void switchResizeMode();
|
void switchResizeMode();
|
||||||
void adjusteHandlerPos();
|
void adjustHandlerPos();
|
||||||
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
|
@ -164,7 +164,7 @@ QVariant PartLine::itemChange(QGraphicsItem::GraphicsItemChange change, const QV
|
|||||||
{
|
{
|
||||||
if (change == ItemPositionHasChanged)
|
if (change == ItemPositionHasChanged)
|
||||||
{
|
{
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
}
|
}
|
||||||
else if (change == ItemSceneChange)
|
else if (change == ItemSceneChange)
|
||||||
{
|
{
|
||||||
@ -215,10 +215,10 @@ bool PartLine::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief PartLine::adjusteHandlerPos
|
@brief PartLine::adjustHandlerPos
|
||||||
Adjust the position of the handler item
|
Adjust the position of the handler item
|
||||||
*/
|
*/
|
||||||
void PartLine::adjusteHandlerPos()
|
void PartLine::adjustHandlerPos()
|
||||||
{
|
{
|
||||||
if(m_handler_vector.isEmpty())
|
if(m_handler_vector.isEmpty())
|
||||||
return;
|
return;
|
||||||
@ -272,7 +272,7 @@ void PartLine::handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphicsScen
|
|||||||
|
|
||||||
emit lineChanged();
|
emit lineChanged();
|
||||||
|
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -540,7 +540,7 @@ void PartLine::setLine(const QLineF &line)
|
|||||||
if (m_line == line) return;
|
if (m_line == line) return;
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
m_line = line;
|
m_line = line;
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
emit lineChanged();
|
emit lineChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ class PartLine : public CustomElementGraphicPart
|
|||||||
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override;
|
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void adjusteHandlerPos();
|
void adjustHandlerPos();
|
||||||
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
|
@ -219,7 +219,7 @@ void PartPolygon::setPolygon(const QPolygonF &polygon)
|
|||||||
if (m_polygon == polygon) return;
|
if (m_polygon == polygon) return;
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
m_polygon = polygon;
|
m_polygon = polygon;
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
emit polygonChanged();
|
emit polygonChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,7 +320,7 @@ QVariant PartPolygon::itemChange(QGraphicsItem::GraphicsItemChange change, const
|
|||||||
{
|
{
|
||||||
if (change == ItemPositionHasChanged)
|
if (change == ItemPositionHasChanged)
|
||||||
{
|
{
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
}
|
}
|
||||||
else if (change == ItemSceneChange)
|
else if (change == ItemSceneChange)
|
||||||
{
|
{
|
||||||
@ -395,9 +395,9 @@ void PartPolygon::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief PartPolygon::adjusteHandlerPos
|
@brief PartPolygon::adjustHandlerPos
|
||||||
*/
|
*/
|
||||||
void PartPolygon::adjusteHandlerPos()
|
void PartPolygon::adjustHandlerPos()
|
||||||
{
|
{
|
||||||
if(m_handler_vector.isEmpty())
|
if(m_handler_vector.isEmpty())
|
||||||
return;
|
return;
|
||||||
@ -446,7 +446,7 @@ void PartPolygon::handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphicsS
|
|||||||
|
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
m_polygon.replace(m_vector_index, new_pos);
|
m_polygon.replace(m_vector_index, new_pos);
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
emit polygonChanged();
|
emit polygonChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ class PartPolygon : public CustomElementGraphicPart
|
|||||||
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
|
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void adjusteHandlerPos();
|
void adjustHandlerPos();
|
||||||
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
|
@ -147,7 +147,7 @@ void PartRectangle::setRect(const QRectF &rect)
|
|||||||
if (rect == m_rect) return;
|
if (rect == m_rect) return;
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
m_rect = rect;
|
m_rect = rect;
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
emit rectChanged();
|
emit rectChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ void PartRectangle::setXRadius(qreal X)
|
|||||||
{
|
{
|
||||||
m_xRadius = X;
|
m_xRadius = X;
|
||||||
update();
|
update();
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
emit XRadiusChanged();
|
emit XRadiusChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ void PartRectangle::setYRadius(qreal Y)
|
|||||||
{
|
{
|
||||||
m_yRadius = Y;
|
m_yRadius = Y;
|
||||||
update();
|
update();
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
emit YRadiusChanged();
|
emit YRadiusChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ QVariant PartRectangle::itemChange(QGraphicsItem::GraphicsItemChange change, con
|
|||||||
{
|
{
|
||||||
if (change == ItemPositionHasChanged)
|
if (change == ItemPositionHasChanged)
|
||||||
{
|
{
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
}
|
}
|
||||||
else if (change == ItemSceneChange)
|
else if (change == ItemSceneChange)
|
||||||
{
|
{
|
||||||
@ -387,9 +387,9 @@ void PartRectangle::switchResizeMode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief PartRectangle::adjusteHandlerPos
|
@brief PartRectangle::adjustHandlerPos
|
||||||
*/
|
*/
|
||||||
void PartRectangle::adjusteHandlerPos()
|
void PartRectangle::adjustHandlerPos()
|
||||||
{
|
{
|
||||||
if (m_handler_vector.isEmpty()) {
|
if (m_handler_vector.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@ -469,7 +469,7 @@ void PartRectangle::handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PartRectangle::handlerMouseReleaseEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
|
void PartRectangle::handlerMouseReleaseEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
|
||||||
|
@ -95,7 +95,7 @@ class PartRectangle : public CustomElementGraphicPart
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void switchResizeMode();
|
void switchResizeMode();
|
||||||
void adjusteHandlerPos();
|
void adjustHandlerPos();
|
||||||
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
|
||||||
|
@ -58,9 +58,10 @@ void QetGraphicsTableItem::adjustTableToFolio(
|
|||||||
|
|
||||||
auto size_ = table->size();
|
auto size_ = table->size();
|
||||||
size_.setWidth(int(drawable_rect.width() - (margins.left() + margins.right())));
|
size_.setWidth(int(drawable_rect.width() - (margins.left() + margins.right())));
|
||||||
//Size must be a multiple of 10, because the table adjust itself by step of 10.
|
//Size must be a multiple of 10, because the table adjusts itself by step of 10.
|
||||||
while (size_.width()%10) {
|
while (size_.width()%10) {
|
||||||
--size_.rwidth(); }
|
--size_.rwidth();
|
||||||
|
}
|
||||||
table->setSize(size_);
|
table->setSize(size_);
|
||||||
|
|
||||||
//Calculate the maximum row to display to fit the nomenclature into diagram
|
//Calculate the maximum row to display to fit the nomenclature into diagram
|
||||||
|
@ -203,7 +203,7 @@ void Conductor::segmentsToPath()
|
|||||||
if (isSelected() && !m_moving_segment)
|
if (isSelected() && !m_moving_segment)
|
||||||
{
|
{
|
||||||
if(handlerPoints().size() == m_handler_vector.size())
|
if(handlerPoints().size() == m_handler_vector.size())
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
removeHandler();
|
removeHandler();
|
||||||
@ -718,7 +718,7 @@ QVariant Conductor::itemChange(GraphicsItemChange change, const QVariant &value)
|
|||||||
calculateTextItemPosition();
|
calculateTextItemPosition();
|
||||||
}
|
}
|
||||||
else if (change == QGraphicsItem::ItemPositionHasChanged && isSelected()) {
|
else if (change == QGraphicsItem::ItemPositionHasChanged && isSelected()) {
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
return(QGraphicsObject::itemChange(change, value));
|
return(QGraphicsObject::itemChange(change, value));
|
||||||
@ -770,10 +770,10 @@ bool Conductor::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Conductor::adjusteHandlerPos
|
@brief Conductor::adjustHandlerPos
|
||||||
Adjust the position of the handler item
|
Adjust the position of the handler item
|
||||||
*/
|
*/
|
||||||
void Conductor::adjusteHandlerPos()
|
void Conductor::adjustHandlerPos()
|
||||||
{
|
{
|
||||||
if (m_handler_vector.isEmpty())
|
if (m_handler_vector.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
@ -164,7 +164,7 @@ class Conductor : public QGraphicsObject
|
|||||||
QGraphicsItem *watched, QEvent *event) override;
|
QGraphicsItem *watched, QEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void adjusteHandlerPos();
|
void adjustHandlerPos();
|
||||||
|
|
||||||
void handlerMousePressEvent(
|
void handlerMousePressEvent(
|
||||||
QetGraphicsHandlerItem *qghi,
|
QetGraphicsHandlerItem *qghi,
|
||||||
|
@ -805,13 +805,13 @@ bool Element::fromXml(QDomElement &e,
|
|||||||
// orientation
|
// orientation
|
||||||
bool conv_ok;
|
bool conv_ok;
|
||||||
int read_ori = e.attribute(QStringLiteral("orientation")).toInt(&conv_ok);
|
int read_ori = e.attribute(QStringLiteral("orientation")).toInt(&conv_ok);
|
||||||
if (!conv_ok || read_ori < 0 || read_ori > 3) {
|
if (!(conv_ok) || (read_ori < 0) || (read_ori > 3)) {
|
||||||
read_ori = 0;
|
read_ori = 0;
|
||||||
}
|
}
|
||||||
setRotation(90*read_ori);
|
setRotation(90*read_ori);
|
||||||
|
|
||||||
//Before loading the dynamic text field,
|
//Before loading the dynamic text field,
|
||||||
//we remove the dynamic text field created from the description of this element, to avoid doublons.
|
//we remove the dynamic text field created from the description of this element, to avoid doubles.
|
||||||
for(DynamicElementTextItem *deti : m_dynamic_text_list)
|
for(DynamicElementTextItem *deti : m_dynamic_text_list)
|
||||||
delete deti;
|
delete deti;
|
||||||
m_dynamic_text_list.clear();
|
m_dynamic_text_list.clear();
|
||||||
|
@ -129,7 +129,7 @@ bool QetShapeItem::setLine(const QLineF &line)
|
|||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
m_P1 = line.p1();
|
m_P1 = line.p1();
|
||||||
m_P2 = line.p2();
|
m_P2 = line.p2();
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ bool QetShapeItem::setRect(const QRectF &rect)
|
|||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
m_P1 = rect.topLeft();
|
m_P1 = rect.topLeft();
|
||||||
m_P2 = rect.bottomRight();
|
m_P2 = rect.bottomRight();
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ bool QetShapeItem::setPolygon(const QPolygonF &polygon)
|
|||||||
}
|
}
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
m_polygon = polygon;
|
m_polygon = polygon;
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ void QetShapeItem::setXRadius(qreal X)
|
|||||||
{
|
{
|
||||||
m_xRadius = X;
|
m_xRadius = X;
|
||||||
update();
|
update();
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
emit XRadiusChanged();
|
emit XRadiusChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ void QetShapeItem::setYRadius(qreal Y)
|
|||||||
{
|
{
|
||||||
m_yRadius = Y;
|
m_yRadius = Y;
|
||||||
update();
|
update();
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
emit YRadiusChanged();
|
emit YRadiusChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,7 +398,7 @@ QVariant QetShapeItem::itemChange(QGraphicsItem::GraphicsItemChange change,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (change == ItemPositionHasChanged) {
|
else if (change == ItemPositionHasChanged) {
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
}
|
}
|
||||||
else if (change == ItemSceneHasChanged)
|
else if (change == ItemSceneHasChanged)
|
||||||
{
|
{
|
||||||
@ -606,10 +606,10 @@ void QetShapeItem::addHandler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief QetShapeItem::adjusteHandlerPos
|
@brief QetShapeItem::adjustHandlerPos
|
||||||
Adjust the position of the handler item
|
Adjust the position of the handler item
|
||||||
*/
|
*/
|
||||||
void QetShapeItem::adjusteHandlerPos()
|
void QetShapeItem::adjustHandlerPos()
|
||||||
{
|
{
|
||||||
if (m_handler_vector.isEmpty()) {
|
if (m_handler_vector.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@ -737,7 +737,7 @@ void QetShapeItem::handlerMouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
case Line:
|
case Line:
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
m_vector_index == 0 ? m_P1 = new_pos : m_P2 = new_pos;
|
m_vector_index == 0 ? m_P1 = new_pos : m_P2 = new_pos;
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Rectangle:
|
case Rectangle:
|
||||||
@ -761,7 +761,7 @@ void QetShapeItem::handlerMouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
else {
|
else {
|
||||||
setYRadius(radius);
|
setYRadius(radius);
|
||||||
}
|
}
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Ellipse:
|
case Ellipse:
|
||||||
@ -777,7 +777,7 @@ void QetShapeItem::handlerMouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
case Polygon:
|
case Polygon:
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
m_polygon.replace(m_vector_index, new_pos);
|
m_polygon.replace(m_vector_index, new_pos);
|
||||||
adjusteHandlerPos();
|
adjustHandlerPos();
|
||||||
break;
|
break;
|
||||||
} //End switch
|
} //End switch
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ class QetShapeItem : public QetGraphicsItem
|
|||||||
private:
|
private:
|
||||||
void switchResizeMode();
|
void switchResizeMode();
|
||||||
void addHandler();
|
void addHandler();
|
||||||
void adjusteHandlerPos();
|
void adjustHandlerPos();
|
||||||
void insertPoint();
|
void insertPoint();
|
||||||
void removePoint();
|
void removePoint();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user