mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-14 20:33:05 +02:00
Update the behavior of the option "Do not store the labels of items in the copy paste", to work well with the formula.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4928 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
parent
34d7d134d3
commit
57f58d78ad
@ -171,16 +171,20 @@ void PasteDiagramCommand::redo()
|
|||||||
diagram -> showMe();
|
diagram -> showMe();
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
if (first_redo) {
|
if (first_redo)
|
||||||
|
{
|
||||||
first_redo = false;
|
first_redo = false;
|
||||||
|
|
||||||
//this is the first paste, we do some actions for the new element
|
//this is the first paste, we do some actions for the new element
|
||||||
foreach(Element *e, content.elements) {
|
const QList <Element *> elmts_list = content.elements.toList();
|
||||||
|
for (Element *e : elmts_list)
|
||||||
|
{
|
||||||
//make new uuid, because old uuid are the uuid of the copied element
|
//make new uuid, because old uuid are the uuid of the copied element
|
||||||
e -> newUuid();
|
e -> newUuid();
|
||||||
|
|
||||||
//Reset the text of report element
|
//Reset the text of report element
|
||||||
if (e -> linkType() & Element::AllReport) {
|
if (e -> linkType() & Element::AllReport)
|
||||||
|
{
|
||||||
|
|
||||||
//Befor commit 3559 there isn't text field tagged label,
|
//Befor commit 3559 there isn't text field tagged label,
|
||||||
//so if not found we take the first text field
|
//so if not found we take the first text field
|
||||||
@ -194,8 +198,10 @@ void PasteDiagramCommand::redo()
|
|||||||
if (ElementTextItem *eti = e->taggedText("tension-protocol"))
|
if (ElementTextItem *eti = e->taggedText("tension-protocol"))
|
||||||
eti->setPlainText("_");
|
eti->setPlainText("_");
|
||||||
}
|
}
|
||||||
if (settings.value("diagramcommands/save-label", true).toBool()){
|
if (settings.value("diagramcommands/save-label", true).toBool())
|
||||||
|
{
|
||||||
//Reset the information about the label, the comment and location
|
//Reset the information about the label, the comment and location
|
||||||
|
e -> rElementInformations().addValue("formula", "");
|
||||||
e -> rElementInformations().addValue("label", "");
|
e -> rElementInformations().addValue("label", "");
|
||||||
e -> rElementInformations().addValue("comment", "");
|
e -> rElementInformations().addValue("comment", "");
|
||||||
e -> rElementInformations().addValue("location", "");
|
e -> rElementInformations().addValue("location", "");
|
||||||
@ -205,23 +211,34 @@ void PasteDiagramCommand::redo()
|
|||||||
eti -> setPlainText("_");
|
eti -> setPlainText("_");
|
||||||
|
|
||||||
//Reset the text of conductors
|
//Reset the text of conductors
|
||||||
foreach (Conductor *c, content.conductorsToMove) {
|
const QList <Conductor *> conductors_list = content.conductorsToMove.toList();
|
||||||
|
for (Conductor *c : conductors_list)
|
||||||
|
{
|
||||||
ConductorProperties cp = c -> properties();
|
ConductorProperties cp = c -> properties();
|
||||||
cp.text = c->diagram() ? c -> diagram() -> defaultConductorProperties.text : "_";
|
cp.text = c->diagram() ? c -> diagram() -> defaultConductorProperties.text : "_";
|
||||||
c -> setProperties(cp);
|
c -> setProperties(cp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
//We call update label, notably to setup the connection required by the formula of the element
|
||||||
|
e->updateLabel();
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
foreach (QGraphicsItem *item, content.items(filter)) {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const QList <QGraphicsItem *> qgis_list = content.items(filter);
|
||||||
|
for (QGraphicsItem *item : qgis_list)
|
||||||
|
{
|
||||||
diagram->item_paste = true;
|
diagram->item_paste = true;
|
||||||
diagram->addItem(item);
|
diagram->addItem(item);
|
||||||
diagram->item_paste = false;
|
diagram->item_paste = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (QGraphicsItem *qgi, content.items())
|
const QList <QGraphicsItem *> qgis_list = content.items();
|
||||||
|
for (QGraphicsItem *qgi : qgis_list)
|
||||||
qgi -> setSelected(true);
|
qgi -> setSelected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user