Am Montag, den 13.05.2019, 20:08 +0200 schrieb Jürgen Spitzmüller: > I can reproduce the assert with Qt 4.8.7 as well. Interestingly, the > bad role here is 31. There is no such role in the enum, but 31 is > UserRole (32 in Qt4) minus one, whereas the bad role in Qt5 for you > is > also UserRole minus one (UserRole is 256 in Qt5).
Further debugging revealed that the critical role is added when item->setEditable(false) is set (GuiDocument.cpp:4772). I have inspected the qt4 code, but it didn't occur to me where this happens. The only idea to solve this, besides leaving the items in editable mode (which is not nice) would be the attached workaround. Kornel, does this work for you as well with Qt 5.5? Jürgen
diff --git a/src/frontends/qt4/GuiIdListModel.cpp b/src/frontends/qt4/GuiIdListModel.cpp index b1db347327..d38a087f7c 100644 --- a/src/frontends/qt4/GuiIdListModel.cpp +++ b/src/frontends/qt4/GuiIdListModel.cpp @@ -66,6 +66,10 @@ bool GuiIdListModel::setData(QModelIndex const & index, if (role == Qt::DecorationRole) // nothing to do return true; + if (role == Qt::UserRole - 1) + // This role is set by Qt <= 5.5 if setEditable() + // of the item is false + return true; // If we assert here, it's because we're trying to set an // unrecognized role. LATTEST(false);
signature.asc
Description: This is a digitally signed message part