ChrisW67
10th February 2010, 08:22
Hi All,
I'm hoping this is not too obvious a question. A static QList can be initialised outside of any method:
class A {
public:
A();
...
private:
static QList<int> m_list;
static QMap<int,QString> m_map;
...
}
and in the cpp file
A::A() { }
...
QList<int> A::m_list = QList<int>() << 1 << 2 << 4;
...
but I cannot see a similar way to initialise the QMap. Can it be done or is it a job for the constructor?
Regards,
Chris W
I'm hoping this is not too obvious a question. A static QList can be initialised outside of any method:
class A {
public:
A();
...
private:
static QList<int> m_list;
static QMap<int,QString> m_map;
...
}
and in the cpp file
A::A() { }
...
QList<int> A::m_list = QList<int>() << 1 << 2 << 4;
...
but I cannot see a similar way to initialise the QMap. Can it be done or is it a job for the constructor?
Regards,
Chris W