Skip to content
Snippets Groups Projects
Commit 9018f5d3 authored by Jarek Kobus's avatar Jarek Kobus Committed by Jarek Kobus
Browse files

Make the width of details button dependent on its text

Task-number: QTCREATORBUG-5311

Change-Id: Ib50dfcb54f2cd23094ca51f2e5ce10890c92a732
Reviewed-on: http://codereview.qt.nokia.com/1166


Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@nokia.com>
parent 339f6160
No related branches found
No related tags found
No related merge requests found
......@@ -80,10 +80,11 @@ DetailsButton::DetailsButton(QWidget *parent) : QAbstractButton(parent), m_fader
QSize DetailsButton::sizeHint() const
{
// TODO: Adjust this when icons become available!
const int w = fontMetrics().width(text()) + 32;
#ifdef Q_WS_MAC
return QSize(80, 34);
return QSize(w, 34);
#else
return QSize(80, 22);
return QSize(w, 22);
#endif
}
......@@ -171,6 +172,7 @@ QPixmap DetailsButton::cacheRendering(const QSize &size, bool checked)
QRect textRect = p.fontMetrics().boundingRect(text());
textRect.setWidth(textRect.width() + 15);
textRect.setHeight(textRect.height() + 4);
textRect.moveCenter(rect().center());
p.drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, text());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment