Commit 2b742e25 authored by Jens Bache-Wiig's avatar Jens Bache-Wiig
Browse files

Fix some layout issues with the sidebar

* Minimum width now depends on translated strings
* Missing margin for target name added

Task-number: QTCREATORBUG-468
parent fa537950
......@@ -171,7 +171,8 @@ void FancyToolButton::paintEvent(QPaintEvent *event)
penColor = Qt::gray;
painter.setPen(penColor);
QString ellidedProjectName = fm.elidedText(projectName, Qt::ElideMiddle, r.width() - 6);
const int margin = 6;
QString ellidedProjectName = fm.elidedText(projectName, Qt::ElideMiddle, r.width() - margin);
if (isEnabled()) {
const QRectF shadowR = r.translated(0, 1);
painter.setPen(QColor(30, 30, 30, 80));
......@@ -182,7 +183,7 @@ void FancyToolButton::paintEvent(QPaintEvent *event)
textOffset = iconRect.center() + QPoint(iconRect.width()/2, iconRect.height()/2);
r = QRectF(0, textOffset.y()+5, rect().width(), lineHeight);
painter.setFont(boldFont);
QString ellidedBuildConfiguration = boldFm.elidedText(buildConfiguration, Qt::ElideMiddle, r.width());
QString ellidedBuildConfiguration = boldFm.elidedText(buildConfiguration, Qt::ElideMiddle, r.width() - margin);
if (isEnabled()) {
const QRectF shadowR = r.translated(0, 1);
painter.setPen(QColor(30, 30, 30, 80));
......
......@@ -105,9 +105,14 @@ QSize FancyTabBar::tabSizeHint(bool minimum) const
QFontMetrics fm(boldFont);
int spacing = 8;
int width = 60 + spacing + 2;
int maxLabelwidth = 0;
for (int tab=0 ; tab<count() ;++tab) {
int width = fm.width(tabText(tab));
if (width > maxLabelwidth)
maxLabelwidth = width;
}
int iconHeight = minimum ? 0 : 32;
return QSize(width, iconHeight + spacing + fm.height());
return QSize(qMax(width, maxLabelwidth + 4), iconHeight + spacing + fm.height());
}
void FancyTabBar::paintEvent(QPaintEvent *event)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment