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

QHeaderView does not properly drop long sections

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 4.7.0
    • 4.6.0
    • Widgets: Itemviews
    • 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.

      Attachments

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

        Activity

          People

            dedietri Gabriel de Dietrich (drgvond)
            sloring Scott Loring
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes