mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-23 03:58:56 -04:00
Refactored ContentManager click signal handler
Handler is now a slot function instead of a lambda.
This commit is contained in:
parent
a4194cebbf
commit
2f4a36f0ff
@ -19,17 +19,7 @@ ContentManagerView::ContentManagerView(QWidget *parent)
|
||||
loader = new KiwixLoader(mp_ui->loading);
|
||||
mp_ui->stackedWidget->setCurrentIndex(0);
|
||||
|
||||
connect(mp_ui->m_view, &QTreeView::clicked, [=](QModelIndex index) {
|
||||
if (index.column() == (mp_ui->m_view->model()->columnCount() - 1))
|
||||
return;
|
||||
|
||||
auto zeroColIndex = index.siblingAtColumn(0);
|
||||
if (mp_ui->m_view->isExpanded(zeroColIndex)) {
|
||||
mp_ui->m_view->collapse(zeroColIndex);
|
||||
} else {
|
||||
mp_ui->m_view->expand(zeroColIndex);
|
||||
}
|
||||
});
|
||||
connect(mp_ui->m_view, &QTreeView::clicked, this, &ContentManagerView::onClicked);
|
||||
}
|
||||
|
||||
ContentManagerView::~ContentManagerView()
|
||||
@ -46,3 +36,16 @@ void ContentManagerView::showLoader(bool show)
|
||||
loader->stopAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
void ContentManagerView::onClicked(QModelIndex index)
|
||||
{
|
||||
if (index.column() == (mp_ui->m_view->model()->columnCount() - 1))
|
||||
return;
|
||||
|
||||
auto zeroColIndex = index.siblingAtColumn(0);
|
||||
if (mp_ui->m_view->isExpanded(zeroColIndex)) {
|
||||
mp_ui->m_view->collapse(zeroColIndex);
|
||||
} else {
|
||||
mp_ui->m_view->expand(zeroColIndex);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void showLoader(bool show);
|
||||
void onClicked(QModelIndex index);
|
||||
|
||||
private:
|
||||
Ui::contentmanagerview *mp_ui;
|
||||
|
Loading…
x
Reference in New Issue
Block a user