mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
Past command: reset some info about the pasted element (label, comment, and text of report)
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3393 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -196,14 +196,33 @@ void PasteDiagramCommand::undo() {
|
||||
foreach(QGraphicsItem *qgi, content.items(DiagramContent::Images | DiagramContent::Shapes)) diagram -> removeItem(qgi);
|
||||
}
|
||||
|
||||
/// refait le coller
|
||||
/**
|
||||
* @brief PasteDiagramCommand::redo
|
||||
*/
|
||||
void PasteDiagramCommand::redo() {
|
||||
diagram -> showMe();
|
||||
|
||||
if (first_redo) {
|
||||
first_redo = false;
|
||||
//this is the first paste, we make new uuid for each element
|
||||
//because old uuid are the uuid of the copied element
|
||||
foreach(Element *e, content.elements) e->newUuid();
|
||||
|
||||
//this is the first paste, we do some actions for the new element
|
||||
foreach(Element *e, content.elements) {
|
||||
//make new uuid, because old uuid are the uuid of the copied element
|
||||
e -> newUuid();
|
||||
|
||||
//Reset the text of report element
|
||||
if (e -> linkType() & Element::AllReport) {
|
||||
if (e->texts().size())
|
||||
e->texts().first()->setPlainText("/");
|
||||
} else {
|
||||
//Reset the information about the label and the comment
|
||||
e -> rElementInformations().addValue("label", "");
|
||||
e -> rElementInformations().addValue("comment", "");
|
||||
|
||||
//Reset the text field tagged "label
|
||||
e -> taggedText("label") -> setPlainText("_");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// paste the elements
|
||||
|
||||
@@ -125,9 +125,10 @@ class Element : public QetGraphicsItem {
|
||||
|
||||
//METHODS related to information
|
||||
public:
|
||||
DiagramContext elementInformations()const {return element_informations_;}
|
||||
virtual void setElementInformations(DiagramContext dc);
|
||||
DiagramContext kindInformations() const {return kind_informations_;} //@kind_information_ is used to store more information
|
||||
DiagramContext elementInformations ()const {return element_informations_;}
|
||||
DiagramContext& rElementInformations () {return element_informations_;}
|
||||
virtual void setElementInformations (DiagramContext dc);
|
||||
DiagramContext kindInformations () const {return kind_informations_;} //@kind_information_ is used to store more information
|
||||
//about the herited class like contactelement for know
|
||||
// kind of contact (simple tempo) or number of contact show by the element.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user