forked from qt-creator/qt-creator
SearchResultWidget: unclutter namespaces
replace Q_ASSERT with QTC_ASSERT and be more consistent with asserts Change-Id: I81161a1ee82218ef23f62cc90e52587c342e2e22 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
9dd457a678
commit
bab7c80976
@@ -39,6 +39,8 @@
|
|||||||
|
|
||||||
#include <aggregation/aggregate.h>
|
#include <aggregation/aggregate.h>
|
||||||
#include <coreplugin/coreplugin.h>
|
#include <coreplugin/coreplugin.h>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/theme/theme.h>
|
#include <utils/theme/theme.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -76,12 +78,6 @@ public slots:
|
|||||||
void updateGeometry() { QLineEdit::updateGeometry(); }
|
void updateGeometry() { QLineEdit::updateGeometry(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Core
|
|
||||||
|
|
||||||
using namespace Core;
|
|
||||||
using namespace Core::Internal;
|
|
||||||
|
|
||||||
SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
m_count(0),
|
m_count(0),
|
||||||
@@ -140,7 +136,7 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
|||||||
layout->addWidget(m_messageWidget);
|
layout->addWidget(m_messageWidget);
|
||||||
m_messageWidget->setVisible(false);
|
m_messageWidget->setVisible(false);
|
||||||
|
|
||||||
m_searchResultTreeView = new Internal::SearchResultTreeView(this);
|
m_searchResultTreeView = new SearchResultTreeView(this);
|
||||||
m_searchResultTreeView->setFrameStyle(QFrame::NoFrame);
|
m_searchResultTreeView->setFrameStyle(QFrame::NoFrame);
|
||||||
m_searchResultTreeView->setAttribute(Qt::WA_MacShowFocusRect, false);
|
m_searchResultTreeView->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
Aggregation::Aggregate * agg = new Aggregation::Aggregate;
|
Aggregation::Aggregate * agg = new Aggregation::Aggregate;
|
||||||
@@ -497,15 +493,16 @@ void SearchResultWidget::searchAgain()
|
|||||||
QList<SearchResultItem> SearchResultWidget::checkedItems() const
|
QList<SearchResultItem> SearchResultWidget::checkedItems() const
|
||||||
{
|
{
|
||||||
QList<SearchResultItem> result;
|
QList<SearchResultItem> result;
|
||||||
Internal::SearchResultTreeModel *model = m_searchResultTreeView->model();
|
SearchResultTreeModel *model = m_searchResultTreeView->model();
|
||||||
const int fileCount = model->rowCount(QModelIndex());
|
const int fileCount = model->rowCount();
|
||||||
for (int i = 0; i < fileCount; ++i) {
|
for (int i = 0; i < fileCount; ++i) {
|
||||||
QModelIndex fileIndex = model->index(i, 0, QModelIndex());
|
QModelIndex fileIndex = model->index(i, 0);
|
||||||
Internal::SearchResultTreeItem *fileItem = static_cast<Internal::SearchResultTreeItem *>(fileIndex.internalPointer());
|
SearchResultTreeItem *fileItem = static_cast<SearchResultTreeItem *>(fileIndex.internalPointer());
|
||||||
Q_ASSERT(fileItem != 0);
|
QTC_ASSERT(fileItem != 0, continue);
|
||||||
for (int rowIndex = 0; rowIndex < fileItem->childrenCount(); ++rowIndex) {
|
for (int rowIndex = 0; rowIndex < fileItem->childrenCount(); ++rowIndex) {
|
||||||
QModelIndex textIndex = model->index(rowIndex, 0, fileIndex);
|
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())
|
if (rowItem->checkState())
|
||||||
result << rowItem->item;
|
result << rowItem->item;
|
||||||
}
|
}
|
||||||
@@ -521,4 +518,7 @@ void SearchResultWidget::updateMatchesFoundLabel()
|
|||||||
m_matchesFoundLabel->setText(tr("%n matches found.", 0, m_count));
|
m_matchesFoundLabel->setText(tr("%n matches found.", 0, m_count));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Core
|
||||||
|
|
||||||
#include "searchresultwidget.moc"
|
#include "searchresultwidget.moc"
|
||||||
|
Reference in New Issue
Block a user