r22922 by jghali - #15612: Pasting several objects changes z-index
scribus-commit
scribus-commit at lists.scribus.net
Sat Mar 30 03:08:14 UTC 2019
Author: jghali
Date: Sat Mar 30 03:08:14 2019
New Revision: 22922
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22922
Log:
#15612: Pasting several objects changes z-index
Modified:
trunk/Scribus/scribus/scribus.cpp
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22922&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sat Mar 30 03:08:14 2019
@@ -4688,21 +4688,28 @@
{
if ((currItem->isSingleSel) && (currItem->isGroup()))
return;
- //do not copy notes frames
- if (doc->m_Selection->count() ==1 && currItem->isNoteFrame())
+
+ // Do not copy notes frames
+ if ((doc->m_Selection->count() == 1) && currItem->isNoteFrame())
return;
- //deselect notesframes
- Selection tempSelection(*(doc->m_Selection));
+
+ // Sort items in Z-order
+ QList<PageItem*> selectedItems = doc->m_Selection->items();
+ qStableSort(selectedItems.begin(), selectedItems.end(), compareItemLevel);
+
+ Selection tempSelection(this, false);
+ for (int i = 0; i < selectedItems.count(); ++i)
+ tempSelection.addItem(selectedItems.at(i));
+
+ // Deselect notesframes
for (int i = 0; i < doc->m_Selection->count(); ++i)
{
if (doc->m_Selection->itemAt(i)->isNoteFrame())
tempSelection.removeItem(doc->m_Selection->itemAt(i));
}
- if (tempSelection.count() < doc->m_Selection->count())
- *(doc->m_Selection) = tempSelection;
ScriXmlDoc ss;
- QString BufferS = ss.writeElem(doc, doc->m_Selection);
+ QString BufferS = ss.writeElem(doc, &tempSelection);
if (!internalCopy)
{
if ((m_prefsManager->appPrefs.scrapbookPrefs.doCopyToScrapbook) && (!internalCopy))
More information about the scribus-commit
mailing list