diff --git a/src/plugins/find/searchresulttreeitemdelegate.cpp b/src/plugins/find/searchresulttreeitemdelegate.cpp index 10a04538eceb82e8476f1b0d907ce5e82f275616..35eab26cadcfc73dddffedeeea90423b01684422 100644 --- a/src/plugins/find/searchresulttreeitemdelegate.cpp +++ b/src/plugins/find/searchresulttreeitemdelegate.cpp @@ -91,7 +91,8 @@ int SearchResultTreeItemDelegate::drawLineNumber(QPainter *painter, const QStyle cg = QPalette::Disabled; painter->fillRect(lineNumberAreaRect, QBrush(isSelected ? - option.palette.brush(cg, QPalette::Highlight) : QBrush(qRgb(230, 230, 230)))); + option.palette.brush(cg, QPalette::Highlight) : + option.palette.color(cg, QPalette::Base).darker(111))); painter->setPen(isSelected ? option.palette.color(cg, QPalette::HighlightedText) : Qt::darkGray); painter->drawText(lineNumberAreaRect.adjusted(0, 0, -lineNumberAreaHorizontalPadding, 0), diff --git a/src/plugins/find/searchresulttreemodel.cpp b/src/plugins/find/searchresulttreemodel.cpp index a4fd5e21e3f39df5c80318dc6349ea62694b6d3b..5c3d5eb36abaa5cc593b0774f63c26777537232d 100644 --- a/src/plugins/find/searchresulttreemodel.cpp +++ b/src/plugins/find/searchresulttreemodel.cpp @@ -31,8 +31,10 @@ #include "searchresulttreeitems.h" #include "searchresulttreeitemroles.h" +#include <QtGui/QApplication> #include <QtGui/QFont> #include <QtGui/QColor> +#include <QtGui/QPalette> #include <QtCore/QDir> using namespace Find::Internal; @@ -186,9 +188,11 @@ QVariant SearchResultTreeModel::data(const SearchResultFile *file, int role) con switch (role) { - case Qt::BackgroundRole: - result = QColor(qRgb(245, 245, 245)); + case Qt::BackgroundRole: { + const QColor baseColor = QApplication::palette().base().color(); + result = baseColor.darker(105); break; + } case Qt::DisplayRole: result = QString(QDir::toNativeSeparators(file->fileName()) + " (" + QString::number(file->childrenCount()) + ")"); @@ -212,7 +216,7 @@ QVariant SearchResultTreeModel::data(const SearchResultFile *file, int role) con } QVariant SearchResultTreeModel::headerData(int section, Qt::Orientation orientation, - int role) const + int role) const { Q_UNUSED(section) Q_UNUSED(orientation) @@ -224,7 +228,8 @@ void SearchResultTreeModel::appendResultFile(const QString &fileName) { m_lastAppendedResultFile = new SearchResultFile(fileName, m_rootItem); - beginInsertRows(QModelIndex(), m_rootItem->childrenCount(), m_rootItem->childrenCount()); + const int childrenCount = m_rootItem->childrenCount(); + beginInsertRows(QModelIndex(), childrenCount, childrenCount); m_rootItem->appendChild(m_lastAppendedResultFile); endInsertRows(); } diff --git a/src/plugins/find/searchresulttreeview.cpp b/src/plugins/find/searchresulttreeview.cpp index 49181495a077807d2ba8ea8bd296a53fc5ea41e9..c5317c0fdb7e6107b41dda4b8c052f84e64049a0 100644 --- a/src/plugins/find/searchresulttreeview.cpp +++ b/src/plugins/find/searchresulttreeview.cpp @@ -38,13 +38,13 @@ using namespace Find::Internal; SearchResultTreeView::SearchResultTreeView(QWidget *parent) : QTreeView(parent) + , m_model(new SearchResultTreeModel(this)) , m_autoExpandResults(false) { - m_model = new SearchResultTreeModel(this); setModel(m_model); setItemDelegate(new SearchResultTreeItemDelegate(this)); - setIndentation(14); + setUniformRowHeights(true); header()->hide(); connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(emitJumpToSearchResult(QModelIndex))); diff --git a/src/plugins/find/searchresultwindow.cpp b/src/plugins/find/searchresultwindow.cpp index cdae2e48c7c1c9e02fca3072f8af8fb90cae1e46..6e44c7c8a944dee86f4b3da5f631e23491a1785b 100644 --- a/src/plugins/find/searchresultwindow.cpp +++ b/src/plugins/find/searchresultwindow.cpp @@ -51,7 +51,6 @@ SearchResultWindow::SearchResultWindow() m_widget->setWindowTitle(name()); m_searchResultTreeView = new SearchResultTreeView(m_widget); - m_searchResultTreeView->setUniformRowHeights(true); m_searchResultTreeView->setFrameStyle(QFrame::NoFrame); m_searchResultTreeView->setAttribute(Qt::WA_MacShowFocusRect, false); m_widget->addWidget(m_searchResultTreeView);