Index: kdevplatform/vcs/dvcs/ui/branchmanager.h =================================================================== --- kdevplatform/vcs/dvcs/ui/branchmanager.h +++ kdevplatform/vcs/dvcs/ui/branchmanager.h @@ -27,6 +27,8 @@ namespace Ui { class BranchDialogBase; } +class QSortFilterProxyModel; + namespace KDevelop { class BranchesListModel; @@ -58,6 +60,7 @@ Ui::BranchDialogBase* m_ui; KDevelop::BranchesListModel* m_model; + QSortFilterProxyModel* m_filterModel; }; #endif Index: kdevplatform/vcs/dvcs/ui/branchmanager.cpp =================================================================== --- kdevplatform/vcs/dvcs/ui/branchmanager.cpp +++ kdevplatform/vcs/dvcs/ui/branchmanager.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include using namespace KDevelop; @@ -65,7 +66,20 @@ m_model = new BranchesListModel(this); m_model->initialize(m_dvcPlugin, QUrl::fromLocalFile(repository)); - m_ui->branchView->setModel(m_model); + + // Filter Model + m_filterModel = new QSortFilterProxyModel(); + m_filterModel->setSourceModel(m_model); + m_filterModel->setFilterWildcard(QString()); + m_filterModel->sort(0, Qt::AscendingOrder); + + //Changes in filter edit trigger filtering + connect(m_ui->branchFilterEdit, + &QLineEdit::textChanged, + m_filterModel, + &QSortFilterProxyModel::setFilterWildcard); + + m_ui->branchView->setModel(m_filterModel); QString branchName = m_model->currentBranch(); // apply initial selection Index: kdevplatform/vcs/dvcs/ui/branchmanager.ui =================================================================== --- kdevplatform/vcs/dvcs/ui/branchmanager.ui +++ kdevplatform/vcs/dvcs/ui/branchmanager.ui @@ -23,7 +23,7 @@ 0 - + @@ -144,12 +144,26 @@ - - - - QAbstractItemView::EditKeyPressed - - + + + + + + + + + Search... + + + + + + + QAbstractItemView::EditKeyPressed + + + +