They are different pointers but they are pointing to the same item. So, yeah they got same value.
But even I do:
RootWidget->setData(0, Qt::UserRole + 1, Headerqv);
QVariant StrValue
= RootWidget
->data
(0, Qt
::UserRole + 1);
QString strval
= StrValue.
toString();
string str = strval.toStdString();
RootWidget->setData(0, Qt::UserRole + 1, Headerqv);
QVariant StrValue = RootWidget->data(0, Qt::UserRole + 1);
QString strval = StrValue.toString();
string str = strval.toStdString();
To copy to clipboard, switch view to plain text mode
To check the value right after setting the data, str value is still NULL , mean an empty string"" .
Not sure why.
Thanks,
Bookmarks