mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +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() {
|
||||
// delegue cette action a la scene
|
||||
scene_ -> cut();
|
||||
offset_paste_count_ = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -273,21 +274,29 @@ ElementContent ElementView::pasteWithOffset(const QDomDocument &xml_document) {
|
||||
if (pasted_content_bounding_rect.isEmpty()) return(content_pasted);
|
||||
|
||||
// copier/coller avec decalage
|
||||
QRectF final_pasted_content_bounding_rect;
|
||||
++ offset_paste_count_;
|
||||
if (offset_paste_count_ == 1) {
|
||||
if (!offset_paste_count_) {
|
||||
// the pasted content was cut
|
||||
start_top_left_corner_ = pasted_content_bounding_rect.topLeft();
|
||||
} else {
|
||||
pasted_content_bounding_rect.moveTopLeft(start_top_left_corner_);
|
||||
final_pasted_content_bounding_rect = pasted_content_bounding_rect;
|
||||
}
|
||||
|
||||
// on applique le decalage qui convient
|
||||
QRectF final_pasted_content_bounding_rect = applyMovement(
|
||||
pasted_content_bounding_rect,
|
||||
QETElementEditor::pasteMovement(),
|
||||
QETElementEditor::pasteOffset()
|
||||
);
|
||||
|
||||
QPointF old_start_top_left_corner_ = start_top_left_corner_;
|
||||
else {
|
||||
// the pasted content was copied
|
||||
if (offset_paste_count_ == 1) {
|
||||
start_top_left_corner_ = pasted_content_bounding_rect.topLeft();
|
||||
} else {
|
||||
pasted_content_bounding_rect.moveTopLeft(start_top_left_corner_);
|
||||
}
|
||||
|
||||
// on applique le decalage qui convient
|
||||
final_pasted_content_bounding_rect = applyMovement(
|
||||
pasted_content_bounding_rect,
|
||||
QETElementEditor::pasteMovement(),
|
||||
QETElementEditor::pasteOffset()
|
||||
);
|
||||
}
|
||||
QPointF old_start_top_left_corner = start_top_left_corner_;
|
||||
start_top_left_corner_ = final_pasted_content_bounding_rect.topLeft();
|
||||
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()) {
|
||||
scene_ -> clearSelection();
|
||||
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);
|
||||
}
|
||||
return(content_pasted);
|
||||
|
||||
Reference in New Issue
Block a user