mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 23:20:52 +01:00
Element Editor does not apply the "paste offset" the first time cut content is pasted.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2032 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -130,6 +130,7 @@ void ElementView::adjustSceneRect() {
|
|||||||
void ElementView::cut() {
|
void ElementView::cut() {
|
||||||
// delegue cette action a la scene
|
// delegue cette action a la scene
|
||||||
scene_ -> cut();
|
scene_ -> cut();
|
||||||
|
offset_paste_count_ = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -273,7 +274,15 @@ ElementContent ElementView::pasteWithOffset(const QDomDocument &xml_document) {
|
|||||||
if (pasted_content_bounding_rect.isEmpty()) return(content_pasted);
|
if (pasted_content_bounding_rect.isEmpty()) return(content_pasted);
|
||||||
|
|
||||||
// copier/coller avec decalage
|
// copier/coller avec decalage
|
||||||
|
QRectF final_pasted_content_bounding_rect;
|
||||||
++ offset_paste_count_;
|
++ offset_paste_count_;
|
||||||
|
if (!offset_paste_count_) {
|
||||||
|
// the pasted content was cut
|
||||||
|
start_top_left_corner_ = pasted_content_bounding_rect.topLeft();
|
||||||
|
final_pasted_content_bounding_rect = pasted_content_bounding_rect;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// the pasted content was copied
|
||||||
if (offset_paste_count_ == 1) {
|
if (offset_paste_count_ == 1) {
|
||||||
start_top_left_corner_ = pasted_content_bounding_rect.topLeft();
|
start_top_left_corner_ = pasted_content_bounding_rect.topLeft();
|
||||||
} else {
|
} else {
|
||||||
@@ -281,13 +290,13 @@ ElementContent ElementView::pasteWithOffset(const QDomDocument &xml_document) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// on applique le decalage qui convient
|
// on applique le decalage qui convient
|
||||||
QRectF final_pasted_content_bounding_rect = applyMovement(
|
final_pasted_content_bounding_rect = applyMovement(
|
||||||
pasted_content_bounding_rect,
|
pasted_content_bounding_rect,
|
||||||
QETElementEditor::pasteMovement(),
|
QETElementEditor::pasteMovement(),
|
||||||
QETElementEditor::pasteOffset()
|
QETElementEditor::pasteOffset()
|
||||||
);
|
);
|
||||||
|
}
|
||||||
QPointF old_start_top_left_corner_ = start_top_left_corner_;
|
QPointF old_start_top_left_corner = start_top_left_corner_;
|
||||||
start_top_left_corner_ = final_pasted_content_bounding_rect.topLeft();
|
start_top_left_corner_ = final_pasted_content_bounding_rect.topLeft();
|
||||||
scene_ -> fromXml(xml_document, start_top_left_corner_, false, &content_pasted);
|
scene_ -> fromXml(xml_document, start_top_left_corner_, false, &content_pasted);
|
||||||
|
|
||||||
@@ -295,7 +304,7 @@ ElementContent ElementView::pasteWithOffset(const QDomDocument &xml_document) {
|
|||||||
if (content_pasted.count()) {
|
if (content_pasted.count()) {
|
||||||
scene_ -> clearSelection();
|
scene_ -> clearSelection();
|
||||||
PastePartsCommand *undo_object = new PastePartsCommand(this, content_pasted);
|
PastePartsCommand *undo_object = new PastePartsCommand(this, content_pasted);
|
||||||
undo_object -> setOffset(offset_paste_count_ - 1, old_start_top_left_corner_, offset_paste_count_, start_top_left_corner_);
|
undo_object -> setOffset(offset_paste_count_ - 1, old_start_top_left_corner, offset_paste_count_, start_top_left_corner_);
|
||||||
scene_ -> undoStack().push(undo_object);
|
scene_ -> undoStack().push(undo_object);
|
||||||
}
|
}
|
||||||
return(content_pasted);
|
return(content_pasted);
|
||||||
|
|||||||
Reference in New Issue
Block a user