diff options
Diffstat (limited to 'src/widgets/itemviews/qheaderview.cpp')
-rw-r--r-- | src/widgets/itemviews/qheaderview.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 541d40d421..fa774b5074 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -2268,7 +2268,12 @@ void QHeaderView::mousePressEvent(QMouseEvent *e) d->pressed = logicalIndexAt(pos); if (d->clickableSections) emit sectionPressed(d->pressed); - if (d->movableSections) { + + bool acceptMoveSection = d->movableSections; + if (acceptMoveSection && d->pressed == 0 && !d->allowUserMoveOfSection0) + acceptMoveSection = false; // Do not allow moving the tree nod + + if (acceptMoveSection) { d->section = d->target = d->pressed; if (d->section == -1) return; @@ -2332,6 +2337,9 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e) int visual = visualIndexAt(pos); if (visual == -1) return; + if (visual == 0 && logicalIndex(0) == 0 && !d->allowUserMoveOfSection0) + return; + int posThreshold = d->headerSectionPosition(visual) - d->offset + d->headerSectionSize(visual) / 2; int moving = visualIndex(d->section); if (visual < moving) { |