[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [krita/petrovic/impex-brush-editor-ui] libs/ui/widgets: add an All option that clears the engine fil
From:       Scott Petrovic <scottpetrovic () gmail ! com>
Date:       2016-12-01 0:05:56
Message-ID: E1cCEsu-0007ME-8v () code ! kde ! org
[Download RAW message or body]

Git commit 9717d18947b87caf8e67549f3f18bcd5390cf060 by Scott Petrovic.
Committed on 01/12/2016 at 00:05.
Pushed by scottpetrovic into branch 'petrovic/impex-brush-editor-ui'.

add an All option that clears the engine filter to show all presets

M  +12   -3    libs/ui/widgets/kis_paintop_presets_popup.cpp

https://commits.kde.org/krita/9717d18947b87caf8e67549f3f18bcd5390cf060

diff --git a/libs/ui/widgets/kis_paintop_presets_popup.cpp \
b/libs/ui/widgets/kis_paintop_presets_popup.cpp index afe2e0e..7438a4a 100644
--- a/libs/ui/widgets/kis_paintop_presets_popup.cpp
+++ b/libs/ui/widgets/kis_paintop_presets_popup.cpp
@@ -469,7 +469,10 @@ void KisPaintOpPresetsPopup::setPaintOpList(const QList< \
KisPaintOpFactory* >& l  
         qStableSort(sortedList.begin(), sortedList.end(), variantLessThan );
 
-        // TODO: Add an "All" option that shows all brush presets.
+        // add an "All" option at the front to show all presets
+        QPixmap emptyPixmap = QPixmap(22,22);
+        emptyPixmap.fill(palette().color(QPalette::Background));
+        sortedList.push_front(KisPaintOpInfo(QString("all_options"), i18n("All"), \
QString(""), emptyPixmap, 0 ));  
         // fill the list into the brush combo box
         for (int m = 0; m < sortedList.length(); m++) {
@@ -493,7 +496,14 @@ void KisPaintOpPresetsPopup::setCurrentPaintOp(const QString& \
paintOpId)  }
     }
 
-    m_d->uiWdgPaintOpPresetSettings.presetWidget->setPresetFilter(paintOpId);
+    // if the "all" option is set, set the filter to "", that way it clears the \
filter and shows everything +    QString paintOpFilter = paintOpId;
+    if (paintOpFilter == "all_options") {
+        paintOpFilter = "";
+    }
+
+    m_d->uiWdgPaintOpPresetSettings.presetWidget->setPresetFilter(paintOpFilter);
+
 }
 
 QString KisPaintOpPresetsPopup::currentPaintOp()
@@ -564,7 +574,6 @@ void KisPaintOpPresetsPopup::slotPaintOpChanged(int index) {
     QVariant userData = \
m_d->uiWdgPaintOpPresetSettings.brushEgineComboBox->currentData(); // grab paintOpID \
from data  QString currentPaintOpId = userData.toString();
 
-    m_d->uiWdgPaintOpPresetSettings.presetWidget->setPresetFilter(currentPaintOpId);
     setCurrentPaintOp(currentPaintOpId);
     emit paintopActivated(currentPaintOpId); // tell the toolbar to change the \
active icon  }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic