mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-14 20:33:05 +02:00
Fix bug: scene rect was wrong when border propertie is same in code and config.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3875 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
parent
dc3dcf9e90
commit
2a04e3c64f
@ -199,7 +199,6 @@ void BorderTitleBlock::borderToXml(QDomElement &xml_elmt) {
|
|||||||
@param xml_elmt the XML element values will be read from
|
@param xml_elmt the XML element values will be read from
|
||||||
*/
|
*/
|
||||||
void BorderTitleBlock::borderFromXml(const QDomElement &xml_elmt) {
|
void BorderTitleBlock::borderFromXml(const QDomElement &xml_elmt) {
|
||||||
QRectF old_rect = diagram_rect_;
|
|
||||||
bool ok;
|
bool ok;
|
||||||
// columns count
|
// columns count
|
||||||
int cols_count = xml_elmt.attribute("cols").toInt(&ok);
|
int cols_count = xml_elmt.attribute("cols").toInt(&ok);
|
||||||
@ -229,11 +228,6 @@ void BorderTitleBlock::borderFromXml(const QDomElement &xml_elmt) {
|
|||||||
displayRows(xml_elmt.attribute("displayrows") != "false");
|
displayRows(xml_elmt.attribute("displayrows") != "false");
|
||||||
|
|
||||||
updateRectangles();
|
updateRectangles();
|
||||||
|
|
||||||
//We emit signal even if diagram_rect not change
|
|
||||||
//For calcul the scene rect when diagram load the first time the border.
|
|
||||||
if (old_rect == diagram_rect_)
|
|
||||||
emit(borderChanged(old_rect, old_rect));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,11 +74,8 @@ Diagram::Diagram(QETProject *project) :
|
|||||||
|
|
||||||
connect(&border_and_titleblock, SIGNAL(needTitleBlockTemplate(const QString &)), this, SLOT(setTitleBlockTemplate(const QString &)));
|
connect(&border_and_titleblock, SIGNAL(needTitleBlockTemplate(const QString &)), this, SLOT(setTitleBlockTemplate(const QString &)));
|
||||||
connect(&border_and_titleblock, SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(titleChanged(const QString &)));
|
connect(&border_and_titleblock, SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(titleChanged(const QString &)));
|
||||||
connect(&border_and_titleblock, &BorderTitleBlock::borderChanged, [this]() {
|
connect(&border_and_titleblock, SIGNAL(borderChanged(QRectF,QRectF)), this, SLOT(adjustSceneRect()));
|
||||||
QRectF old_rect = this->sceneRect();
|
adjustSceneRect();
|
||||||
this->setSceneRect(border_and_titleblock.borderAndTitleBlockRect().united(this->itemsBoundingRect()));
|
|
||||||
this->update(old_rect.united(this->sceneRect()));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -805,7 +802,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
content_ptr -> images = added_images.toSet();
|
content_ptr -> images = added_images.toSet();
|
||||||
content_ptr -> shapes = added_shapes.toSet();
|
content_ptr -> shapes = added_shapes.toSet();
|
||||||
}
|
}
|
||||||
|
adjustSceneRect();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1186,6 +1183,17 @@ bool Diagram::usesTitleBlockTemplate(const QString &name) {
|
|||||||
return(name == border_and_titleblock.titleBlockTemplateName());
|
return(name == border_and_titleblock.titleBlockTemplateName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Diagram::adjustSceneRect
|
||||||
|
* Recalcul and adjust the size of the scene
|
||||||
|
*/
|
||||||
|
void Diagram::adjustSceneRect()
|
||||||
|
{
|
||||||
|
QRectF old_rect = sceneRect();
|
||||||
|
setSceneRect(border_and_titleblock.borderAndTitleBlockRect().united(itemsBoundingRect()));
|
||||||
|
update(old_rect.united(sceneRect()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Cette methode permet d'appliquer de nouvelles options de rendu tout en
|
Cette methode permet d'appliquer de nouvelles options de rendu tout en
|
||||||
accedant aux proprietes de rendu en cours.
|
accedant aux proprietes de rendu en cours.
|
||||||
|
@ -208,16 +208,17 @@ class Diagram : public QGraphicsScene
|
|||||||
QGIManager &qgiManager();
|
QGIManager &qgiManager();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void titleChanged(const QString &);
|
void adjustSceneRect ();
|
||||||
void diagramTextChanged(DiagramTextItem *, const QString &, const QString &);
|
void titleChanged(const QString &);
|
||||||
void titleBlockTemplateChanged(const QString &);
|
void diagramTextChanged(DiagramTextItem *, const QString &, const QString &);
|
||||||
void titleBlockTemplateRemoved(const QString &, const QString & = QString());
|
void titleBlockTemplateChanged(const QString &);
|
||||||
void setTitleBlockTemplate(const QString &);
|
void titleBlockTemplateRemoved(const QString &, const QString & = QString());
|
||||||
|
void setTitleBlockTemplate(const QString &);
|
||||||
|
|
||||||
// methods related to graphics items selection
|
// methods related to graphics items selection
|
||||||
void selectAll();
|
void selectAll();
|
||||||
void deselectAll();
|
void deselectAll();
|
||||||
void invertSelection();
|
void invertSelection();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void showDiagram (Diagram *);
|
void showDiagram (Diagram *);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user