From 4dd828a35061db430bd638858305bc8b66870037 Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Thu, 15 Oct 2009 15:52:21 +0200 Subject: [PATCH] QuickOpenModel --> LocatorModel --- src/plugins/quickopen/locatorwidget.cpp | 24 ++++++++++++------------ src/plugins/quickopen/locatorwidget.h | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/plugins/quickopen/locatorwidget.cpp b/src/plugins/quickopen/locatorwidget.cpp index 8cfa1364adf..61679cb0616 100644 --- a/src/plugins/quickopen/locatorwidget.cpp +++ b/src/plugins/quickopen/locatorwidget.cpp @@ -74,10 +74,10 @@ namespace QuickOpen { namespace Internal { /*! A model to represent the QuickOpen results. */ -class QuickOpenModel : public QAbstractListModel +class LocatorModel : public QAbstractListModel { public: - QuickOpenModel(QObject *parent = 0) + LocatorModel(QObject *parent = 0) : QAbstractListModel(parent) // , mDisplayCount(64) {} @@ -124,12 +124,12 @@ QT_END_NAMESPACE // =========== QuickOpenModel =========== -int QuickOpenModel::rowCount(const QModelIndex & /* parent */) const +int LocatorModel::rowCount(const QModelIndex & /* parent */) const { return mEntries.size(); } -int QuickOpenModel::columnCount(const QModelIndex &parent) const +int LocatorModel::columnCount(const QModelIndex &parent) const { return parent.isValid() ? 0 : 2; } @@ -140,7 +140,7 @@ int QuickOpenModel::columnCount(const QModelIndex &parent) const * FilterEntry::resolveFileIcon is true. FilterEntry::internalData is assumed * to be the filename. */ -QVariant QuickOpenModel::data(const QModelIndex &index, int role) const +QVariant LocatorModel::data(const QModelIndex &index, int role) const { if (!index.isValid() || index.row() >= mEntries.size()) return QVariant(); @@ -168,7 +168,7 @@ QVariant QuickOpenModel::data(const QModelIndex &index, int role) const return QVariant(); } -void QuickOpenModel::setEntries(const QList<FilterEntry> &entries) +void LocatorModel::setEntries(const QList<FilterEntry> &entries) { mEntries = entries; reset(); @@ -248,7 +248,7 @@ void CompletionList::updatePreferredSize() LocatorWidget::LocatorWidget(LocatorPlugin *qop) : m_locatorPlugin(qop), - m_quickOpenModel(new QuickOpenModel(this)), + m_locatorModel(new LocatorModel(this)), m_completionList(new CompletionList(this)), m_filterMenu(new QMenu(this)), m_refreshAction(new QAction(tr("Refresh"), this)), @@ -283,7 +283,7 @@ LocatorWidget::LocatorWidget(LocatorPlugin *qop) : m_fileLineEdit->installEventFilter(this); this->installEventFilter(this); - m_completionList->setModel(m_quickOpenModel); + m_completionList->setModel(m_locatorModel); m_completionList->header()->resizeSection(0, 300); m_completionList->updatePreferredSize(); m_completionList->resize(m_completionList->preferredSize()); @@ -412,9 +412,9 @@ void LocatorWidget::updateCompletionList(const QString &text) alreadyAdded.insert(entry); } } - m_quickOpenModel->setEntries(entries); - if (m_quickOpenModel->rowCount() > 0) { - m_completionList->setCurrentIndex(m_quickOpenModel->index(0, 0)); + m_locatorModel->setEntries(entries); + if (m_locatorModel->rowCount() > 0) { + m_completionList->setCurrentIndex(m_locatorModel->index(0, 0)); } #if 0 m_completionList->updatePreferredSize(); @@ -428,7 +428,7 @@ void LocatorWidget::acceptCurrentEntry() const QModelIndex index = m_completionList->currentIndex(); if (!index.isValid()) return; - const FilterEntry entry = m_quickOpenModel->data(index, Qt::UserRole).value<FilterEntry>(); + const FilterEntry entry = m_locatorModel->data(index, Qt::UserRole).value<FilterEntry>(); m_completionList->hide(); entry.filter->accept(entry); } diff --git a/src/plugins/quickopen/locatorwidget.h b/src/plugins/quickopen/locatorwidget.h index 35216616619..f259d85e165 100644 --- a/src/plugins/quickopen/locatorwidget.h +++ b/src/plugins/quickopen/locatorwidget.h @@ -50,7 +50,7 @@ namespace Utils { namespace QuickOpen { namespace Internal { -class QuickOpenModel; +class LocatorModel; class CompletionList; class LocatorWidget @@ -82,7 +82,7 @@ private: QList<ILocatorFilter*> filtersFor(const QString &text, QString &searchText); LocatorPlugin *m_locatorPlugin; - QuickOpenModel *m_quickOpenModel; + LocatorModel *m_locatorModel; CompletionList *m_completionList; QMenu *m_filterMenu; -- GitLab