diff --git a/include/InstrumentTrackView.h b/include/InstrumentTrackView.h index c7d524b36cf..cfde89bde82 100644 --- a/include/InstrumentTrackView.h +++ b/include/InstrumentTrackView.h @@ -71,6 +71,8 @@ class InstrumentTrackView : public TrackView // Create a menu for assigning/creating channels for this track QMenu * createMixerMenu( QString title, QString newMixerLabel ) override; + QPixmap determinePixmap(); + protected: void modelChanged() override; diff --git a/include/TrackLabelButton.h b/include/TrackLabelButton.h index e19fc6be9bc..1d3620d12f9 100644 --- a/include/TrackLabelButton.h +++ b/include/TrackLabelButton.h @@ -55,6 +55,7 @@ public slots: void mousePressEvent( QMouseEvent * _me ) override; void mouseDoubleClickEvent( QMouseEvent * _me ) override; void mouseReleaseEvent( QMouseEvent * _me ) override; + void paintEvent(QPaintEvent* pe) override; void resizeEvent( QResizeEvent * _re ) override; private: diff --git a/src/gui/tracks/InstrumentTrackView.cpp b/src/gui/tracks/InstrumentTrackView.cpp index 788991ed0f8..c812999fd62 100644 --- a/src/gui/tracks/InstrumentTrackView.cpp +++ b/src/gui/tracks/InstrumentTrackView.cpp @@ -397,6 +397,11 @@ QMenu * InstrumentTrackView::createMixerMenu(QString title, QString newMixerLabe return mixerMenu; } +QPixmap InstrumentTrackView::determinePixmap() +{ + return determinePixmap(dynamic_cast(getTrack())); +} + QPixmap InstrumentTrackView::determinePixmap(InstrumentTrack* instrumentTrack) { diff --git a/src/gui/tracks/TrackLabelButton.cpp b/src/gui/tracks/TrackLabelButton.cpp index 087edba3d74..c164b780e75 100644 --- a/src/gui/tracks/TrackLabelButton.cpp +++ b/src/gui/tracks/TrackLabelButton.cpp @@ -30,6 +30,7 @@ #include "ConfigManager.h" #include "embed.h" +#include "InstrumentTrackView.h" #include "RenameDialog.h" #include "TrackRenameLineEdit.h" #include "TrackView.h" @@ -178,6 +179,16 @@ void TrackLabelButton::mouseReleaseEvent( QMouseEvent *_me ) } +void TrackLabelButton::paintEvent(QPaintEvent* pe) +{ + InstrumentTrackView* instrumentTrackView = dynamic_cast(m_trackView); + if (instrumentTrackView) + { + setIcon(instrumentTrackView->determinePixmap()); + } + + QToolButton::paintEvent(pe); +} void TrackLabelButton::resizeEvent(QResizeEvent *_re)