r23254 by jghali - Add function to Selection class for adding multiple items at once
scribus-commit
scribus-commit at lists.scribus.net
Thu Oct 10 12:20:57 UTC 2019
Author: jghali
Date: Thu Oct 10 12:20:57 2019
New Revision: 23254
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23254
Log:
Add function to Selection class for adding multiple items at once
Modified:
trunk/Scribus/scribus/selection.cpp
trunk/Scribus/scribus/selection.h
Modified: trunk/Scribus/scribus/selection.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23254&path=/trunk/Scribus/scribus/selection.cpp
==============================================================================
--- trunk/Scribus/scribus/selection.cpp (original)
+++ trunk/Scribus/scribus/selection.cpp Thu Oct 10 12:20:57 2019
@@ -210,6 +210,35 @@
return false;
}
+bool Selection::addItems(const QList<PageItem *> items)
+{
+ if (items.isEmpty())
+ return false;
+
+ QList< QPointer<PageItem> > toAdd;
+ toAdd.reserve(items.count());
+ for (int i = 0; i < items.count(); ++i)
+ {
+ PageItem* item = items.at(i);
+ if (m_SelList.contains(item))
+ continue;
+ toAdd.append(item);
+ item->setSelected(true);
+ }
+
+ if (toAdd.count() <= 0)
+ return false;
+
+ m_SelList.append(toAdd);
+ if (m_isGUISelection)
+ {
+ m_sigSelectionChanged = true;
+ m_sigSelectionIsMultiple = true;
+ }
+ sendSignals();
+ return true;
+}
+
bool Selection::prependItem(PageItem *item, bool /*doEmit*/)
{
if (item == nullptr)
Modified: trunk/Scribus/scribus/selection.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23254&path=/trunk/Scribus/scribus/selection.h
==============================================================================
--- trunk/Scribus/scribus/selection.h (original)
+++ trunk/Scribus/scribus/selection.h Thu Oct 10 12:20:57 2019
@@ -78,6 +78,13 @@
* @return If the item was added
*/
bool addItem(PageItem *item, bool ignoreGUI=false);
+ /**
+ * @brief Add items to the selection.
+ * If its added to a GUI selection selection and its item 0, its connected to the GUI too
+ * @param item Item to add
+ * @return If any item was added
+ */
+ bool addItems(QList<PageItem *> items);
/**
* @brief Prepend an item to the selection.
* If its added to a GUI selection selection and its item 0, its connected to the GUI too
More information about the scribus-commit
mailing list