Fix hiding entry edit pages

Fixes regression caused by 9477437256
This commit is contained in:
Toni Spets 2020-01-28 20:42:36 +02:00 committed by Jonathan White
parent e85854aa24
commit cb6b0dde27

View File

@ -70,7 +70,16 @@ void EditWidget::addPage(const QString& labelText, const QIcon& icon, QWidget* w
void EditWidget::setPageHidden(QWidget* widget, bool hidden)
{
int index = m_ui->stackedWidget->indexOf(widget);
int index = -1;
for (int i = 0; i < m_ui->stackedWidget->count(); i++) {
auto* scrollArea = qobject_cast<QScrollArea*>(m_ui->stackedWidget->widget(i));
if (scrollArea != nullptr && scrollArea->widget() == widget) {
index = i;
break;
}
}
if (index != -1) {
m_ui->categoryList->setCategoryHidden(index, hidden);
}