From fb09c266a71d2a4389eace2c1c0fbfd36527c413 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Mon, 20 May 2019 15:03:21 +0200 Subject: [PATCH] VerticalTabs: Corectly recognize tree collapse / expand button Summary: In treeview when the tab has no children the collapse / expand button is not visible but the control logic still thought that is is. By clicking on place where this button normaly is nothing happens and user has to click again somewhere else to change the selected tab. Test Plan: In treeview mode check the function of collapse / expand button when visible and invisible. - Visible: Expand / collapse the tree - Not visible: Select tab Reviewers: #falkon, drosca Reviewed By: #falkon, drosca Subscribers: falkon Tags: #falkon Differential Revision: https://phabricator.kde.org/D21304 --- src/plugins/VerticalTabs/tabtreeview.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/VerticalTabs/tabtreeview.cpp b/src/plugins/VerticalTabs/tabtreeview.cpp index c2168e1c9..06346fa41 100644 --- a/src/plugins/VerticalTabs/tabtreeview.cpp +++ b/src/plugins/VerticalTabs/tabtreeview.cpp @@ -358,7 +358,9 @@ void TabTreeView::initView() TabTreeView::DelegateButton TabTreeView::buttonAt(const QPoint &pos, const QModelIndex &index) const { if (m_delegate->expandButtonRect(index).contains(pos)) { - return ExpandButton; + if (model()->rowCount(index) > 0) { + return ExpandButton; + } } else if (m_delegate->audioButtonRect(index).contains(pos)) { return AudioButton; } else if (m_delegate->closeButtonRect(index).contains(pos)) {