Skip to content

Commit

Permalink
Make preset navigation shortcuts work detached
Browse files Browse the repository at this point in the history
They didn't actually change the current preset when detached, making
them pretty useless. Now they do that properly.
askmeaboutlo0m committed Jan 22, 2025
1 parent f869588 commit 80d8b43
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -65,6 +65,7 @@ Unreleased Version 2.2.2-pre
* Feature: Remember background color as well when using per-slot colors.
* Fix: Scroll to the brush in question when creating or overwriting one.
* Feature: Allow editing brush names, descriptions and thumbnails when using detached slots.
* Fix: Make next/previous brush and tag shortcuts work when using detached slots.

2024-11-06 Version 2.2.2-beta.4
* Fix: Solve rendering glitches with selection outlines that happen on some systems. Thanks xxxx for reporting.
9 changes: 8 additions & 1 deletion src/desktop/docks/brushpalettedock.cpp
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
#include <QListView>
#include <QMenu>
#include <QMessageBox>
#include <QScopedValueRollback>
#include <QSortFilterProxyModel>
#include <QTemporaryFile>
#include <QTextBrowser>
@@ -94,6 +95,7 @@ struct BrushPalette::Private {

int selectedPresetId = 0;
int lastSelectedPresetId = 0;
bool navigationInProgress = false;
};

BrushPalette::BrushPalette(QWidget *parent)
@@ -527,6 +529,7 @@ void BrushPalette::exportBrushes()

void BrushPalette::selectNextPreset()
{
QScopedValueRollback<bool> rollback(d->navigationInProgress, true);
int rowCount = d->presetProxyModel->rowCount();
if(rowCount > 0) {
QModelIndex currentIdx = d->presetListView->currentIndex();
@@ -542,6 +545,7 @@ void BrushPalette::selectNextPreset()

void BrushPalette::selectPreviousPreset()
{
QScopedValueRollback<bool> rollback(d->navigationInProgress, true);
int rowCount = d->presetProxyModel->rowCount();
if(rowCount > 0) {
QModelIndex currentIdx = d->presetListView->currentIndex();
@@ -557,6 +561,7 @@ void BrushPalette::selectPreviousPreset()

void BrushPalette::selectNextTag()
{
QScopedValueRollback<bool> rollback(d->navigationInProgress, true);
int index = d->tagComboBox->currentIndex() + 1;
if(index < d->tagComboBox->count()) {
d->tagComboBox->setCurrentIndex(index);
@@ -567,6 +572,7 @@ void BrushPalette::selectNextTag()

void BrushPalette::selectPreviousTag()
{
QScopedValueRollback<bool> rollback(d->navigationInProgress, true);
int index = d->tagComboBox->currentIndex() - 1;
if(index >= 0) {
d->tagComboBox->setCurrentIndex(index);
@@ -658,7 +664,8 @@ void BrushPalette::presetCurrentIndexChanged(
if(selected) {
d->selectedPresetId = presetId;
d->lastSelectedPresetId = presetId;
if(d->brushSettings && d->brushSettings->brushPresetsAttach()) {
if(d->brushSettings && (d->navigationInProgress ||
d->brushSettings->brushPresetsAttach())) {
applyToBrushSettings(current);
}
}

0 comments on commit 80d8b43

Please sign in to comment.