1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

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.
This commit is contained in:
David Rosca 2018-02-06 15:29:12 +01:00
parent 6c94d40187
commit 43fa19121a
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 11 additions and 1 deletions

View File

@ -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());
}

View File

@ -53,6 +53,7 @@ private:
DelegateButton buttonAt(const QPoint &pos, const QModelIndex &index) const;
void updateVisibility();
void updateHeight();
BrowserWindow *m_window;
TabListDelegate *m_delegate;