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);
}
void SettingsDialog::ensureAllCategoryWidgets()
{
foreach (Category *category, m_model->categories())
ensureCategoryWidget(category);
}
void SettingsDialog::updateEnabledTabs(Category *category, const QString &searchText)
{
for (int i = 0; i < category->pages.size(); ++i) {
@@ -472,6 +478,7 @@ void SettingsDialog::currentTabChanged(int index)
void SettingsDialog::filter(const QString &text)
{
ensureAllCategoryWidgets();
// When there is no current index, select the first one when possible
if (!m_categoryList->currentIndex().isValid() && m_model->rowCount() > 0)
m_categoryList->setCurrentIndex(m_proxyModel->index(0, 0));