From 43fa19121a271dde2366e4347781457e606350e7 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 6 Feb 2018 15:29:12 +0100 Subject: [PATCH] VerticalTabs: Make it possible to change height of pinned tab view Same as TabTreeView, TabListView uses font metrics to calculate height. Themes can change it with "font-size" property. --- src/plugins/VerticalTabs/tablistview.cpp | 11 ++++++++++- src/plugins/VerticalTabs/tablistview.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/plugins/VerticalTabs/tablistview.cpp b/src/plugins/VerticalTabs/tablistview.cpp index 99f2980c7..67864b711 100644 --- a/src/plugins/VerticalTabs/tablistview.cpp +++ b/src/plugins/VerticalTabs/tablistview.cpp @@ -45,7 +45,7 @@ TabListView::TabListView(BrowserWindow *window, QWidget *parent) m_delegate = new TabListDelegate(this); setItemDelegate(m_delegate); - setFixedHeight(m_delegate->sizeHint(viewOptions(), QModelIndex()).height()); + updateHeight(); } bool TabListView::isHidingWhenEmpty() const @@ -212,6 +212,11 @@ bool TabListView::viewportEvent(QEvent *event) menu.exec(ce->globalPos()); break; } + + case QEvent::StyleChange: + updateHeight(); + break; + default: break; } @@ -231,3 +236,7 @@ void TabListView::updateVisibility() setVisible(!m_hideWhenEmpty || model()->rowCount() > 0); } +void TabListView::updateHeight() +{ + setFixedHeight(m_delegate->sizeHint(viewOptions(), QModelIndex()).height()); +} diff --git a/src/plugins/VerticalTabs/tablistview.h b/src/plugins/VerticalTabs/tablistview.h index 2c649628a..2c648cee7 100644 --- a/src/plugins/VerticalTabs/tablistview.h +++ b/src/plugins/VerticalTabs/tablistview.h @@ -53,6 +53,7 @@ private: DelegateButton buttonAt(const QPoint &pos, const QModelIndex &index) const; void updateVisibility(); + void updateHeight(); BrowserWindow *m_window; TabListDelegate *m_delegate;