D19431: [kitemviews] make it compile without deprecated method

David Faure noreply at phabricator.kde.org
Sat Mar 2 22:49:36 GMT 2019


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190302/aff303f0/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list