Merge pull request #3685 from Soerboe/224121_crash_when_clearing_palette_when_filtered

fix #224121: Crash when clearing palette cell with filter active
This commit is contained in:
Anatoly 2018-05-21 11:16:55 +02:00 committed by GitHub
commit fa17f01af0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View file

@ -52,6 +52,8 @@ void PaletteBoxButton::contextMenuEvent(QContextMenuEvent* event)
QAction* actionEdit = menu.addAction(tr("Enable Editing"));
actionEdit->setCheckable(true);
actionEdit->setChecked(!palette->readOnly());
if (palette->isFilterActive())
actionEdit->setVisible(false);
bool _systemPalette = palette->systemPalette();
actionProperties->setDisabled(_systemPalette);

View file

@ -52,10 +52,10 @@ class PaletteBoxButton : public QToolButton {
void upTriggered() { emit paletteCmd(PaletteCommand::UP, id); }
void downTriggered() { emit paletteCmd(PaletteCommand::DOWN, id); }
void newTriggered() { emit paletteCmd(PaletteCommand::NEW, id); }
void enableEditing(bool);
public slots:
void showPalette(bool);
void enableEditing(bool);
signals:
void paletteCmd(PaletteCommand, int);

View file

@ -119,13 +119,13 @@ void PaletteBox::filterPalettes(const QString& text)
bool f = p->filter(text);
b->setVisible(!f);
if (b->isVisible()) {
if (text.isEmpty())
b->showPalette(false);
else
b->showPalette(true);
b->showPalette(!text.isEmpty());
}
else
b->showPalette(false);
// disable editing while palette is filtered
b->enableEditing(text.isEmpty());
}
}