Move PlaylistProxyStyle to it's own file

This commit is contained in:
Jonas Kvinge
2023-10-07 15:16:39 +02:00
parent 52ba1ce17f
commit 395d85c1b4
5 changed files with 128 additions and 65 deletions

View File

@@ -40,12 +40,9 @@
#include <QRect>
#include <QRegion>
#include <QStyleOption>
#include <QProxyStyle>
#include <QPoint>
#include <QBasicTimer>
#include <QCommonStyle>
#include "core/scoped_ptr.h"
#include "core/song.h"
#include "covermanager/albumcoverloaderresult.h"
#include "settings/appearancesettingspage.h"
@@ -72,27 +69,10 @@ class QTimerEvent;
class Application;
class CollectionBackend;
class PlaylistHeader;
class PlaylistProxyStyle;
class DynamicPlaylistControls;
class RatingItemDelegate;
// This proxy style works around a bug/feature introduced in Qt 4.7's QGtkStyle
// that uses Gtk to paint row backgrounds, ignoring any custom brush or palette the caller set in the QStyleOption.
// That breaks our currently playing track animation, which relies on the background painted by Qt to be transparent.
// This proxy style uses QCommonStyle to paint the affected elements.
// This class is used by internet search view as well.
class PlaylistProxyStyle : public QProxyStyle {
Q_OBJECT
public:
explicit PlaylistProxyStyle(const QString &style);
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const override;
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const override;
private:
ScopedPtr<QCommonStyle> common_style_;
};
class PlaylistView : public QTreeView {
Q_OBJECT