Wednesday, 15 August 2012

qt5 - QVariant::QVariant(Qt::GlobalColor)' is private -



qt5 - QVariant::QVariant(Qt::GlobalColor)' is private -

declaration in header file

qcolor dialogboja, dialogboja1;

.cpp file

dialogboja = postavke.value("boja", qt::black).tostring(); //postavke means settings dialogboja1 = postavke.value("boja1", qt::white).tostring();

as said on title, when seek compile in qt5 error: qvariant::qvariant(qt::globalcolor)' private

how solve this.

you need explicitly create qcolor object. should work:

dialogboja = postavke.value("boja", qcolor(qt::black)).tostring();

the reason explained in header:

// these constructors don't create qvariants of type associcated // enum, expected, create qvariant of // type int value of enum value. // utilize qvariant v = qcolor(qt::red) instead of qvariant v = qt::red // example.

qt qt5

No comments:

Post a Comment