dfaure requested changes to this revision.
dfaure added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> kwidgetitemdelegatetest.cpp:254
> +#else
> +        int widthUninstall = 
> QApplication::style()->sizeFromContents(QStyle::CT_ToolButton, 
> &toolButtonOpt, 
> QSize(option.fontMetrics.horizontalAdvance(QStringLiteral("Uninstall")) + 
> HARDCODED_BORDER * 3, option.fontMetrics.height()), toolButton).width();
> +#endif

I think the whole point of the name horizontalAdvance() is that characters can 
actually be drawn outside of that width. I guess boundingRect().width() is a 
better port for width() in general.

Heh actually I just read the documentation for width and it agrees with that.

So yes this is a "same behaviour" port, but the whole point of the renaming is 
to make us realize these things. Sometimes horizontalAdvance is correct (like 
in kwordwrap.cpp, where they get added together), sometimes boundingRect is 
what we need, like here when it's to resize something and make sure all the 
pixels fit.

REPOSITORY
  R276 KItemViews

REVISION DETAIL
  https://phabricator.kde.org/D19431

To: mlaurent, dfaure
Cc: kde-frameworks-devel, michaelh, ngraham, bruns

Reply via email to