mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Revert "gui: Alternate row background based on txid"
This reverts commit 264f9c4d4f7c1aeb3e89eedddcd88e47e8bba938. This was included in https://github.com/ElementsProject/elements/pull/569/ which received no review, and is a backport of upstream PR https://github.com/bitcoin/bitcoin/pull/12578 which was later closed. It leaks memory which is causing CI to fail.
This commit is contained in:
parent
e5ecee8d2d
commit
f912cb8e2e
1 changed files with 1 additions and 34 deletions
|
|
@ -26,11 +26,9 @@
|
|||
#include <QDoubleValidator>
|
||||
#include <QHBoxLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QItemDelegate>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QMenu>
|
||||
#include <QPainter>
|
||||
#include <QPoint>
|
||||
#include <QScrollBar>
|
||||
#include <QTableView>
|
||||
|
|
@ -38,37 +36,6 @@
|
|||
#include <QUrl>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue