Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.3.0, 5.3.1
-
None
-
Windows, MinGW, gcc 4.9.0, Qt 5.3.1
-
Fix reading: 088e9bbb4bb1a0368010692c8c55425c880858e7 (dev, 6.8.2014, 5.4) e0a8b5ce88bc50440dcec2fe3a86d83e2a7dc7b0
Description
We recently migrated to Qt5 (5.3.0 then 5.3.1).
Since then, we regularly have a problem we calling header()->restoreState() in our widgets.
It seems that it sometimes saved a "corrupted" state and when we try to restore it, nothing in the tree can be selected (item cannot be selected) and the context menu of the header isn't displayed when right clicking on it.
Worth to note that restoreState returns true, so we can't rely on this to know if it's broken.
I tried to manually ui->treeWidget->setEnabled(true); and few other things but that didn't help.
We save the current state like this:
QSettings settings(QString("C:/SomePath/Settings/Pref.ini"), QSettings::IniFormat); settings.setValue("prefName", ui->treeWidget->header()->saveState());
And restore it like this:
ui->treeWidget->header()->restoreState(settings.value("prefName").toByteArray());
The pref saved in the ini file:
"@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\x1\0\0\0\f\x1\0\0\0\0\0\0\0\0\0\0\0\xf\x4\x41\0\0\0\x3\0\0\0\xe\0\0\0\x64\0\0\0\b\0\0\x2X\0\0\0\x2\0\0\0\x64\xff\xff\xff\x3\0\0\0\xf\x1\x1\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\xf\0\0\0\xde\0\0\0\x1\0\0\0\0\0\0\0P\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0P\0\0\0\x1\0\0\0\0\0\0\0\xc8\0\0\0\x1\0\0\0\0\0\0\0\x9c\0\0\0\x1\0\0\0\0\0\0\0g\0\0\0\x1\0\0\0\0\0\0\0P\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\x2X\0\0\0\x1\0\0\0\0\0\0\x2X\0\0\0\x1\0\0\0\0\0\0\0\x64\0\0\0\x1\0\0\0\0\0\0\0\x61\0\0\0\x1\0\0\0\0\0\0\x3=\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\x3\xe8)"
I created a small GUI project with nothing but a treeWidget, and restoring with this value reproduces the error (i.e. items cannot be selected, even if restoreState returns true)
We didn't have this problem with Qt 4.8
Attachments
Issue Links
- relates to
-
QTBUG-19092 QHeaderView is very slow (unless it is used with only few data)
- Closed