mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
Refresh filter toolbar label icons on theme change
The Sort by and Filter by labels kept a one-shot pixmap snapshot, so they stayed at the previous palette until the toolbar was rebuilt. Re-render both snapshots when the palette or theme changes.
This commit is contained in:
parent
b7be57464d
commit
4d96bdcbcf
1 changed files with 9 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
#include "visual_database_display_filter_toolbar_widget.h"
|
#include "visual_database_display_filter_toolbar_widget.h"
|
||||||
|
|
||||||
#include "../../theme_icon.h"
|
#include "../../theme_icon.h"
|
||||||
|
#include "../../theme_manager.h"
|
||||||
#include "../deck_editor/card_database_view.h"
|
#include "../deck_editor/card_database_view.h"
|
||||||
#include "../quick_settings/settings_button_widget.h"
|
#include "../quick_settings/settings_button_widget.h"
|
||||||
#include "card_database_display_model.h"
|
#include "card_database_display_model.h"
|
||||||
|
|
@ -48,10 +49,15 @@ VisualDatabaseDisplayFilterToolbarWidget::VisualDatabaseDisplayFilterToolbarWidg
|
||||||
auto scalePixmap = [](const QString &prefix) { return loadThemedIcon(prefix).pixmap({20, 20}); };
|
auto scalePixmap = [](const QString &prefix) { return loadThemedIcon(prefix).pixmap({20, 20}); };
|
||||||
|
|
||||||
sortByLabel = new QLabel(this);
|
sortByLabel = new QLabel(this);
|
||||||
sortByLabel->setPixmap(scalePixmap("icons/sort_arrow_down"));
|
|
||||||
|
|
||||||
filterByLabel = new QLabel(this);
|
filterByLabel = new QLabel(this);
|
||||||
filterByLabel->setPixmap(scalePixmap("icons/filter"));
|
|
||||||
|
auto refreshStaticPixmaps = [this, scalePixmap] {
|
||||||
|
sortByLabel->setPixmap(scalePixmap("icons/sort_arrow_down"));
|
||||||
|
filterByLabel->setPixmap(scalePixmap("icons/filter"));
|
||||||
|
};
|
||||||
|
refreshStaticPixmaps();
|
||||||
|
connect(themeManager, &ThemeManager::paletteChanged, this, refreshStaticPixmaps);
|
||||||
|
connect(themeManager, &ThemeManager::themeChanged, this, refreshStaticPixmaps);
|
||||||
|
|
||||||
sortColumnCombo = new QComboBox(this);
|
sortColumnCombo = new QComboBox(this);
|
||||||
sortColumnCombo->setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy::AdjustToContents);
|
sortColumnCombo->setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy::AdjustToContents);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue