summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2016-10-08 07:01:13 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2016-12-20 14:19:16 +0100
commit0ede250968bee3a64648aa9fd018e25719331366 (patch)
tree75697979741e2c6fcad66eabfafdf143cddf7b61 /vcl
parent27be8a263eddb54cb6b66cc0f832bfd02016a694 (diff)
KDE4 add frame to Spinbox and enable buttons...
... and don't claim to support all parts per default. Change-Id: I7a8e0774b4573bf755737bc1adebe19a774736c9
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/kde4/KDESalGraphics.cxx24
1 files changed, 23 insertions, 1 deletions
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index 51e51934fbba..512d2f2356c2 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -504,6 +504,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
else if (type == ControlType::Spinbox)
{
QStyleOptionSpinBox option;
+ option.frame = true;
// determine active control
if( value.getType() == ControlType::SpinButtons )
@@ -513,6 +514,14 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
option.activeSubControls |= QStyle::SC_SpinBoxUp;
if( (pSpinVal->mnLowerState & ControlState::PRESSED) )
option.activeSubControls |= QStyle::SC_SpinBoxDown;
+ if( (pSpinVal->mnUpperState & ControlState::ENABLED) )
+ option.stepEnabled |= QAbstractSpinBox::StepUpEnabled;
+ if( (pSpinVal->mnLowerState & ControlState::ENABLED) )
+ option.stepEnabled |= QAbstractSpinBox::StepDownEnabled;
+ if( (pSpinVal->mnUpperState & ControlState::ROLLOVER) )
+ option.state = QStyle::State_MouseOver;
+ if( (pSpinVal->mnLowerState & ControlState::ROLLOVER) )
+ option.state = QStyle::State_MouseOver;
}
draw( QStyle::CC_SpinBox, &option, m_image.get(),
@@ -801,12 +810,25 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
case ControlType::Spinbox:
{
QStyleOptionSpinBox sbo;
+ sbo.frame = true;
sbo.rect = QRect(0, 0, contentRect.width(), contentRect.height());
sbo.state = vclStateValue2StateFlag(controlState, val);
switch ( part )
{
+ case ControlPart::Entire:
+ {
+ int nHeight = QApplication::fontMetrics().height();
+ QSize aContentSize( contentRect.width(), nHeight );
+ QSize aMinSize = QApplication::style()->
+ sizeFromContents( QStyle::CT_SpinBox, &sbo, aContentSize );
+ if( aMinSize.height() > contentRect.height() )
+ contentRect.adjust( 0, 0, 0, aMinSize.height() - contentRect.height() );
+ boundingRect = contentRect;
+ retVal = true;
+ break;
+ }
case ControlPart::ButtonUp:
contentRect = QApplication::style()->subControlRect(
QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxUp );
@@ -830,7 +852,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
contentRect.translate( boundingRect.left(), boundingRect.top() );
break;
default:
- retVal = true;
+ break;
}
break;
}