You cannot initialize an object with <<. =, which is usually absent, operator=()is a special syntax that essentially matches a constructor call.
Something like this might work
QList<int> Cube::colorList = EmptyList() << YELLOW << RED << GREEN << ORANGE << BLUE << WHITE;
where EmptyList () is
QList<int> EmptyList()
{
QList<int> list;
return list;
}
and is a copy of the list structure and the prohibition of some optimization - a copy of the created list.
source
share