Fluent2 scrollbar updates

This commit is contained in:
Uwe Rathmann 2023-07-19 17:43:51 +02:00
parent c40457fbea
commit 4e2a069c14
2 changed files with 38 additions and 15 deletions

View File

@ -1102,11 +1102,31 @@ void Editor::setupScrollViewMetrics()
using Q = QskScrollView;
for ( auto subControl : { Q::HorizontalScrollBar, Q::VerticalScrollBar } )
setMetric( subControl | A::Size, 2 );
{
const auto aspect = subControl | A::Size;
setMetric( aspect, 2 );
setMetric( aspect | Q::Hovered, 6 );
setMetric( aspect | Q::Pressed, 6 );
}
/*
The scroll bars are actually above the viewport, what is not
supported by the skinlet. Do we want to have this. TODO ...
*/
setAlignment( Q::VerticalScrollBar, Qt::AlignHCenter );
setAlignment( Q::HorizontalScrollBar, Qt::AlignVCenter );
setBoxShape( Q::HorizontalScrollHandle, 100, Qt::RelativeSize );
setBoxShape( Q::VerticalScrollHandle, 100, Qt::RelativeSize );
const auto handleExtent = 40.0;
setStrutSize( Q::HorizontalScrollHandle, handleExtent, 0.0 );
setStrutSize( Q::VerticalScrollHandle, 0.0, handleExtent );
for ( auto subControl : { Q::HorizontalScrollBar, Q::VerticalScrollBar } )
setAnimation( subControl | A::Metric, 100 );
}
void Editor::setupScrollViewColors(
@ -1114,17 +1134,10 @@ void Editor::setupScrollViewColors(
{
using Q = QskScrollView;
const auto& pal = theme.palette;
const auto fillColor = theme.palette.fillColor.controlStrong.defaultColor;
#if 1
setGradient( Q::Panel, QColor() );
setGradient( Q::Viewport, QColor() );
#endif
for ( auto subControl : { Q::HorizontalScrollHandle, Q::VerticalScrollHandle } )
{
setGradient( subControl | section, pal.fillColor.controlStrong.defaultColor );
}
setGradient( Q::HorizontalScrollHandle | section, fillColor );
setGradient( Q::VerticalScrollHandle | section, fillColor );
}
void Editor::setupSegmentedBarMetrics()

View File

@ -30,11 +30,12 @@ class QskScrollView::PrivateData
if ( isScrolling == scrolling )
return;
QskAspect::Subcontrol subControl;
Qt::Orientation orientation;
if ( ( isScrolling == Qt::Horizontal ) || ( scrolling == Qt::Horizontal ) )
subControl = HorizontalScrollHandle;
orientation = Qt::Horizontal;
else
subControl = VerticalScrollHandle;
orientation = Qt::Vertical;
this->isScrolling = scrolling;
this->scrollPressPos = pos;
@ -47,7 +48,16 @@ class QskScrollView::PrivateData
if ( scrolling == 0 )
qSwap( oldStates, newStates );
scrollView->startHintTransitions( { subControl }, oldStates, newStates );
if ( orientation == Qt::Horizontal )
{
scrollView->startHintTransitions( { HorizontalScrollHandle }, oldStates, newStates );
scrollView->startHintTransitions( { HorizontalScrollBar }, oldStates, newStates );
}
else
{
scrollView->startHintTransitions( { VerticalScrollHandle }, oldStates, newStates );
scrollView->startHintTransitions( { VerticalScrollBar }, oldStates, newStates );
}
}
Qt::ScrollBarPolicy horizontalScrollBarPolicy = Qt::ScrollBarAsNeeded;