Yes, there's a reported bug in Qt as QAbstractItemViewPrivate:ressedPosition is not updated after the drag and drop is performed (and in few other cases like using clearSelection()).
This results in all selection being done based on wrong mouse position.
You can fairly easily walk around the bug like that:
...
connect( this->list->model(), SIGNAL( layoutChanged() ), this, SLOT( correctSelection() ) );
...
void MainWindow::correctSelection( void )
{
this->list->setCurrentIndex( this->list->currentIndex() );
}
...
connect( this->list->model(), SIGNAL( layoutChanged() ), this, SLOT( correctSelection() ) );
...
void MainWindow::correctSelection( void )
{
QItemSelection s = this->list->selectionModel()->selection();
this->list->setCurrentIndex( this->list->currentIndex() );
this->list->selectionModel()->select( s, QItemSelectionModel::SelectCurrent );
}
To copy to clipboard, switch view to plain text mode
I don't think it can be done any better without altering qt source code.
Bookmarks