diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2016-10-08 06:56:07 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2016-12-20 14:19:16 +0100 |
commit | 27be8a263eddb54cb6b66cc0f832bfd02016a694 (patch) | |
tree | dd8d5bf9c4cc2e627f7f1d36d4b4524477d93d33 /vcl/unx | |
parent | 98e45efa6ab58c67fb3940b9f6fc4b65542d4d6f (diff) |
KDE4 fix edit box borders
When recalculating the native window frame borders, calculate
using already existing window borders. Otherwise the KDE edit
box results in an unlimited recursion for increasing the
bounding rects, if the control doesn't fit.
Change-Id: I45e51e4796b06097ca537c656f004133dfacd033
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/kde4/KDEData.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/kde4/KDESalGraphics.cxx | 45 |
2 files changed, 23 insertions, 24 deletions
diff --git a/vcl/unx/kde4/KDEData.cxx b/vcl/unx/kde4/KDEData.cxx index 1caf6e87d4d1..d9e9545621a1 100644 --- a/vcl/unx/kde4/KDEData.cxx +++ b/vcl/unx/kde4/KDEData.cxx @@ -49,6 +49,8 @@ void KDEData::initNWF() // Qt theme engines may support a rollover menubar pSVData->maNWFData.mbRolloverMenubar = true; + pSVData->maNWFData.mbNoFocusRects = true; + // Styled menus need additional space QStyle *style = QApplication::style(); pSVData->maNWFData.mnMenuFormatBorderX = diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index bb468624b2cd..51e51934fbba 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -87,6 +87,7 @@ bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par case ControlType::Menubar: case ControlType::MenuPopup: case ControlType::Editbox: + case ControlType::MultilineEditbox: case ControlType::Combobox: case ControlType::Toolbar: case ControlType::Frame: @@ -406,20 +407,15 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, draw( QStyle::PE_IndicatorToolBarHandle, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value), rect ); } - else if (type == ControlType::Editbox) + else if (type == ControlType::Editbox || type == ControlType::MultilineEditbox) { - QStyleOptionFrameV2 option; - draw( QStyle::PE_PanelLineEdit, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value), m_image->rect().adjusted( 2, 2, -2, -2 )); - - draw( QStyle::PE_FrameLineEdit, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value)); + lcl_drawFrame( QStyle::PE_FrameLineEdit, m_image.get(), + vclStateValue2StateFlag(nControlState, value)); } else if (type == ControlType::Combobox) { QStyleOptionComboBox option; option.editable = true; - draw( QStyle::CC_ComboBox, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); } @@ -678,32 +674,33 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, { int size = QApplication::style()->pixelMetric( QStyle::PM_ButtonDefaultIndicator, &styleOption ); - boundingRect.adjust( -size, -size, size, size ); - retVal = true; } } break; case ControlType::Editbox: + case ControlType::MultilineEditbox: { - int nFontHeight = QApplication::fontMetrics().height(); - //int nFrameSize = QApplication::style()->pixelMetric(QStyle::PM_DefaultFrameWidth); - int nLayoutTop = QApplication::style()->pixelMetric(QStyle::PM_LayoutTopMargin); - int nLayoutBottom = QApplication::style()->pixelMetric(QStyle::PM_LayoutBottomMargin); - int nLayoutLeft = QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin); - int nLayoutRight = QApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin); - - int nMinHeight = (nFontHeight + nLayoutTop + nLayoutBottom); - if( boundingRect.height() < nMinHeight ) + QStyleOptionFrameV3 fo; + fo.frameShape = QFrame::StyledPanel; + fo.state = QStyle::State_Sunken; + fo.lineWidth = QApplication::style()->pixelMetric(QStyle::PM_DefaultFrameWidth); + QSize aMinSize = QApplication::style()-> + sizeFromContents( QStyle::CT_LineEdit, &fo, contentRect.size() ); + if( aMinSize.height() > boundingRect.height() ) { - int delta = nMinHeight - boundingRect.height(); - boundingRect.adjust( 0, 0, 0, delta ); + int nHeight = (aMinSize.height() - boundingRect.height()) / 2; + assert( 0 == (aMinSize.height() - boundingRect.height()) % 2 ); + boundingRect.adjust( 0, -nHeight, 0, nHeight ); + } + if( aMinSize.width() > boundingRect.width() ) + { + int nWidth = (aMinSize.width() - boundingRect.width()) / 2; + assert( 0 == (aMinSize.width() - boundingRect.width()) % 2 ); + boundingRect.adjust( -nWidth, 0, nWidth, 0 ); } - contentRect = boundingRect; - contentRect.adjust( -nLayoutLeft+1, -nLayoutTop+1, nLayoutRight-1, nLayoutBottom-1 ); retVal = true; - break; } case ControlType::Checkbox: |