Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

KisPaletteView: don't bypass the item model

Mathias Wein2f13d25c36af
diff --git a/libs/widgets/kis_palette_view.cpp b/libs/widgets/kis_palette_view.cpp
index f5167a3099..2353b8e5f4 100644
--- a/libs/widgets/kis_palette_view.cpp
+++ b/libs/widgets/kis_palette_view.cpp
@@ -216,8 +216,9 @@ void KisPaletteView::setPaletteModel(KisPaletteModel *model)
setModel(model);
slotAdditionalGuiUpdate();
- connect(model, SIGNAL(sigPaletteModified()), SLOT(slotAdditionalGuiUpdate()));
- connect(model, SIGNAL(sigPaletteChanged()), SLOT(slotAdditionalGuiUpdate()));
+ connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(slotAdditionalGuiUpdate()));
+ connect(model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), SLOT(slotAdditionalGuiUpdate()));
+ connect(model, SIGNAL(modelReset()), SLOT(slotAdditionalGuiUpdate()));
}
KisPaletteModel* KisPaletteView::paletteModel() const
@@ -257,6 +258,12 @@ void KisPaletteView::removeSelectedEntry()
void KisPaletteView::slotAdditionalGuiUpdate()
{
+ /*
+ * Note: QTableView (Qt 5.15) does not clear spans on model resets.
+ * But it does move spans on row inserts/removals, so incremental updates
+ * would be possible.
+ * Moving rows on the other hand does NOT update row spans accordingly...
+ */
if (!d->model->colorSet()) return;
clearSpans();