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;
...
}
class A {
public:
A();
...
private:
static QList<int> m_list;
static QMap<int,QString> m_map;
...
}
To copy to clipboard, switch view to plain text mode
and in the cpp file
A::A() { }
...
QList<int> A::m_list = QList<int>() << 1 << 2 << 4;
...
A::A() { }
...
QList<int> A::m_list = QList<int>() << 1 << 2 << 4;
...
To copy to clipboard, switch view to plain text mode
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
Bookmarks