Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-113432

RubberBand update area is too small in QListView

    XMLWordPrintable

Details

    • Windows
    • 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

      1. start Drag selection.
      2. expand rubberBand. direct Up or Left
      3. 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();

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            takashi_kuwabara Takashi Kuwabara
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes