OSDN Git Service

kdeplasma-addons: change the native widget icon regardless if the color is in the...
authorIvailo Monev <xakepa10@gmail.com>
Mon, 12 Jun 2023 08:30:31 +0000 (11:30 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Mon, 12 Jun 2023 08:30:31 +0000 (11:30 +0300)
when picking the same color twice (or more) the icon was not changing to
the currently picked color (as if no pixel was grabbed)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
kdeplasma-addons/applets/kolourpicker/kolourpicker.cpp

index 481cb93..c5a7456 100644 (file)
@@ -389,19 +389,19 @@ void Kolourpicker::installFilter()
 
 void Kolourpicker::addColor(const QColor &color, bool save)
 {
+    ColorIcon colorIcon(color);
+    m_configAndHistory->nativeWidget()->setIcon(colorIcon);
+
     QHash<QColor, QAction *>::ConstIterator it = m_menus.constFind(color);
     if (it != m_menus.constEnd()) {
         return;
     }
-
     KMenu *newmenu = buildMenuForColor(color);
     QAction *act = newmenu->menuAction();
-    ColorIcon colorIcon(color);
     act->setIcon(colorIcon);
     act->setText(QString("%1, %2, %3").arg(color.red()).arg(color.green()).arg(color.blue()));
     connect(newmenu, SIGNAL(triggered(QAction*)), this, SLOT(colorActionTriggered(QAction*)));
     m_configAndHistoryMenu->insertMenu(m_configAndHistoryMenu->actions().at(1), newmenu);
-    m_configAndHistory->nativeWidget()->setIcon(colorIcon);
     m_menus.insert(color, act);
     m_colors.append(color.name());
     m_configAndHistory->setEnabled(true);