diff --git a/kdecoration/breezedecoration.cpp b/kdecoration/breezedecoration.cpp index f6330652..430b157b 100644 --- a/kdecoration/breezedecoration.cpp +++ b/kdecoration/breezedecoration.cpp @@ -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 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; } diff --git a/kdecoration/breezedecoration.h b/kdecoration/breezedecoration.h index ccdc6a67..705984ac 100644 --- a/kdecoration/breezedecoration.h +++ b/kdecoration/breezedecoration.h @@ -110,12 +110,8 @@ namespace Breeze private: - /** - return the smallest rect in which caption will be drawn, - properly positionned inside the title bar. Second return parameter - is set to true when text ellision is required - */ - QPair captionRect() const; + //* return the rect in which caption will be drawn + QRect captionRect() const; void createButtons(); void paintTitleBar(QPainter *painter, const QRect &repaintRegion);