diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2007-11-06 00:26:18 (GMT) |
---|---|---|
committer | Clinton Stimpson <clinton@elemtech.com> | 2007-11-06 00:26:18 (GMT) |
commit | a7746624e8e8ac29ea3db21d30746b0e70c7cb1c (patch) | |
tree | d0df0682c7f98ac6400cdf49875464515c609d43 /Source/QtDialog/QCMakeCacheView.cxx | |
parent | c0108d1e07903af49c136217026a2fca082fbb1f (diff) | |
download | CMake-a7746624e8e8ac29ea3db21d30746b0e70c7cb1c.zip CMake-a7746624e8e8ac29ea3db21d30746b0e70c7cb1c.tar.gz CMake-a7746624e8e8ac29ea3db21d30746b0e70c7cb1c.tar.bz2 |
ENH: Replace prompt for generator with combobox in UI.
ENH: Make "Show Advanced" toggle work.
ENH: Add regex search capabilities.
ENH: Read existing registry entries from MFC CMakeSetup.exe (will save later).
Diffstat (limited to 'Source/QtDialog/QCMakeCacheView.cxx')
-rw-r--r-- | Source/QtDialog/QCMakeCacheView.cxx | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 9b732e8..07b70af 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -26,12 +26,20 @@ #include <QStyle> #include <QKeyEvent> +static QRegExp AdvancedRegExp[2] = { QRegExp("(false)"), QRegExp("(true|false)") }; + QCMakeCacheView::QCMakeCacheView(QWidget* p) : QTableView(p), Init(false) { - // hook up our model - QCMakeCacheModel* m = new QCMakeCacheModel(this); - this->setModel(m); + // hook up our model and search/filter proxies + this->CacheModel = new QCMakeCacheModel(this); + this->AdvancedFilter = new QSortFilterProxyModel(this); + this->AdvancedFilter->setSourceModel(this->CacheModel); + this->AdvancedFilter->setFilterRole(QCMakeCacheModel::AdvancedRole); + this->AdvancedFilter->setFilterRegExp(AdvancedRegExp[0]); + this->SearchFilter = new QSortFilterProxyModel(this); + this->SearchFilter->setSourceModel(this->AdvancedFilter); + this->setModel(this->SearchFilter); // our delegate for creating our editors QCMakeCacheModelDelegate* delegate = new QCMakeCacheModelDelegate(this); @@ -61,7 +69,7 @@ void QCMakeCacheView::showEvent(QShowEvent* e) QCMakeCacheModel* QCMakeCacheView::cacheModel() const { - return qobject_cast<QCMakeCacheModel*>(this->model()); + return this->CacheModel; } QModelIndex QCMakeCacheView::moveCursor(CursorAction act, @@ -97,6 +105,22 @@ QModelIndex QCMakeCacheView::moveCursor(CursorAction act, } return QTableView::moveCursor(act, mod); } + +void QCMakeCacheView::setShowAdvanced(bool s) +{ + this->AdvancedFilter->setFilterRegExp( + s ? AdvancedRegExp[1] : AdvancedRegExp[0]); +} + +bool QCMakeCacheView::showAdvanced() const +{ + return this->AdvancedFilter->filterRegExp() == AdvancedRegExp[1]; +} + +void QCMakeCacheView::setSearchFilter(const QString& s) +{ + this->SearchFilter->setFilterRegExp(s); +} QCMakeCacheModel::QCMakeCacheModel(QObject* p) : QAbstractTableModel(p), NewCount(0), IsDirty(false) |