Fix crash when using settings dialog filter.

Introduced by 773343f396
Need to ensure widget creation when filtering, because the translated
strings from the widgets are used for key words.
This commit is contained in:
con
2010-12-06 17:38:42 +01:00
parent 77da3923a8
commit bada915c35
2 changed files with 8 additions and 0 deletions

View File

@@ -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)
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));

View File

@@ -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;