QAbstractItemModel::rowsMoved signal behavior
-
So I have a method from a class that inherits from QListWidget that is connected to QAbstractItemModel::rowsMoved signal.
void PlaylistPage::onRowsMoved(const QModelIndex &, int start, int end, const QModelIndex &, int row) { for(int i = start; i <= end; i++) { // some code } }
According to the doc:
This signal is emitted after rows have been moved within the model. The items between start and end inclusive, under the given parent item have been moved to destination starting at the row row.
I was expecting that once I moved the rows the method would be called only once but I came to find that when I am moving multiple rows the method will be called as many times as the number of the rows moved. In each call the value of
start
andend
are always the same.So I was wondering if I interpreted the doc right. Are the values of
end
andstart
always the same in each call? -
What Qt version do you use? How do you move the rows?
-
@Christian-Ehrlicher Qt 5.15.2
-
How do you move the rows?
-
@Christian-Ehrlicher Drag and drop
-
The default dnd implementation moves every row by it's own.
-
@Christian-Ehrlicher So are the values of
end
andstart
always the same in each call? -
When every row is moved by it's own then start and end must be the same since... only one row is moved.
-
@Christian-Ehrlicher Ok Thank you for the clarification