diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 2b99cbc92e..1dfec0a238 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -26,11 +26,9 @@ #include #include #include -#include #include #include #include -#include #include #include #include @@ -38,37 +36,6 @@ #include #include -class TransactionRecordDelegate : public QItemDelegate -{ - QSortFilterProxyModel* m_proxy; - - void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const - { - bool alternate = false; - QVariant previous_hash; - - for (int row = 0; row <= index.row(); ++row) { - QModelIndex sibling = m_proxy->mapToSource(index.sibling(row, 0)); - QVariant hash = sibling.data(TransactionTableModel::TxHashRole); - if (row == 0) { - previous_hash = hash; - } else if (hash != previous_hash) { - alternate = !alternate; - previous_hash = hash; - } - } - - if (alternate) { - painter->fillRect(option.rect, option.palette.alternateBase()); - } - - QItemDelegate::paint(painter, option, index); - } - -public: - TransactionRecordDelegate(QSortFilterProxyModel* proxy) : m_proxy(proxy) {} -}; - TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *parent) : QWidget(parent) { @@ -252,7 +219,7 @@ void TransactionView::setModel(WalletModel *_model) transactionView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); transactionView->setModel(transactionProxyModel); - transactionView->setItemDelegate(new TransactionRecordDelegate(transactionProxyModel)); + transactionView->setAlternatingRowColors(true); transactionView->setSelectionBehavior(QAbstractItemView::SelectRows); transactionView->setSelectionMode(QAbstractItemView::ExtendedSelection); transactionView->horizontalHeader()->setSortIndicator(TransactionTableModel::Date, Qt::DescendingOrder);