@@ -45,12 +45,20 @@ class AlbumArtQt : public GeneralPlugin {
45
45
46
46
class ArtLabel : public QLabel {
47
47
public:
48
- ArtLabel (QWidget * parent = 0 , Qt::WindowFlags f = 0 ) : QLabel(parent, f)
48
+ #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
49
+ ArtLabel (QWidget * parent = nullptr , Qt::WindowFlags f = Qt::WindowFlags()) : QLabel (parent, f)
50
+ #else
51
+ ArtLabel (QWidget * parent = nullptr , Qt::WindowFlags f = 0 ) : QLabel (parent, f)
52
+ #endif
49
53
{
50
54
init ();
51
55
}
52
56
53
- ArtLabel (const QString & text, QWidget * parent = 0 , Qt::WindowFlags f = 0 ) : QLabel (text, parent, f)
57
+ #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
58
+ ArtLabel (const QString & text, QWidget * parent = nullptr , Qt::WindowFlags f = Qt::WindowFlags()) : QLabel (text, parent, f)
59
+ #else
60
+ ArtLabel (const QString & text, QWidget * parent = nullptr , Qt::WindowFlags f = 0 ) : QLabel (text, parent, f)
61
+ #endif
54
62
{
55
63
init ();
56
64
}
@@ -74,14 +82,24 @@ class ArtLabel : public QLabel {
74
82
virtual void resizeEvent (QResizeEvent * event)
75
83
{
76
84
QLabel::resizeEvent (event);
77
- const QPixmap * pm = pixmap ();
78
85
79
- if ( ! origPixmap.isNull () && pm && ! pm->isNull () &&
86
+ #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
87
+ QPixmap pm = pixmap (Qt::ReturnByValue);
88
+ if (! origPixmap.isNull () && ! pm.isNull () &&
89
+ (size ().width () <= origSize.width () + MARGIN ||
90
+ size ().height () <= origSize.height () + MARGIN ||
91
+ pm.size ().width () != origSize.width () ||
92
+ pm.size ().height () != origSize.height ()))
93
+ drawArt ();
94
+ #else
95
+ const QPixmap * pm = pixmap ();
96
+ if (! origPixmap.isNull () && pm && ! pm->isNull () &&
80
97
(size ().width () <= origSize.width () + MARGIN ||
81
98
size ().height () <= origSize.height () + MARGIN ||
82
99
pm->size ().width () != origSize.width () ||
83
100
pm->size ().height () != origSize.height ()))
84
101
drawArt ();
102
+ #endif
85
103
}
86
104
87
105
private:
@@ -126,7 +144,7 @@ class ArtLabel : public QLabel {
126
144
}
127
145
128
146
#ifdef Q_OS_MAC
129
- repaint ();
147
+ repaint ();
130
148
#endif
131
149
}
132
150
};
0 commit comments