mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 23:20:52 +01:00
Don't clear the texts of pasted elements.
For report element, clear the function and tension-protocol texts git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4598 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -173,16 +173,26 @@ void PasteDiagramCommand::redo()
|
|||||||
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) {
|
foreach(Element *e, content.elements) {
|
||||||
//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) {
|
||||||
if (e->texts().size())
|
|
||||||
|
//Befor commit 3559 there isn't text field tagged label,
|
||||||
|
//so if not found we take the first text field
|
||||||
|
if (ElementTextItem *eti = e->taggedText("label"))
|
||||||
|
eti->setPlainText("/");
|
||||||
|
else if (e->texts().size())
|
||||||
e->texts().first()->setPlainText("/");
|
e->texts().first()->setPlainText("/");
|
||||||
} else {
|
|
||||||
|
if (ElementTextItem *eti = e->taggedText("function"))
|
||||||
|
eti->setPlainText("_");
|
||||||
|
if (ElementTextItem *eti = e->taggedText("tension-protocol"))
|
||||||
|
eti->setPlainText("_");
|
||||||
|
} /*else {
|
||||||
//Reset the information about the label, the comment and location
|
//Reset the information about the label, the comment and location
|
||||||
e -> rElementInformations().addValue("label", "");
|
e -> rElementInformations().addValue("label", "");
|
||||||
e -> rElementInformations().addValue("comment", "");
|
e -> rElementInformations().addValue("comment", "");
|
||||||
@@ -191,22 +201,23 @@ void PasteDiagramCommand::redo()
|
|||||||
//Reset the text field tagged "label
|
//Reset the text field tagged "label
|
||||||
if (ElementTextItem *eti = e ->taggedText("label"))
|
if (ElementTextItem *eti = e ->taggedText("label"))
|
||||||
eti -> setPlainText("_");
|
eti -> setPlainText("_");
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//Reset the text of conductors
|
//Reset the text of conductors
|
||||||
foreach (Conductor *c, content.conductorsToMove) {
|
foreach (Conductor *c, content.conductorsToMove) {
|
||||||
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
|
else {
|
||||||
{
|
|
||||||
foreach (QGraphicsItem *item, content.items(filter))
|
foreach (QGraphicsItem *item, content.items(filter))
|
||||||
diagram->addItem(item);
|
diagram->addItem(item);
|
||||||
}
|
}
|
||||||
foreach (QGraphicsItem *qgi, content.items()) qgi -> setSelected(true);
|
|
||||||
|
foreach (QGraphicsItem *qgi, content.items())
|
||||||
|
qgi -> setSelected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1077,6 +1077,8 @@ ElementTextItem* CustomElement::setTaggedText(const QString &tagg, const QString
|
|||||||
/**
|
/**
|
||||||
* @brief CustomElement::taggedText
|
* @brief CustomElement::taggedText
|
||||||
* return the text field tagged with @tagg or NULL if text field isn't found
|
* return the text field tagged with @tagg or NULL if text field isn't found
|
||||||
|
* Some of available taggs :
|
||||||
|
* function, tension-protocol, label, comment, location
|
||||||
* @param tagg
|
* @param tagg
|
||||||
*/
|
*/
|
||||||
ElementTextItem* CustomElement::taggedText(const QString &tagg) const {
|
ElementTextItem* CustomElement::taggedText(const QString &tagg) const {
|
||||||
|
|||||||
Reference in New Issue
Block a user