[Libreoffice-commits] core.git: Branch 'feature/qt5+kde5' - 2 commits - vcl/unx

Katarina Behrens Katarina.Behrens at cib.de
Tue Apr 24 13:20:53 UTC 2018


 vcl/unx/kde5/KDE5SalGraphics.cxx |   38 ++++++++++++++------------------------
 1 file changed, 14 insertions(+), 24 deletions(-)

New commits:
commit 9741a9d1ff3e9ffeeb2e5d46dd18f845b35eb0cf
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Tue Apr 24 13:47:30 2018 +0200

    Drop duplicate implementation of conversion to QRect
    
    use the one from Qt5Tools class
    
    Change-Id: I4dc33b14fc6ab7fa7c426d6b1a56c299aed62c55

diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 1a974bfbf089..c8682bfd62ee 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -71,16 +71,6 @@ void QImage2BitmapBuffer( QImage* pImg, BitmapBuffer* pBuf )
     pBuf->mnScanlineSize = pImg->bytesPerLine();
 }
 
-/**
- Convert tools::Rectangle to QRect.
- @param rControlRegion The tools::Rectangle to convert.
- @return The matching QRect
-*/
-QRect region2QRect( const tools::Rectangle& rControlRegion )
-{
-    return QRect(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.GetWidth(), rControlRegion.GetHeight());
-}
-
 KDE5SalGraphics::KDE5SalGraphics()
    : SvpSalGraphics()
 {
@@ -216,7 +206,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
 
     bool returnVal = true;
 
-    QRect widgetRect = region2QRect(rControlRegion);
+    QRect widgetRect = toQRect(rControlRegion);
 
     //if no image, or resized, make a new image
     if (!m_image || m_image->size() != widgetRect.size())
@@ -342,7 +332,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
             // is painted after menuitem highlight, otherwise there would be a grey area
             assert( value.getType() == ControlType::MenuPopup );
             const MenupopupValue* menuVal = static_cast<const MenupopupValue*>(&value);
-            QRect menuItemRect( region2QRect( menuVal->maItemRect ));
+            QRect menuItemRect( toQRect( menuVal->maItemRect ));
             QRect rect( menuItemRect.topLeft() - widgetRect.topLeft(),
                 widgetRect.size().expandedTo( menuItemRect.size()));
             // checkboxes are always displayed next to images in menus, so are never centered
@@ -619,7 +609,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
 {
     bool retVal = false;
 
-    QRect boundingRect = region2QRect( controlRegion );
+    QRect boundingRect = toQRect( controlRegion );
     QRect contentRect = boundingRect;
     QStyleOptionComplex styleOption;
 
@@ -938,7 +928,7 @@ bool KDE5SalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart
         }
         rIsInside = FALSE;
         bool bHorizontal = ( nPart == ControlPart::ButtonLeft || nPart == ControlPart::ButtonRight );
-        QRect rect = region2QRect( rControlRegion );
+        QRect rect = toQRect( rControlRegion );
         QPoint pos( rPos.X(), rPos.Y());
         // Adjust coordinates to make the widget appear to be at (0,0), i.e. make
         // widget and screen coordinates the same. QStyle functions should use screen
commit b38c7a223ce436dc1af6aaf95227316e4e66abeb
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Tue Apr 24 13:43:14 2018 +0200

    Render sliders and spinboxes natively
    
    Change-Id: I307930eca8a82f3153f38362ee8f55cb121707b7

diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index baaaa0fbdbb5..1a974bfbf089 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -113,11 +113,11 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
         case ControlType::Listbox:
             return (part == ControlPart::Entire || part == ControlPart::HasBackgroundTexture);
 
-        /*case ControlType::Spinbox:
+        case ControlType::Spinbox:
             return (part == ControlPart::Entire || part == ControlPart::HasBackgroundTexture);
 
         case ControlType::Slider:
-            return (part == ControlPart::TrackHorzArea || part == ControlPart::TrackVertArea);*/
+            return (part == ControlPart::TrackHorzArea || part == ControlPart::TrackVertArea);
 
         default:
             break;
@@ -505,7 +505,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
         {
             returnVal = false;
         }
-    }
+    }*/
     else if (type == ControlType::Spinbox)
     {
         QStyleOptionSpinBox option;
@@ -531,7 +531,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
 
         draw( QStyle::CC_SpinBox, &option, m_image.get(),
               vclStateValue2StateFlag(nControlState, value) );
-    }*/
+    }
     else if (type == ControlType::Radiobutton)
     {
         QStyleOptionButton option;
@@ -564,7 +564,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
 
         draw( QStyle::CE_MenuItem, &option, m_image.get(),
               vclStateValue2StateFlag(nControlState, value) );
-    }
+    }*/
     else if (type == ControlType::Slider && (part == ControlPart::TrackHorzArea || part == ControlPart::TrackVertArea))
     {
         OSL_ASSERT( value.getType() == ControlType::Slider );
@@ -583,7 +583,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
 
         draw( QStyle::CC_Slider, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) );
     }
-    else if( type == ControlType::Progress && part == ControlPart::Entire )
+    /*else if( type == ControlType::Progress && part == ControlPart::Entire )
     {
         QStyleOptionProgressBarV2 option;
         option.minimum = 0;
@@ -729,7 +729,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
             }
             break;
         }
-        /*case ControlType::Spinbox:
+        case ControlType::Spinbox:
         {
             QStyleOptionSpinBox sbo;
             sbo.frame = true;
@@ -778,7 +778,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
             }
             break;
         }
-        case ControlType::MenuPopup:
+        /*case ControlType::MenuPopup:
         {
             int h, w;
             switch ( part ) {
@@ -833,7 +833,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
             retVal = true;
             break;
         }
-        /* case ControlType::Slider:
+        case ControlType::Slider:
         {
             const int w = QApplication::style()->pixelMetric(QStyle::PM_SliderLength);
             if( part == ControlPart::ThumbHorz )
@@ -850,7 +850,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
             }
             break;
         }
-        case ControlType::Toolbar:
+        /*case ControlType::Toolbar:
         {
             const int nWorH = QApplication::style()->pixelMetric(QStyle::PM_ToolBarHandleExtent);
             if( part == ControlPart::ThumbHorz )


More information about the Libreoffice-commits mailing list