I am trying to use static fields in QT
class MyLabel:public QLabel{
Q_OBJECT
public:
static QPixmap pix1;
static QPixmap *pix2;
static int WasInited;
...
};
int MyLabel::WasInited = 0;
MyLabel::MyLabel(){
. . .
if (WasInited==0) pix1.load("pic.png"); // Error
if (WasInited==0) pix2->load("pic.png"); // Error
WasInited=1; // Here using static field is OK
}
But i always get "undefined reference to MyLabel::pix*' " error
How do i declare and use static fields of standart QT classes?
P.S. I have no problems using int static fields, so i think my question is QT specific