Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.5.0
-
None
-
-
a5a6b657a (dev), bcc581761 (6.7), d09dd5b94 (6.6), 8e786bc60 (tqtc/lts-6.5)
Description
OS : Windows 11
RubberBand update area is too small in QListView.
- selectionMode ExtendedSelection
- selectAreaVisible = true
- wrapping = ture
- dragDDropMode = DragOnly
procedure
- start Drag selection.
- expand rubberBand. direct Up or Left
- contract rubberBand.
-> remained garbage of rubberBand.
This problem could be attributed to the fact that it does not take into account pen widths greater than 2px. When drawing a rectangle, a pen size of 1px or larger will draw an area larger than the specified QRect size, but this is not taken into account.
This problem seems to exist in the rendering of other floating items such as drag and drop.
ex. solution
Using QRubberBand are convenient.
mousePressEvent()
pressedPos = pos + QPoint(horizontalOffset(), verticalOffset());
rubberBand->setGeometry(QRect::span(pos, m_pressedPos).normalized());
rubberBand->show();
mouseMoveEvent()
repaint(mp_rubberBand->normalGeometry());
QPoint pos = event->position().toPoint();
QPoint startPos = pressedPos - QPoint(horizontalOffset(), verticalOffset());
rubberBand->setGeometry(QRect::span(startPos,pos).normalized());
mouseReleaseEvent
rubberBand->hide();