From kde-commits Tue Feb 19 18:53:13 2008 From: Urs Wolfer Date: Tue, 19 Feb 2008 18:53:13 +0000 To: kde-commits Subject: branches/KDE/4.0/kdelibs/kdeui/widgets Message-Id: <1203447193.305015.29722.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=120344720506659 SVN commit 777102 by uwolfer: Backport: SVN commit 777098 by uwolfer: Properly initialize the QStyleOptionFrame. That's why this protected function is there in QLineEdit. Fixes margin problems with Oxygen style and works also fine with Plastique. M +2 -5 klineedit.cpp --- branches/KDE/4.0/kdelibs/kdeui/widgets/klineedit.cpp #777101:777102 @@ -1558,12 +1558,9 @@ // qlineedit uses an internal qstyleoption set to figure this out // and then adds a hardcoded 2 pixel interior to that. // probably requires fixes to Qt itself to do this cleanly + // see define horizontalMargin 2 in qlineedit.cpp QStyleOptionFrame opt; - opt.init( this ); - opt.rect = contentsRect(); - opt.lineWidth = hasFrame() ? style()->pixelMetric( QStyle::PM_DefaultFrameWidth ) : 0; - opt.midLineWidth = 0; - opt.state |= QStyle::State_Sunken; + initStyleOption( &opt ); QRect cr = style()->subElementRect( QStyle::SE_LineEditContents, &opt, this ); cr.setLeft( cr.left() + 2 ); cr.setRight( cr.right() - 2 );