Commit bab7c809 authored by Nikita Baryshnikov's avatar Nikita Baryshnikov Committed by Orgad Shaneh

SearchResultWidget: unclutter namespaces

replace Q_ASSERT with QTC_ASSERT and be more consistent with asserts

Change-Id: I81161a1ee82218ef23f62cc90e52587c342e2e22
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent 9dd457a6
......@@ -39,6 +39,8 @@
#include <aggregation/aggregate.h>
#include <coreplugin/coreplugin.h>
#include <utils/qtcassert.h>
#include <utils/theme/theme.h>
#include <QDir>
......@@ -76,12 +78,6 @@ public slots:
void updateGeometry() { QLineEdit::updateGeometry(); }
};
} // namespace Internal
} // namespace Core
using namespace Core;
using namespace Core::Internal;
SearchResultWidget::SearchResultWidget(QWidget *parent) :
QWidget(parent),
m_count(0),
......@@ -140,7 +136,7 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
layout->addWidget(m_messageWidget);
m_messageWidget->setVisible(false);
m_searchResultTreeView = new Internal::SearchResultTreeView(this);
m_searchResultTreeView = new SearchResultTreeView(this);
m_searchResultTreeView->setFrameStyle(QFrame::NoFrame);
m_searchResultTreeView->setAttribute(Qt::WA_MacShowFocusRect, false);
Aggregation::Aggregate * agg = new Aggregation::Aggregate;
......@@ -497,15 +493,16 @@ void SearchResultWidget::searchAgain()
QList<SearchResultItem> SearchResultWidget::checkedItems() const
{
QList<SearchResultItem> result;
Internal::SearchResultTreeModel *model = m_searchResultTreeView->model();
const int fileCount = model->rowCount(QModelIndex());
SearchResultTreeModel *model = m_searchResultTreeView->model();
const int fileCount = model->rowCount();
for (int i = 0; i < fileCount; ++i) {
QModelIndex fileIndex = model->index(i, 0, QModelIndex());
Internal::SearchResultTreeItem *fileItem = static_cast<Internal::SearchResultTreeItem *>(fileIndex.internalPointer());
Q_ASSERT(fileItem != 0);
QModelIndex fileIndex = model->index(i, 0);
SearchResultTreeItem *fileItem = static_cast<SearchResultTreeItem *>(fileIndex.internalPointer());
QTC_ASSERT(fileItem != 0, continue);
for (int rowIndex = 0; rowIndex < fileItem->childrenCount(); ++rowIndex) {
QModelIndex textIndex = model->index(rowIndex, 0, fileIndex);
Internal::SearchResultTreeItem *rowItem = static_cast<Internal::SearchResultTreeItem *>(textIndex.internalPointer());
SearchResultTreeItem *rowItem = static_cast<SearchResultTreeItem *>(textIndex.internalPointer());
QTC_ASSERT(rowItem != 0, continue);
if (rowItem->checkState())
result << rowItem->item;
}
......@@ -521,4 +518,7 @@ void SearchResultWidget::updateMatchesFoundLabel()
m_matchesFoundLabel->setText(tr("%n matches found.", 0, m_count));
}
} // namespace Internal
} // namespace Core
#include "searchresultwidget.moc"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment