From 83d2073d81daa7b23eb2e9d16b6f23d31193440b Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Mon, 11 Aug 2014 10:15:00 +0200 Subject: [PATCH] do not take out line editor margins if there is not enough room --- kstyle/breezestyle.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp index 1adcf51f..c883f460 100644 --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -1107,7 +1107,15 @@ namespace Breeze // check flatness const bool flat( frameOption->lineWidth == 0 ); - return flat ? option->rect : insideMargin( option->rect, Metrics::LineEdit_MarginWidth + Metrics::Frame_FrameWidth ); + if( flat ) return option->rect; + + // copy rect and take out margins + QRect rect( option->rect ); + + // take out margins if there is enough room + const int marginWidth( Metrics::LineEdit_MarginWidth + Metrics::Frame_FrameWidth ); + if( rect.height() > option->fontMetrics.height() + 2*marginWidth ) return insideMargin( rect, marginWidth ); + else return rect; } //___________________________________________________________________________________________________________________