From f05793c2e3febd9c605fed63e85590ff749f670e Mon Sep 17 00:00:00 2001 From: Eugene Shalygin Date: Thu, 26 May 2016 17:07:19 +0200 Subject: [PATCH] Use QPalette::LinkVisited color for downloaded items in search results --- src/gui/search/searchtab.cpp | 8 +++++--- src/gui/search/searchtab.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/search/searchtab.cpp b/src/gui/search/searchtab.cpp index 3ead429fb..798663834 100644 --- a/src/gui/search/searchtab.cpp +++ b/src/gui/search/searchtab.cpp @@ -28,6 +28,7 @@ * Contact : chris@qbittorrent.org */ +#include #include #include #include @@ -35,6 +36,7 @@ #include #include #include +#include #include #ifdef QBT_USES_QT5 #include @@ -133,7 +135,7 @@ void SearchTab::downloadItem(const QModelIndex &index) { QString torrentUrl = m_proxyModel->data(m_proxyModel->index(index.row(), SearchSortModel::DL_LINK)).toString(); QString siteUrl = m_proxyModel->data(m_proxyModel->index(index.row(), SearchSortModel::ENGINE_URL)).toString(); - setRowColor(index.row(), "blue"); + setRowColor(index.row(), QApplication::palette().color(QPalette::LinkVisited)); m_parent->downloadTorrent(siteUrl, torrentUrl); } @@ -173,11 +175,11 @@ QStandardItemModel* SearchTab::getCurrentSearchListModel() const } // Set the color of a row in data model -void SearchTab::setRowColor(int row, QString color) +void SearchTab::setRowColor(int row, const QColor &color) { m_proxyModel->setDynamicSortFilter(false); for (int i = 0; i < m_proxyModel->columnCount(); ++i) - m_proxyModel->setData(m_proxyModel->index(row, i), QVariant(QColor(color)), Qt::ForegroundRole); + m_proxyModel->setData(m_proxyModel->index(row, i), color, Qt::ForegroundRole); m_proxyModel->setDynamicSortFilter(true); } diff --git a/src/gui/search/searchtab.h b/src/gui/search/searchtab.h index 366451112..ac9da1223 100644 --- a/src/gui/search/searchtab.h +++ b/src/gui/search/searchtab.h @@ -76,7 +76,7 @@ public: QHeaderView* header() const; bool loadColWidthResultsList(); - void setRowColor(int row, QString color); + void setRowColor(int row, const QColor &color); enum class Status {