diff --git a/kstyle/breezemetrics.h b/kstyle/breezemetrics.h index c7be720c..718cbe41 100644 --- a/kstyle/breezemetrics.h +++ b/kstyle/breezemetrics.h @@ -33,6 +33,9 @@ namespace Breeze // frames Frame_FrameWidth = 1, + // line edit margins + LineEdit_MarginWidth = 4, + // groupbox title margin GroupBox_TitleMargin = 4, diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp index 53d3b045..6bd42edd 100644 --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -260,6 +260,9 @@ namespace Breeze case SE_RadioButtonContents: return radioButtonContentsRect( option, widget ); case SE_RadioButtonFocusRect: return radioButtonFocusRect( option, widget ); + // line edit content + case SE_LineEditContents: return lineEditContentsRect( option, widget ); + // progress bars case SE_ProgressBarGroove: return progressBarGrooveRect( option, widget ); case SE_ProgressBarContents: return progressBarContentsRect( option, widget ); @@ -566,6 +569,15 @@ namespace Breeze } + //___________________________________________________________________________________________________________________ + QRect Style::lineEditContentsRect( const QStyleOption* option, const QWidget* widget ) const + { + + Q_UNUSED( widget ); + return insideMargin( option->rect, Metrics::LineEdit_MarginWidth ); + + } + //___________________________________________________________________________________________________________________ QRect Style::progressBarGrooveRect( const QStyleOption* option, const QWidget* ) const { @@ -889,7 +901,7 @@ namespace Breeze QSize Style::lineEditSizeFromContents( const QStyleOption*, const QSize& contentsSize, const QWidget* ) const { QSize size( contentsSize ); - return size + QSize( 8, 8 ); + return size + QSize( 2*Metrics::LineEdit_MarginWidth, 2*Metrics::LineEdit_MarginWidth ); } //______________________________________________________________ @@ -958,7 +970,7 @@ namespace Breeze else outline = KColorUtils::mix( palette.color( QPalette::Window ), palette.color( QPalette::WindowText ), 0.25 ); // render - renderFrame( painter, option->rect, QColor(), outline ); + renderFrame( painter, option->rect, QColor(), outline, hasFocus ); return true; @@ -1810,7 +1822,7 @@ namespace Breeze //______________________________________________________________________________ void Style::renderFrame( QPainter* painter, const QRect& rect, - const QColor& color, const QColor& outline ) const + const QColor& color, const QColor& outline, bool focus ) const { painter->setRenderHint( QPainter::Antialiasing ); @@ -1827,10 +1839,22 @@ namespace Breeze if( outline.isValid() ) { + // outline - painter->setPen( QPen( outline, 1 ) ); - painter->setBrush( Qt::NoBrush ); - painter->drawRoundedRect( baseRect.adjusted( 0.5, 0.5, -0.5, -0.5 ), 2, 2 ); + if( focus ) + { + + painter->setPen( QPen( outline, 2 ) ); + painter->setBrush( Qt::NoBrush ); + painter->drawRoundedRect( baseRect.adjusted( 1, 1, -1, -1 ), 1.5, 1.5 ); + + } else { + + painter->setPen( QPen( outline, 1 ) ); + painter->setBrush( Qt::NoBrush ); + painter->drawRoundedRect( baseRect.adjusted( 0.5, 0.5, -0.5, -0.5 ), 2, 2 ); + + } } } diff --git a/kstyle/breezestyle.h b/kstyle/breezestyle.h index d0f6e2b4..9773d35f 100644 --- a/kstyle/breezestyle.h +++ b/kstyle/breezestyle.h @@ -188,6 +188,9 @@ namespace Breeze QRect radioButtonFocusRect( const QStyleOption* option, const QWidget* widget ) const { return checkBoxFocusRect( option, widget ); } + //! line edit contents + QRect lineEditContentsRect( const QStyleOption*, const QWidget* ) const; + //! progressbar groove QRect progressBarGrooveRect( const QStyleOption* option, const QWidget* ) const; @@ -424,7 +427,7 @@ namespace Breeze //@{ //! generic frame - void renderFrame( QPainter*, const QRect&, const QColor& color, const QColor& outline ) const; + void renderFrame( QPainter*, const QRect&, const QColor& color, const QColor& outline, bool focus = false ) const; //! generic button slab void renderButtonSlab( QPainter*, const QRect&, const QColor& color, const QColor& outline, const QColor& shadow, bool focus, bool sunken ) const;