Commit bada915c authored by con's avatar con
Browse files

Fix crash when using settings dialog filter.

Introduced by 773343f3
Need to ensure widget creation when filtering, because the translated
strings from the widgets are used for key words.
parent 77da3923
...@@ -436,6 +436,12 @@ void SettingsDialog::ensureCategoryWidget(Category *category) ...@@ -436,6 +436,12 @@ void SettingsDialog::ensureCategoryWidget(Category *category)
category->index = m_stackedLayout->addWidget(tabWidget); category->index = m_stackedLayout->addWidget(tabWidget);
} }
void SettingsDialog::ensureAllCategoryWidgets()
{
foreach (Category *category, m_model->categories())
ensureCategoryWidget(category);
}
void SettingsDialog::updateEnabledTabs(Category *category, const QString &searchText) void SettingsDialog::updateEnabledTabs(Category *category, const QString &searchText)
{ {
for (int i = 0; i < category->pages.size(); ++i) { for (int i = 0; i < category->pages.size(); ++i) {
...@@ -472,6 +478,7 @@ void SettingsDialog::currentTabChanged(int index) ...@@ -472,6 +478,7 @@ void SettingsDialog::currentTabChanged(int index)
void SettingsDialog::filter(const QString &text) void SettingsDialog::filter(const QString &text)
{ {
ensureAllCategoryWidgets();
// When there is no current index, select the first one when possible // When there is no current index, select the first one when possible
if (!m_categoryList->currentIndex().isValid() && m_model->rowCount() > 0) if (!m_categoryList->currentIndex().isValid() && m_model->rowCount() > 0)
m_categoryList->setCurrentIndex(m_proxyModel->index(0, 0)); m_categoryList->setCurrentIndex(m_proxyModel->index(0, 0));
......
...@@ -94,6 +94,7 @@ private: ...@@ -94,6 +94,7 @@ private:
void showPage(const QString &categoryId, const QString &pageId); void showPage(const QString &categoryId, const QString &pageId);
void updateEnabledTabs(Category *category, const QString &searchText); void updateEnabledTabs(Category *category, const QString &searchText);
void ensureCategoryWidget(Category *category); void ensureCategoryWidget(Category *category);
void ensureAllCategoryWidgets();
const QList<Core::IOptionsPage*> m_pages; const QList<Core::IOptionsPage*> m_pages;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment