|
|
|
|
@ -441,12 +441,8 @@ namespace Breeze |
|
|
|
|
// draw caption
|
|
|
|
|
painter->setFont(s->font()); |
|
|
|
|
const auto cR = captionRect(); |
|
|
|
|
const QString caption = cR.second ? |
|
|
|
|
painter->fontMetrics().elidedText(c->caption(), Qt::ElideMiddle, cR.first.width()): |
|
|
|
|
c->caption(); |
|
|
|
|
|
|
|
|
|
painter->setPen(m_colorSettings.font(c->isActive())); |
|
|
|
|
painter->drawText(cR.first, Qt::AlignVCenter| Qt::AlignLeft | Qt::TextSingleLine, caption); |
|
|
|
|
painter->drawText(cR, Qt::AlignCenter| Qt::AlignLeft | Qt::TextSingleLine | Qt::ElideMiddle, c->caption()); |
|
|
|
|
|
|
|
|
|
// draw all buttons
|
|
|
|
|
m_leftButtons->paint(painter, repaintRegion); |
|
|
|
|
@ -473,7 +469,7 @@ namespace Breeze |
|
|
|
|
{ return borderTop() - settings()->smallSpacing()*(Metrics::TitleBar_BottomMargin + Metrics::TitleBar_TopMargin ) - 1; } |
|
|
|
|
|
|
|
|
|
//________________________________________________________________
|
|
|
|
|
QPair<QRect,bool> Decoration::captionRect() const |
|
|
|
|
QRect Decoration::captionRect() const |
|
|
|
|
{ |
|
|
|
|
const int leftOffset = m_leftButtons->geometry().x() + m_leftButtons->geometry().width() + Metrics::TitleBar_SideMargin*settings()->smallSpacing(); |
|
|
|
|
const int rightOffset = size().width() - m_rightButtons->geometry().x() + Metrics::TitleBar_SideMargin*settings()->smallSpacing(); |
|
|
|
|
@ -483,9 +479,6 @@ namespace Breeze |
|
|
|
|
boundingRect.setTop( yOffset ); |
|
|
|
|
boundingRect.setHeight( captionHeight() ); |
|
|
|
|
|
|
|
|
|
// store original width to detect when text ellision is needed
|
|
|
|
|
const int boundingRectWidth( boundingRect.width() ); |
|
|
|
|
|
|
|
|
|
switch( m_internalSettings->titleAlignment() ) |
|
|
|
|
{ |
|
|
|
|
case Breeze::InternalSettings::AlignLeft: |
|
|
|
|
@ -520,7 +513,7 @@ namespace Breeze |
|
|
|
|
boundingRect.setLeft( qMax( boundingRect.left(), leftOffset ) ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return qMakePair( boundingRect, boundingRect.width() < boundingRectWidth ); |
|
|
|
|
return boundingRect; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|