Review Request: Fix vertical positionning of "click" message in klineedit

Hugo Pereira Da Costa hugo at oxygen-icons.org
Thu May 20 23:28:33 BST 2010



> On 2010-05-20 22:01:19, Thomas Lübking wrote:
> > /trunk/KDE/kdelibs/kdeui/widgets/klineedit.cpp, line 1739
> > <http://reviewboard.kde.org/r/4042/diff/1/?file=27060#file27060line1739>
> >
> >     cr.adjust(left, top, -right, -bottom);

I agree its more compact :)


> On 2010-05-20 22:01:19, Thomas Lübking wrote:
> > /trunk/KDE/kdelibs/kdeui/widgets/klineedit.cpp, line 1766
> > <http://reviewboard.kde.org/r/4042/diff/1/?file=27060#file27060line1766>
> >
> >     have you tried to just 
> >     cr.setTop(cr.top() + (cr.height() - fm.height()) % 2)
> >     here (or merge it into the above adjustment) and
> >     p.drawText(cr, Qt::AlignLeft|(alignment()&Qt::AlignVertical_Mask) , d->clickMessage);

this "empirically" does not work with even font sizes the same way as "(cr.height() - fm.height() + 1) / 2;", which is used in QLineEdit, hence reintroducing inconsistencies (right ?).

All in all, I agree that the code could be made much more compact. but the idea was rather to stick as close as possible to the QLineEdit::paintEvent code, so that future differences will be easier to track down. 

On the long run: QLineEdit has its own clickMessage (called placeholderText) since Qt4.7.
What we should do is probably wrap KLineEdit::clickMessage around it, without breaking the API. 

My worry is that doing so breaks BC. Plus I think the current Qt's placeHolderText is not drawn in italics. 

What do you think ?


- Hugo


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/4042/#review5741
-----------------------------------------------------------


On 2010-05-19 05:48:15, Hugo Pereira Da Costa wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/4042/
> -----------------------------------------------------------
> 
> (Updated 2010-05-19 05:48:15)
> 
> 
> Review request for kdelibs.
> 
> 
> Summary
> -------
> 
> This patch makes a better job at painting klineEdit 'click' message (e.g. in systemsettings 'search' bar) in a way that is similar to what qlineedit::paintEvent does for normal text. 
> This notably fixes the vertical alignment of the "click" message for some styles, including oxygen (see attached screenshot)
> 
> 
> Diffs
> -----
> 
>   /trunk/KDE/kdelibs/kdeui/widgets/klineedit.cpp 1127445 
> 
> Diff: http://reviewboard.kde.org/r/4042/diff
> 
> 
> Testing
> -------
> 
> Tested with oxygen, plastique, skulpture, and bespin. It was checked that the "click message" is vertically positioned the same as normal text (from user input) is, with all styles 
> 
> 
> Screenshots
> -----------
> 
> vertically centered "click" message in systemsettings
>   http://reviewboard.kde.org/r/4042/s/399/
> 
> 
> Thanks,
> 
> Hugo
> 
>





More information about the kde-core-devel mailing list