diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-09-26 13:26:03 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-10-03 13:01:12 +0000 |
commit | 114c4593b6950122ad10326903c986647adb2dc0 (patch) | |
tree | e9c12dea7e3dcb3e9d9911528eabd1bbbdc23a9b /src/widgets/widgets/qdockwidget.cpp | |
parent | ddeec1b07edc0f1f225f8dc52efefc2ff63049be (diff) |
Restore styling of QDockWidget title font
Do not override a custom font with the style default.
Task-number: QTBUG-70276
Change-Id: I58bf43f791aee5409e29459d579725365703e4f3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/widgets/qdockwidget.cpp')
-rw-r--r-- | src/widgets/widgets/qdockwidget.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 0b2eee7180..6c871aae2c 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -696,7 +696,6 @@ void QDockWidget::initStyleOption(QStyleOptionDockWidget *option) const // If we are in a floating tab, init from the parent because the attributes and the geometry // of the title bar should be taken from the floating window. option->initFrom(floatingTab && !isFloating() ? parentWidget() : this); - option->fontMetrics = QFontMetrics(d->font); option->rect = dwlayout->titleArea(); option->title = d->fixedWindowTitle; option->closable = hasFeature(this, QDockWidget::DockWidgetClosable); @@ -1473,6 +1472,7 @@ void QDockWidget::closeEvent(QCloseEvent *event) void QDockWidget::paintEvent(QPaintEvent *event) { Q_UNUSED(event) + Q_D(QDockWidget); QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(this->layout()); @@ -1493,7 +1493,11 @@ void QDockWidget::paintEvent(QPaintEvent *event) // the title may wish to extend out to all sides (eg. Vista style) QStyleOptionDockWidget titleOpt; initStyleOption(&titleOpt); - p.setFont(d_func()->font); + if (font() == QApplication::font("QDockWidget")) { + titleOpt.fontMetrics = QFontMetrics(d->font); + p.setFont(d->font); + } + p.drawControl(QStyle::CE_DockWidgetTitle, titleOpt); } } |