^NyAw^
6th March 2013, 13:23
Hi,
I have a problem with this piece of code:
QMap<quint32,quint32> qMap;
qMap[0] = 1;
qMap[1] = 1;
qMap[2] = 1;
qMap[3] = 0;
qMap[4] = 0;
QFont qFontBold = ui.treeWidget->headerItem()->font(0);
qFontBold.setBold(true);
QStringList qText;
qText << "Hello";
QTreeWidgetItem *pqItem = new QTreeWidgetItem(ui.treeWidget,qText);
pqItem->setFont(1,qFontBold); //This line changes qMap[0] to 0
//Here, if I check the value of qMap[0] it contains 0 instead of 1
quint32 qValue = qMap.value(0);
Using the debugger I can see that when setting the font to the item in the treeWidget, the qMap changes the value on key 0.
Could anyone try this code if you get the same error. Or maybe I'm doing something wrong?
Using Qt 4.8.1, Visual Studio 2008 and Windows XP.
Thanks,
I have a problem with this piece of code:
QMap<quint32,quint32> qMap;
qMap[0] = 1;
qMap[1] = 1;
qMap[2] = 1;
qMap[3] = 0;
qMap[4] = 0;
QFont qFontBold = ui.treeWidget->headerItem()->font(0);
qFontBold.setBold(true);
QStringList qText;
qText << "Hello";
QTreeWidgetItem *pqItem = new QTreeWidgetItem(ui.treeWidget,qText);
pqItem->setFont(1,qFontBold); //This line changes qMap[0] to 0
//Here, if I check the value of qMap[0] it contains 0 instead of 1
quint32 qValue = qMap.value(0);
Using the debugger I can see that when setting the font to the item in the treeWidget, the qMap changes the value on key 0.
Could anyone try this code if you get the same error. Or maybe I'm doing something wrong?
Using Qt 4.8.1, Visual Studio 2008 and Windows XP.
Thanks,