diff --git a/src/moodbar/moodbaritemdelegate.cpp b/src/moodbar/moodbaritemdelegate.cpp index 9f9c8e82a..1a67a46bc 100644 --- a/src/moodbar/moodbaritemdelegate.cpp +++ b/src/moodbar/moodbaritemdelegate.cpp @@ -51,6 +51,7 @@ MoodbarItemDelegate::MoodbarItemDelegate(Application *app, PlaylistView *view, Q : QItemDelegate(parent), app_(app), view_(view), + enabled_(false), style_(MoodbarRenderer::Style_Normal) { QObject::connect(app_, &Application::SettingsChanged, this, &MoodbarItemDelegate::ReloadSettings); @@ -62,9 +63,14 @@ void MoodbarItemDelegate::ReloadSettings() { QSettings s; s.beginGroup(MoodbarSettingsPage::kSettingsGroup); + enabled_ = s.value("enabled", false).toBool(); MoodbarRenderer::MoodbarStyle new_style = static_cast(s.value("style", MoodbarRenderer::Style_Normal).toInt()); s.endGroup(); + if (!enabled_) { + data_.clear(); + } + if (new_style != style_) { style_ = new_style; ReloadAllColors(); @@ -74,7 +80,11 @@ void MoodbarItemDelegate::ReloadSettings() { void MoodbarItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const { - QPixmap pixmap = const_cast(this)->PixmapForIndex(idx, option.rect.size()); + QPixmap pixmap; + + if (enabled_) { + pixmap = const_cast(this)->PixmapForIndex(idx, option.rect.size()); + } drawBackground(painter, option, idx); diff --git a/src/moodbar/moodbaritemdelegate.h b/src/moodbar/moodbaritemdelegate.h index 7125129be..f4e41c4e2 100644 --- a/src/moodbar/moodbaritemdelegate.h +++ b/src/moodbar/moodbaritemdelegate.h @@ -91,6 +91,7 @@ class MoodbarItemDelegate : public QItemDelegate { PlaylistView *view_; QCache data_; + bool enabled_; MoodbarRenderer::MoodbarStyle style_; };