blob: f4ee9859c2b349a03f7757cc5d3bf4e8695386f6 [file] [log] [blame]
From ef126328c3ad35d51395abc461c3d64429f91c26 Mon Sep 17 00:00:00 2001
From: Jan-Marek Glogowski <glogow@fbihome.de>
Date: Thu, 30 Jul 2015 18:10:03 +0200
Subject: tdf#92903 KDE4: fix listbox regression from 92115
So at least in case of the CTRL_LISTBOX, getNativeControlRegion is
called for a type and part unsupported by IsNativeControlSupported.
For whatever reason, this results in broken listboxes drawn in
Base's "Table Design" dialog, when selecting "field type", which
draws the listbox on top of the cell.
To make it worse, it seems the listbox is actually drawn to a
smaller space then the actual requirement. Appearently it seems to
use the content rect, instead of the bounding rect.
So in addition to fixing the drawing, this patch increases the
listbox bounding rect, which looks too large in normal dialogs, but
makes the Base's listbox better readable.
Change-Id: I112ec038fd20ad33facd260d16b5d68b508d2bd0
Reviewed-on: https://gerrit.libreoffice.org/17438
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Tested-by: Katarina Behrens <Katarina.Behrens@cib.de>
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index 3e79e1e..eeb741f 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -108,10 +108,7 @@ bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par
return true;
case CTRL_LISTBOX:
- return (part == PART_ENTIRE_CONTROL
- || part == PART_SUB_EDIT
- || part == PART_WINDOW
- || part == PART_BUTTON_DOWN);
+ return (part == PART_ENTIRE_CONTROL || part == HAS_BACKGROUND_TEXTURE);
case CTRL_SPINBOX:
return (part == PART_ENTIRE_CONTROL || part == HAS_BACKGROUND_TEXTURE);
@@ -650,12 +647,6 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
const OUString&,
Rectangle &nativeBoundingRegion, Rectangle &nativeContentRegion )
{
- bool nativeSupport = IsNativeControlSupported( type, part );
- if( ! nativeSupport ) {
- assert( ! nativeSupport && "drawNativeControl called without native support!" );
- return false;
- }
-
bool retVal = false;
QRect boundingRect = region2QRect( controlRegion );
@@ -753,6 +744,14 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
int size = QApplication::style()->pixelMetric(QStyle::PM_ComboBoxFrameWidth) - 2;
contentRect.adjust(-size,-size,size,size);
}
+ else {
+ int hmargin = QApplication::style()->pixelMetric(
+ QStyle::PM_FocusFrameHMargin, &styleOption);
+ int vmargin = QApplication::style()->pixelMetric(
+ QStyle::PM_FocusFrameVMargin, &styleOption);
+ boundingRect.translate( -hmargin, -vmargin );
+ boundingRect.adjust( -hmargin, -vmargin, 2 * hmargin, 2 * vmargin );
+ }
retVal = true;
break;
}
@@ -776,7 +775,6 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
contentRect.translate( boundingRect.left() + hmargin, boundingRect.top() + vmargin );
contentRect.adjust( 0, 0, -2 * hmargin, -2 * vmargin );
- boundingRect = contentRect;
retVal = true;
break;
--
cgit v0.10.2