Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.6.0
-
None
-
This occurs on all platforms, but Linux was used for primary development.
-
51a98a583b33585a4dcf918cd8567978bf7c20ae
Description
Steps to reproduce / test case
1. Open the Directory View example program
2. Resize the "Size" section to be almost the full window width
3. Position the mouse over the "S" in "Size"
4. Attempt to drag the section left to be before "Name"
One would expect the section to be placed before
"Name". However, this does not work because the center of
the "Size" section never gets far enough to the left to
allow the drop to occur.
This behavior is specific to the left edge of the
window. Similar movements on the right edge result in the
expected behavior.
This asymmetry makes it difficult or impossible to implement
alternative dragging behavior in a subclass.
The code which causes this behavior is here:
=== qheaderview.cpp ===
void QHeaderView::mouseMoveEvent(QMouseEvent *e)
{
Q_D(QHeaderView);
int pos = d->orientation == Qt::Horizontal ? e->x() : e->y();
if (pos < 0)
return;
===
The function returns if the mouse position is less than 0,
limiting the leftward movement of the mouse. There may be
other reasons within this function that the condition
exists. However, since it introduces this bug, it might be
better to allow negative mouse positions and guard against
the negative values elsewhere in the code.