diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2020-12-23 22:21:08 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2021-01-29 06:26:55 +0000 |
commit | 180c662b0790c6eceffdcb4661681d7df1541a2d (patch) | |
tree | ef449dbbca65a8382d1281a801960f767aa0a27b /src/widgets/styles | |
parent | 693aa08ddf6afc236ecd1844690158f02ba46dd4 (diff) |
QHeaderView: Mark the drop section during section move
Currently there is no visual feedback where the section move will end
up. Therefore mark the drop section to show where the dragged section
will be inserted.
Fixes: QTBUG-673
Fixes: QTBUG-1114
Change-Id: I3e45a9a9c0604342bb0286fc7cd4c89c757c28cd
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qfusionstyle.cpp | 8 | ||||
-rw-r--r-- | src/widgets/styles/qstyleoption.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qstyleoption.h | 3 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index b8044dbc09..d2eb5e25cc 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1283,6 +1283,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio QString pixmapName = QStyleHelper::uniqueName(QLatin1String("headersection"), option, option->rect.size()); pixmapName += QString::number(- int(header->position)); pixmapName += QString::number(- int(header->orientation)); + pixmapName += QString::number(- int(header->isSectionDragTarget)); QPixmap cache; if (!QPixmapCache::find(pixmapName, &cache)) { @@ -1291,9 +1292,12 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio QRect pixmapRect(0, 0, rect.width(), rect.height()); QPainter cachePainter(&cache); QColor buttonColor = d->buttonColor(option->palette); - QColor gradientStopColor; QColor gradientStartColor = buttonColor.lighter(104); - gradientStopColor = buttonColor.darker(102); + QColor gradientStopColor = buttonColor.darker(102); + if (header->isSectionDragTarget) { + gradientStopColor = gradientStartColor.darker(130); + gradientStartColor = gradientStartColor.darker(130); + } QLinearGradient gradient(pixmapRect.topLeft(), pixmapRect.bottomLeft()); if (option->palette.window().gradient()) { diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index 6e994dc8dc..933603dd7e 100644 --- a/src/widgets/styles/qstyleoption.cpp +++ b/src/widgets/styles/qstyleoption.cpp @@ -748,7 +748,7 @@ QStyleOptionHeader::QStyleOptionHeader(int version) section(0), textAlignment(Qt::AlignLeft), iconAlignment(Qt::AlignLeft), position(QStyleOptionHeader::Beginning), selectedPosition(QStyleOptionHeader::NotAdjacent), sortIndicator(None), - orientation(Qt::Horizontal), textElideMode(Qt::ElideNone), unused(0) + orientation(Qt::Horizontal), textElideMode(Qt::ElideNone), isSectionDragTarget(false), unused(0) { } diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h index 4998d8cf14..677a04c04b 100644 --- a/src/widgets/styles/qstyleoption.h +++ b/src/widgets/styles/qstyleoption.h @@ -221,7 +221,8 @@ public: SortIndicator sortIndicator; Qt::Orientation orientation:2; Qt::TextElideMode textElideMode:2; - int unused:28; + bool isSectionDragTarget:1; + int unused:27; QStyleOptionHeader(); QStyleOptionHeader(const QStyleOptionHeader &other) : QStyleOption(Version, Type) { *this = other; } |