Hi there! Could someone please explain me some odd behavior of Qt 5.7 models and the corresponding selection models?
Please start the "Editable Tree Model" example. Remove all rows except two. Select the first row. Then set a breakpoint to the following line of function MainWindow::updateActions() in file mainwindow.cpp: int row = view->selectionModel()->currentIndex().row(); Then remove the first row. When I do this, I can see that the MainWindow::updateActions() function is called two times. The first time it is called by the signal/slot connection from the selectionChanged signal; the second time it is called from MainWindow::removeColumn() by the application. The problem: In the first call, the new selected row is 1. This is fatal because after removing the first of two rows there is no row with index 1 anymore. The second call to MainWindow::updateActions(), done by the application, fixes that problem but I wonder why it is necessary. In my application I have the same behavior except that I totally rely on the seletionChanged() signal... which is why my application crashes. Is that actually desired behavior? -- Best Regards Bernhard Lindner
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest