Fix styled vertical dockwidget title cut off bug and elide text if long
Change common stylesheet to elide text correctly for both direction. Change-Id: I045f6f74733ca8fa67b3e4fbb9d3845a1bea777d Task-number: QTBUG-41466 Reviewed-by: Jens Bache-Wiig <jensbw@gmail.com>
This commit is contained in:
parent
c399e4b7ea
commit
3056b825bd
@ -4047,26 +4047,28 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
|
||||
}
|
||||
|
||||
if (!dwOpt->title.isEmpty()) {
|
||||
QRect r = opt->rect;
|
||||
QRect r = subElementRect(SE_DockWidgetTitleBarText, opt, w);
|
||||
if (dwOpt->verticalTitleBar) {
|
||||
QSize s = r.size();
|
||||
s.transpose();
|
||||
r.setSize(s);
|
||||
|
||||
p->save();
|
||||
p->translate(r.left(), r.top() + r.width());
|
||||
p->rotate(-90);
|
||||
p->translate(-r.left(), -r.top());
|
||||
}
|
||||
r = subRule.contentsRect(r);
|
||||
|
||||
Qt::Alignment alignment = 0;
|
||||
if (subRule.hasPosition())
|
||||
alignment = subRule.position()->textAlignment;
|
||||
if (alignment == 0)
|
||||
alignment = Qt::AlignLeft;
|
||||
drawItemText(p, subRule.contentsRect(opt->rect),
|
||||
|
||||
QString titleText = p->fontMetrics().elidedText(dwOpt->title, Qt::ElideRight, r.width());
|
||||
drawItemText(p, r,
|
||||
alignment | Qt::TextShowMnemonic, dwOpt->palette,
|
||||
dwOpt->state & State_Enabled, dwOpt->title,
|
||||
dwOpt->state & State_Enabled, titleText,
|
||||
QPalette::WindowText);
|
||||
|
||||
if (dwOpt->verticalTitleBar)
|
||||
|
Loading…
Reference in New Issue
Block a user