Enable single click expansion on Quicktoolbar categories

This commit is contained in:
manongjohn 2021-08-21 13:10:13 -04:00
parent 7f444c8c96
commit db658fddf7
2 changed files with 12 additions and 0 deletions

View file

@ -332,6 +332,9 @@ CommandBarListTree::CommandBarListTree(QWidget* parent) : QTreeWidget(parent) {
CommandBarSeparatorItem* sep = new CommandBarSeparatorItem(0);
sep->setToolTip(0, QObject::tr("[Drag&Drop] to copy separator to toolbar"));
addTopLevelItem(sep);
connect(this, SIGNAL(clicked(const QModelIndex&)), this,
SLOT(onItemClicked(const QModelIndex&)));
}
//-----------------------------------------------------------------------------
@ -457,6 +460,12 @@ void CommandBarListTree::searchItems(const QString& searchWord) {
update();
}
//-----------------------------------------------------------------------------
void CommandBarListTree::onItemClicked(const QModelIndex& index) {
isExpanded(index) ? collapse(index) : expand(index);
}
//=============================================================================
// CommandBarPopup
//-----------------------------------------------------------------------------

View file

@ -52,6 +52,9 @@ public:
void searchItems(const QString& searchWord = QString());
public slots:
void onItemClicked(const QModelIndex&);
private:
void displayAll(QTreeWidgetItem* item);
void hideAll(QTreeWidgetItem* item);