Created
April 25, 2018 10:22
-
-
Save Tar-Dingens/c7a540af91ec46cb9e57e2d03a765a95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/kstyle/CMakeLists.txt b/kstyle/CMakeLists.txt | |
index 9cdd51aa..f90e387e 100644 | |
--- a/kstyle/CMakeLists.txt | |
+++ b/kstyle/CMakeLists.txt | |
@@ -134,6 +134,7 @@ set(breeze_PART_SRCS | |
breezemdiwindowshadow.cpp | |
breezemnemonics.cpp | |
breezepropertynames.cpp | |
+ breezescaling.cpp | |
breezeshadowhelper.cpp | |
breezesplitterproxy.cpp | |
breezestyle.cpp | |
diff --git a/kstyle/breeze.h b/kstyle/breeze.h | |
index bc63e4c4..88d8da6d 100644 | |
--- a/kstyle/breeze.h | |
+++ b/kstyle/breeze.h | |
@@ -24,6 +24,7 @@ | |
#include <QPointer> | |
#include <QScopedPointer> | |
#include <QWeakPointer> | |
+#include "breezescaling.h" | |
namespace Breeze | |
{ | |
@@ -50,7 +51,7 @@ namespace Breeze | |
//@} | |
//* metrics | |
- enum Metrics | |
+ enum MetricsUnscaled | |
{ | |
// frames | |
diff --git a/kstyle/breezehelper.cpp b/kstyle/breezehelper.cpp | |
index 505de8a4..1cf34edc 100644 | |
--- a/kstyle/breezehelper.cpp | |
+++ b/kstyle/breezehelper.cpp | |
@@ -846,7 +846,7 @@ namespace Breeze | |
// copy rect and radius | |
QRectF frameRect( rect ); | |
- frameRect.adjust( 3, 3, -3, -3 ); | |
+ frameRect.adjust( dpiScaleR(3), dpiScaleR(3), dpiScaleR(-3), dpiScaleR(-3) ); | |
if( sunken ) frameRect.translate(1, 1); | |
@@ -868,7 +868,7 @@ namespace Breeze | |
// copy rect and radius | |
QRectF frameRect( rect ); | |
- frameRect.adjust( 2, 2, -2, -2 ); | |
+ frameRect.adjust( dpiScaleR(2), dpiScaleR(2), dpiScaleR(-2), dpiScaleR(-2) ); | |
qreal radius( frameRadius() ); | |
// shadow | |
@@ -906,7 +906,7 @@ namespace Breeze | |
painter->setBrush( color ); | |
painter->setPen( Qt::NoPen ); | |
- const QRectF markerRect( frameRect.adjusted( 3, 3, -3, -3 ) ); | |
+ const QRectF markerRect( frameRect.adjusted( dpiScaleR(3), dpiScaleR(3), dpiScaleR(-3), dpiScaleR(-3) ) ); | |
painter->drawRect( markerRect ); | |
} else if( state == CheckPartial ) { | |
@@ -915,7 +915,7 @@ namespace Breeze | |
pen.setJoinStyle( Qt::MiterJoin ); | |
painter->setPen( pen ); | |
- const QRectF markerRect( frameRect.adjusted( 4, 4, -4, -4 ) ); | |
+ const QRectF markerRect( frameRect.adjusted( dpiScaleR(4), dpiScaleR(4), dpiScaleR(-4), dpiScaleR(-4) ) ); | |
painter->drawRect( markerRect ); | |
painter->setPen( Qt::NoPen ); | |
@@ -930,7 +930,7 @@ namespace Breeze | |
} else if( state == CheckAnimated ) { | |
- const QRectF markerRect( frameRect.adjusted( 3, 3, -3, -3 ) ); | |
+ const QRectF markerRect( frameRect.adjusted( dpiScaleR(3), dpiScaleR(3), dpiScaleR(-3), dpiScaleR(-3) ) ); | |
QPainterPath path; | |
path.moveTo( markerRect.topRight() ); | |
path.lineTo( markerRect.center() + animation*( markerRect.topLeft() - markerRect.center() ) ); | |
@@ -955,7 +955,7 @@ namespace Breeze | |
// copy rect | |
QRectF frameRect( rect ); | |
- frameRect.adjust( 3, 3, -3, -3 ); | |
+ frameRect.adjust( dpiScaleR(3), dpiScaleR(3), dpiScaleR(-3), dpiScaleR(-3) ); | |
if( sunken ) frameRect.translate(1, 1); | |
painter->setPen( Qt::NoPen ); | |
@@ -976,7 +976,7 @@ namespace Breeze | |
// copy rect | |
QRectF frameRect( rect ); | |
- frameRect.adjust( 2, 2, -2, -2 ); | |
+ frameRect.adjust( dpiScaleR(2), dpiScaleR(2), dpiScaleR(-2), dpiScaleR(-2) ); | |
// shadow | |
if( sunken ) | |
@@ -1010,14 +1010,14 @@ namespace Breeze | |
painter->setBrush( color ); | |
painter->setPen( Qt::NoPen ); | |
- const QRectF markerRect( frameRect.adjusted( 3, 3, -3, -3 ) ); | |
+ const QRectF markerRect( frameRect.adjusted( dpiScaleR(3), dpiScaleR(3), dpiScaleR(-3), dpiScaleR(-3) ) ); | |
painter->drawEllipse( markerRect ); | |
} else if( state == RadioAnimated ) { | |
painter->setBrush( color ); | |
painter->setPen( Qt::NoPen ); | |
- QRectF markerRect( frameRect.adjusted( 3, 3, -3, -3 ) ); | |
+ QRectF markerRect( frameRect.adjusted( dpiScaleR(3), dpiScaleR(3), dpiScaleR(-3), dpiScaleR(-3) ) ); | |
painter->translate( markerRect.center() ); | |
painter->rotate( 45 ); | |
@@ -1131,7 +1131,7 @@ namespace Breeze | |
// copy rect | |
QRectF frameRect( rect ); | |
- frameRect.adjust( 1, 1, -1, -1 ); | |
+ frameRect.adjust( dpiScaleR(1), dpiScaleR(1), dpiScaleR(-1), dpiScaleR(-1) ); | |
// shadow | |
if( shadow.isValid() && !sunken ) | |
@@ -1302,10 +1302,10 @@ namespace Breeze | |
QPolygonF arrow; | |
switch( orientation ) | |
{ | |
- case ArrowUp: arrow << QPointF( -4, 2 ) << QPointF( 0, -2 ) << QPointF( 4, 2 ); break; | |
- case ArrowDown: arrow << QPointF( -4, -2 ) << QPointF( 0, 2 ) << QPointF( 4, -2 ); break; | |
- case ArrowLeft: arrow << QPointF( 2, -4 ) << QPointF( -2, 0 ) << QPointF( 2, 4 ); break; | |
- case ArrowRight: arrow << QPointF( -2, -4 ) << QPointF( 2, 0 ) << QPointF( -2, 4 ); break; | |
+ case ArrowUp: arrow << QPointF( dpiScaleR(-4), dpiScaleR(2) ) << QPointF( 0, dpiScaleR(-2) ) << QPointF( dpiScaleR(4), dpiScaleR(2) ); break; | |
+ case ArrowDown: arrow << QPointF( dpiScaleR(-4), dpiScaleR(-2) ) << QPointF( 0, dpiScaleR(2) ) << QPointF( dpiScaleR(4), dpiScaleR(-2) ); break; | |
+ case ArrowLeft: arrow << QPointF( dpiScaleR(2), dpiScaleR(-4) ) << QPointF( dpiScaleR(-2), 0 ) << QPointF( dpiScaleR(2), dpiScaleR(4) ); break; | |
+ case ArrowRight: arrow << QPointF( dpiScaleR(-2), dpiScaleR(-4) ) << QPointF( dpiScaleR(2), 0 ) << QPointF( dpiScaleR(-2), dpiScaleR(4) ); break; | |
default: break; | |
} | |
@@ -1313,7 +1313,7 @@ namespace Breeze | |
painter->setRenderHints( QPainter::Antialiasing ); | |
painter->translate( QRectF( rect ).center() ); | |
painter->setBrush( Qt::NoBrush ); | |
- painter->setPen( QPen( color, 1.1 ) ); | |
+ painter->setPen( QPen( color, 1.1 * Metrics::ScaleFactor) ); | |
painter->drawPolyline( arrow ); | |
painter->restore(); | |
} | |
diff --git a/kstyle/breezescaling.cpp b/kstyle/breezescaling.cpp | |
new file mode 100644 | |
index 00000000..4ba2636e | |
--- /dev/null | |
+++ b/kstyle/breezescaling.cpp | |
@@ -0,0 +1,167 @@ | |
+ | |
+/************************************************************************* | |
+ * Copyright (C) 2018 by Steffen Coenen <steffen@steffen-coenen.de> * | |
+ * * | |
+ * This program is free software; you can redistribute it and/or modify * | |
+ * it under the terms of the GNU General Public License as published by * | |
+ * the Free Software Foundation; either version 2 of the License, or * | |
+ * (at your option) any later version. * | |
+ * * | |
+ * This program is distributed in the hope that it will be useful, * | |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
+ * GNU General Public License for more details. * | |
+ * * | |
+ * You should have received a copy of the GNU General Public License * | |
+ * along with this program; if not, write to the * | |
+ * Free Software Foundation, Inc., * | |
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | |
+ *************************************************************************/ | |
+ | |
+#include <algorithm> | |
+#include <cmath> | |
+#include <QApplication> | |
+#include <QDesktopWidget> | |
+ | |
+#include "breeze.h" | |
+#include "breezescaling.h" | |
+ | |
+namespace Breeze | |
+{ | |
+ int dpiScaleR(qreal a) { | |
+ return std::round( a * Metrics::ScaleFactor ); | |
+ } | |
+ | |
+namespace Metrics | |
+{ | |
+ qreal CalculateScaleFactor() { | |
+ qreal ScaleFactor; | |
+ if (qgetenv("BREEZE_SCALE").isEmpty()) | |
+ { | |
+ qreal CalculatedScaleFactor = (QApplication::desktop()->logicalDpiX()/96.0); | |
+ ScaleFactor = std::max(1.0, CalculatedScaleFactor); | |
+ } | |
+ else | |
+ { | |
+ ScaleFactor = std::max(0.5, qgetenv("BREEZE_SCALE").toDouble()); | |
+ } | |
+ return ScaleFactor; | |
+ } | |
+ qreal ScaleFactor = CalculateScaleFactor(); | |
+ | |
+ // frames | |
+ int Frame_FrameWidth = dpiScaleR(MetricsUnscaled::Frame_FrameWidth); //2; | |
+ int Frame_FrameRadius = qBound(3.0, std::floor(MetricsUnscaled::Frame_FrameRadius * ScaleFactor), 6.0); //3; | |
+ | |
+ // layout | |
+ int Layout_TopLevelMarginWidth = dpiScaleR(MetricsUnscaled::Layout_TopLevelMarginWidth); // 10 | |
+ int Layout_ChildMarginWidth = dpiScaleR(MetricsUnscaled::Layout_ChildMarginWidth); // 6 | |
+ int Layout_DefaultSpacing = dpiScaleR(MetricsUnscaled::Layout_DefaultSpacing); // 6 | |
+ | |
+ // line editors | |
+ int LineEdit_FrameWidth = dpiScaleR(MetricsUnscaled::LineEdit_FrameWidth); //6, | |
+ | |
+ // menu items | |
+ int Menu_FrameWidth = MetricsUnscaled::Menu_FrameWidth; //0, | |
+ int MenuItem_MarginWidth = dpiScaleR(MetricsUnscaled::MenuItem_MarginWidth); //5, | |
+ //uncomment for master; int MenuItem_MarginHeight = dpiScaleR(MetricsUnscaled::MenuItem_MarginHeight); //3, | |
+ int MenuItem_ItemSpacing = dpiScaleR(MetricsUnscaled::MenuItem_ItemSpacing); //4, | |
+ int MenuItem_AcceleratorSpace = dpiScaleR(MetricsUnscaled::MenuItem_AcceleratorSpace); //16, | |
+ int MenuButton_IndicatorWidth = dpiScaleR(MetricsUnscaled::MenuButton_IndicatorWidth); //20, | |
+ | |
+ // combobox | |
+ int ComboBox_FrameWidth = dpiScaleR(MetricsUnscaled::ComboBox_FrameWidth); //6, | |
+ | |
+ // spinbox | |
+ int SpinBox_FrameWidth = dpiScaleR(MetricsUnscaled::SpinBox_FrameWidth); //LineEdit_FrameWidth, | |
+ int SpinBox_ArrowButtonWidth = dpiScaleR(MetricsUnscaled::SpinBox_ArrowButtonWidth); //20, | |
+ | |
+ // groupbox title margin | |
+ int GroupBox_TitleMarginWidth = dpiScaleR(MetricsUnscaled::GroupBox_TitleMarginWidth); //4, | |
+ | |
+ // buttons | |
+ int Button_MinWidth = dpiScaleR(MetricsUnscaled::Button_MinWidth); //80, | |
+ int Button_MarginWidth = dpiScaleR(MetricsUnscaled::Button_MarginWidth); //6, | |
+ int Button_ItemSpacing = dpiScaleR(MetricsUnscaled::Button_ItemSpacing); //4, | |
+ | |
+ // tool buttons | |
+ int ToolButton_MarginWidth = dpiScaleR(MetricsUnscaled::ToolButton_MarginWidth); //6, | |
+ int ToolButton_ItemSpacing = dpiScaleR(MetricsUnscaled::ToolButton_ItemSpacing); //4, | |
+ int ToolButton_InlineIndicatorWidth = dpiScaleR(MetricsUnscaled::ToolButton_InlineIndicatorWidth); //12, | |
+ | |
+ // checkboxes and radio buttons | |
+ int CheckBox_Size = dpiScaleR(MetricsUnscaled::CheckBox_Size); //20, | |
+ int CheckBox_FocusMarginWidth = dpiScaleR(MetricsUnscaled::CheckBox_FocusMarginWidth); //2, | |
+ int CheckBox_ItemSpacing = dpiScaleR(MetricsUnscaled::CheckBox_ItemSpacing); //4, | |
+ | |
+ // menubar items | |
+ int MenuBarItem_MarginWidth = dpiScaleR(MetricsUnscaled::MenuBarItem_MarginWidth); //10, | |
+ int MenuBarItem_MarginHeight = dpiScaleR(MetricsUnscaled::MenuBarItem_MarginHeight); //6, | |
+ | |
+ // scrollbars | |
+ int ScrollBar_Extend = dpiScaleR(MetricsUnscaled::ScrollBar_Extend); //20, | |
+ int ScrollBar_SliderWidth = dpiScaleR(MetricsUnscaled::ScrollBar_SliderWidth); //6, | |
+ int ScrollBar_MinSliderHeight = dpiScaleR(MetricsUnscaled::ScrollBar_MinSliderHeight); //20, | |
+ int ScrollBar_NoButtonHeight = dpiScaleR(MetricsUnscaled::ScrollBar_NoButtonHeight); //(ScrollBar_Extend-ScrollBar_SliderWidth)/2, | |
+ int ScrollBar_SingleButtonHeight = dpiScaleR(MetricsUnscaled::ScrollBar_SingleButtonHeight); //ScrollBar_Extend, | |
+ int ScrollBar_DoubleButtonHeight = dpiScaleR(MetricsUnscaled::ScrollBar_DoubleButtonHeight); //2*ScrollBar_Extend, | |
+ | |
+ // toolbars | |
+ int ToolBar_FrameWidth = dpiScaleR(MetricsUnscaled::ToolBar_FrameWidth); //2, | |
+ int ToolBar_HandleExtent = dpiScaleR(MetricsUnscaled::ToolBar_HandleExtent); //10, | |
+ int ToolBar_HandleWidth = dpiScaleR(MetricsUnscaled::ToolBar_HandleWidth); //6, | |
+ int ToolBar_SeparatorWidth = dpiScaleR(MetricsUnscaled::ToolBar_SeparatorWidth); //8, | |
+ int ToolBar_ExtensionWidth = dpiScaleR(MetricsUnscaled::ToolBar_ExtensionWidth); //20, | |
+ int ToolBar_ItemSpacing = MetricsUnscaled::ToolBar_ItemSpacing; //0, | |
+ | |
+ // progressbars | |
+ int ProgressBar_BusyIndicatorSize = dpiScaleR(MetricsUnscaled::ProgressBar_BusyIndicatorSize); //14, | |
+ int ProgressBar_Thickness = dpiScaleR(MetricsUnscaled::ProgressBar_Thickness); //6, | |
+ int ProgressBar_ItemSpacing = dpiScaleR(MetricsUnscaled::ProgressBar_ItemSpacing); //4, | |
+ | |
+ // mdi title bar | |
+ int TitleBar_MarginWidth = dpiScaleR(MetricsUnscaled::TitleBar_MarginWidth); //4, | |
+ | |
+ // sliders | |
+ int Slider_TickLength = dpiScaleR(MetricsUnscaled::Slider_TickLength); //8, | |
+ int Slider_TickMarginWidth = dpiScaleR(MetricsUnscaled::Slider_TickMarginWidth); //2, | |
+ int Slider_GrooveThickness = dpiScaleR(MetricsUnscaled::Slider_GrooveThickness); //6, | |
+ int Slider_ControlThickness = dpiScaleR(MetricsUnscaled::Slider_ControlThickness); //20, | |
+ | |
+ // tabbar | |
+ int TabBar_TabMarginHeight = dpiScaleR(MetricsUnscaled::TabBar_TabMarginHeight); //4, | |
+ int TabBar_TabMarginWidth = dpiScaleR(MetricsUnscaled::TabBar_TabMarginWidth); //8, | |
+ int TabBar_TabMinWidth = dpiScaleR(MetricsUnscaled::TabBar_TabMinWidth); //80, | |
+ int TabBar_TabMinHeight = dpiScaleR(MetricsUnscaled::TabBar_TabMinHeight); //28, | |
+ int TabBar_TabItemSpacing = dpiScaleR(MetricsUnscaled::TabBar_TabItemSpacing); //8, | |
+ int TabBar_TabOverlap = MetricsUnscaled::TabBar_TabOverlap; //1, | |
+ int TabBar_BaseOverlap = MetricsUnscaled::TabBar_BaseOverlap; //2, | |
+ | |
+ // tab widget | |
+ int TabWidget_MarginWidth = dpiScaleR(MetricsUnscaled::TabWidget_MarginWidth); //4, | |
+ | |
+ // toolbox | |
+ int ToolBox_TabMinWidth = dpiScaleR(MetricsUnscaled::ToolBox_TabMinWidth); //80, | |
+ int ToolBox_TabItemSpacing = dpiScaleR(MetricsUnscaled::ToolBox_TabItemSpacing); //4, | |
+ int ToolBox_TabMarginWidth = dpiScaleR(MetricsUnscaled::ToolBox_TabMarginWidth); //8, | |
+ | |
+ // tooltips | |
+ int ToolTip_FrameWidth = dpiScaleR(MetricsUnscaled::ToolTip_FrameWidth); //3, | |
+ | |
+ // list headers | |
+ int Header_MarginWidth = dpiScaleR(MetricsUnscaled::Header_MarginWidth); //6, | |
+ int Header_ItemSpacing = dpiScaleR(MetricsUnscaled::Header_ItemSpacing); //4, | |
+ int Header_ArrowSize = dpiScaleR(MetricsUnscaled::Header_ArrowSize); //10, | |
+ | |
+ // tree view | |
+ int ItemView_ArrowSize = dpiScaleR(MetricsUnscaled::ItemView_ArrowSize); //10, | |
+ int ItemView_ItemMarginWidth = dpiScaleR(MetricsUnscaled::ItemView_ItemMarginWidth); //3, | |
+ int SidePanel_ItemMarginWidth = dpiScaleR(MetricsUnscaled::SidePanel_ItemMarginWidth); //4, | |
+ | |
+ // splitter | |
+ int Splitter_SplitterWidth = MetricsUnscaled::Splitter_SplitterWidth; //1, | |
+ | |
+ // shadow dimensions | |
+ int Shadow_Overlap = dpiScaleR(MetricsUnscaled::Shadow_Overlap); //2 | |
+} | |
+} | |
diff --git a/kstyle/breezescaling.h b/kstyle/breezescaling.h | |
new file mode 100644 | |
index 00000000..82d0e6a5 | |
--- /dev/null | |
+++ b/kstyle/breezescaling.h | |
@@ -0,0 +1,149 @@ | |
+ | |
+/************************************************************************* | |
+ * Copyright (C) 2018 by Steffen Coenen <steffen@steffen-coenen.de> * | |
+ * * | |
+ * This program is free software; you can redistribute it and/or modify * | |
+ * it under the terms of the GNU General Public License as published by * | |
+ * the Free Software Foundation; either version 2 of the License, or * | |
+ * (at your option) any later version. * | |
+ * * | |
+ * This program is distributed in the hope that it will be useful, * | |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
+ * GNU General Public License for more details. * | |
+ * * | |
+ * You should have received a copy of the GNU General Public License * | |
+ * along with this program; if not, write to the * | |
+ * Free Software Foundation, Inc., * | |
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | |
+ *************************************************************************/ | |
+ | |
+#ifndef BREEZESCALING_H | |
+#define BREEZESCALING_H | |
+ | |
+namespace Breeze | |
+{ | |
+ int dpiScaleR(qreal a); | |
+ | |
+namespace Metrics | |
+{ | |
+ extern qreal ScaleFactor; | |
+ | |
+ // frames | |
+ extern int Frame_FrameWidth; | |
+ extern int Frame_FrameRadius; | |
+ | |
+ // layout | |
+ extern int Layout_TopLevelMarginWidth; | |
+ extern int Layout_ChildMarginWidth; | |
+ extern int Layout_DefaultSpacing; | |
+ | |
+ // line editors | |
+ extern int LineEdit_FrameWidth; | |
+ | |
+ // menu items | |
+ extern int Menu_FrameWidth; | |
+ extern int MenuItem_MarginWidth; | |
+ //uncomment for master; extern int MenuItem_MarginHeight; | |
+ extern int MenuItem_ItemSpacing; | |
+ extern int MenuItem_AcceleratorSpace; | |
+ extern int MenuButton_IndicatorWidth; | |
+ | |
+ // combobox | |
+ extern int ComboBox_FrameWidth; | |
+ | |
+ // spinbox | |
+ extern int SpinBox_FrameWidth; | |
+ extern int SpinBox_ArrowButtonWidth; | |
+ | |
+ // groupbox title margin | |
+ extern int GroupBox_TitleMarginWidth; | |
+ | |
+ // buttons | |
+ extern int Button_MinWidth; | |
+ extern int Button_MarginWidth; | |
+ extern int Button_ItemSpacing; | |
+ | |
+ // tool buttons | |
+ extern int ToolButton_MarginWidth; | |
+ extern int ToolButton_ItemSpacing; | |
+ extern int ToolButton_InlineIndicatorWidth; | |
+ | |
+ // checkboxes and radio buttons | |
+ extern int CheckBox_Size; | |
+ extern int CheckBox_FocusMarginWidth; | |
+ extern int CheckBox_ItemSpacing; | |
+ | |
+ // menubar items | |
+ extern int MenuBarItem_MarginWidth; | |
+ extern int MenuBarItem_MarginHeight; | |
+ | |
+ // scrollbars | |
+ extern int ScrollBar_Extend; | |
+ extern int ScrollBar_SliderWidth; | |
+ extern int ScrollBar_MinSliderHeight; | |
+ extern int ScrollBar_NoButtonHeight; | |
+ extern int ScrollBar_SingleButtonHeight; | |
+ extern int ScrollBar_DoubleButtonHeight; | |
+ | |
+ // toolbars | |
+ extern int ToolBar_FrameWidth; | |
+ extern int ToolBar_HandleExtent; | |
+ extern int ToolBar_HandleWidth; | |
+ extern int ToolBar_SeparatorWidth; | |
+ extern int ToolBar_ExtensionWidth; | |
+ extern int ToolBar_ItemSpacing; | |
+ | |
+ // progressbars | |
+ extern int ProgressBar_BusyIndicatorSize; | |
+ extern int ProgressBar_Thickness; | |
+ extern int ProgressBar_ItemSpacing; | |
+ | |
+ // mdi title bar | |
+ extern int TitleBar_MarginWidth; | |
+ | |
+ // sliders | |
+ extern int Slider_TickLength; | |
+ extern int Slider_TickMarginWidth; | |
+ extern int Slider_GrooveThickness; | |
+ extern int Slider_ControlThickness; | |
+ | |
+ // tabbar | |
+ extern int TabBar_TabMarginHeight; | |
+ extern int TabBar_TabMarginWidth; | |
+ extern int TabBar_TabMinWidth; | |
+ extern int TabBar_TabMinHeight; | |
+ extern int TabBar_TabItemSpacing; | |
+ extern int TabBar_TabOverlap; | |
+ extern int TabBar_BaseOverlap; | |
+ | |
+ // tab widget | |
+ extern int TabWidget_MarginWidth; | |
+ | |
+ // toolbox | |
+ extern int ToolBox_TabMinWidth; | |
+ extern int ToolBox_TabItemSpacing; | |
+ extern int ToolBox_TabMarginWidth; | |
+ | |
+ // tooltips | |
+ extern int ToolTip_FrameWidth; | |
+ | |
+ // list headers | |
+ extern int Header_MarginWidth; | |
+ extern int Header_ItemSpacing; | |
+ extern int Header_ArrowSize; | |
+ | |
+ // tree view | |
+ extern int ItemView_ArrowSize; | |
+ extern int ItemView_ItemMarginWidth; | |
+ extern int SidePanel_ItemMarginWidth; | |
+ | |
+ // splitter | |
+ extern int Splitter_SplitterWidth; | |
+ | |
+ // shadow dimensions | |
+ extern int Shadow_Overlap; | |
+} | |
+} | |
+ | |
+#endif | |
diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp | |
index ef35107f..dff25ca7 100644 | |
--- a/kstyle/breezestyle.cpp | |
+++ b/kstyle/breezestyle.cpp | |
@@ -496,7 +496,7 @@ namespace Breeze | |
#endif | |
// fallback | |
- return Metrics::Frame_FrameWidth; | |
+ return MetricsUnscaled::Frame_FrameWidth; | |
case PM_ComboBoxFrameWidth: | |
{ | |
@@ -542,7 +542,7 @@ namespace Breeze | |
case PM_ButtonMargin: | |
{ | |
// needs special case for kcalc buttons, to prevent the application to set too small margins | |
- if( widget && widget->inherits( "KCalcButton" ) ) return Metrics::Button_MarginWidth + 4; | |
+ if( widget && widget->inherits( "KCalcButton" ) ) return Metrics::Button_MarginWidth + dpiScaleR(4); | |
else return Metrics::Button_MarginWidth; | |
} | |
@@ -4431,7 +4431,7 @@ namespace Breeze | |
drawItemPixmap( painter, rect, textFlags, pixmap ); | |
// adjust rect (copied from QCommonStyle) | |
- textRect.setLeft( textRect.left() + buttonOption->iconSize.width() + 4 ); | |
+ textRect.setLeft( textRect.left() + buttonOption->iconSize.width() + dpiScaleR(4) ); | |
textRect = visualRect( option, textRect ); | |
} | |
@@ -4515,7 +4515,7 @@ namespace Breeze | |
const auto pixmap = cb->currentIcon.pixmap(widget->windowHandle(), cb->iconSize, mode); | |
auto iconRect(editRect); | |
- iconRect.setWidth(cb->iconSize.width() + 4); | |
+ iconRect.setWidth(cb->iconSize.width() + dpiScaleR(4)); | |
iconRect = alignedRect(cb->direction, | |
Qt::AlignLeft | Qt::AlignVCenter, | |
iconRect.size(), editRect); | |
@@ -4526,7 +4526,7 @@ namespace Breeze | |
if (cb->direction == Qt::RightToLeft) | |
editRect.translate(-4 - cb->iconSize.width(), 0); | |
else | |
- editRect.translate(cb->iconSize.width() + 4, 0); | |
+ editRect.translate(cb->iconSize.width() + dpiScaleR(4), 0); | |
} | |
if (!cb->currentText.isEmpty() && !cb->editable) { | |
proxy()->drawItemText(painter, editRect.adjusted(1, 0, -1, 0), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment