SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), m_pages(sortedOptionsPages()), m_proxyModel(new CategoryFilterModel(this)), m_model(new CategoryModel(this)), m_stackedLayout(new QStackedLayout), m_filterLineEdit(new Utils::FilterLineEdit), m_categoryList(new CategoryListView), m_headerLabel(new QLabel), m_running(false), m_applied(false), m_finished(false) { m_applied = false; createGui(); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); #ifdef Q_OS_MAC setWindowTitle(tr("Preferences")); #else setWindowTitle(tr("Options")); #endif m_model->setPages(m_pages, ExtensionSystem::PluginManager::instance()->getObjects<IOptionsPageProvider>()); m_proxyModel->setSourceModel(m_model); m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_categoryList->setIconSize(QSize(categoryIconSize, categoryIconSize)); m_categoryList->setModel(m_proxyModel); m_categoryList->setSelectionMode(QAbstractItemView::SingleSelection); m_categoryList->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); connect(m_categoryList->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(currentChanged(QModelIndex))); // The order of the slot connection matters here, the filter slot // opens the matching page after the model has filtered. connect(m_filterLineEdit, SIGNAL(filterChanged(QString)), this, SLOT(ensureAllCategoryWidgets())); connect(m_filterLineEdit, SIGNAL(filterChanged(QString)), m_proxyModel, SLOT(setFilterFixedString(QString))); connect(m_filterLineEdit, SIGNAL(filterChanged(QString)), this, SLOT(filter(QString))); m_categoryList->setFocus(); }
SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), m_pages(sortedOptionsPages()), m_proxyModel(new CategoryFilterModel(this)), m_model(new CategoryModel(this)), m_stackedLayout(new QStackedLayout), m_filterLineEdit(new Utils::FancyLineEdit), m_categoryList(new CategoryListView), m_headerLabel(new QLabel), m_running(false), m_applied(false), m_finished(false) { m_applied = false; m_filterLineEdit->setFiltering(true); createGui(); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); if (Utils::HostOsInfo::isMacHost()) setWindowTitle(tr("Preferences")); else setWindowTitle(tr("Options")); m_model->setPages(m_pages, ExtensionSystem::PluginManager::getObjects<IOptionsPageProvider>()); m_proxyModel->setSourceModel(m_model); m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_categoryList->setIconSize(QSize(categoryIconSize, categoryIconSize)); m_categoryList->setModel(m_proxyModel); m_categoryList->setSelectionMode(QAbstractItemView::SingleSelection); m_categoryList->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); connect(m_categoryList->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &SettingsDialog::currentChanged); // The order of the slot connection matters here, the filter slot // opens the matching page after the model has filtered. connect(m_filterLineEdit, &Utils::FancyLineEdit::filterChanged, m_proxyModel, &QSortFilterProxyModel::setFilterFixedString); connect(m_filterLineEdit, &Utils::FancyLineEdit::filterChanged, this, &SettingsDialog::filter); m_categoryList->setFocus(); }