qt: Add TransactionOverviewWidget class

pull/20983/head
Hennadii Stepanov 4 years ago
parent 9c3765ad7c
commit d439921406
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

@ -78,6 +78,7 @@ QT_MOC_CPP = \
qt/moc_transactiondesc.cpp \ qt/moc_transactiondesc.cpp \
qt/moc_transactiondescdialog.cpp \ qt/moc_transactiondescdialog.cpp \
qt/moc_transactionfilterproxy.cpp \ qt/moc_transactionfilterproxy.cpp \
qt/moc_transactionoverviewwidget.cpp \
qt/moc_transactiontablemodel.cpp \ qt/moc_transactiontablemodel.cpp \
qt/moc_transactionview.cpp \ qt/moc_transactionview.cpp \
qt/moc_utilitydialog.cpp \ qt/moc_utilitydialog.cpp \
@ -151,6 +152,7 @@ BITCOIN_QT_H = \
qt/transactiondesc.h \ qt/transactiondesc.h \
qt/transactiondescdialog.h \ qt/transactiondescdialog.h \
qt/transactionfilterproxy.h \ qt/transactionfilterproxy.h \
qt/transactionoverviewwidget.h \
qt/transactionrecord.h \ qt/transactionrecord.h \
qt/transactiontablemodel.h \ qt/transactiontablemodel.h \
qt/transactionview.h \ qt/transactionview.h \

@ -504,7 +504,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QListView" name="listTransactions"> <widget class="TransactionOverviewWidget" name="listTransactions">
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">QListView { background: transparent; }</string> <string notr="true">QListView { background: transparent; }</string>
</property> </property>
@ -520,6 +520,9 @@
<property name="selectionMode"> <property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum> <enum>QAbstractItemView::NoSelection</enum>
</property> </property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -544,6 +547,13 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>TransactionOverviewWidget</class>
<extends>QListView</extends>
<header>qt/transactionoverviewwidget.h</header>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

@ -12,6 +12,7 @@
#include <qt/optionsmodel.h> #include <qt/optionsmodel.h>
#include <qt/platformstyle.h> #include <qt/platformstyle.h>
#include <qt/transactionfilterproxy.h> #include <qt/transactionfilterproxy.h>
#include <qt/transactionoverviewwidget.h>
#include <qt/transactiontablemodel.h> #include <qt/transactiontablemodel.h>
#include <qt/walletmodel.h> #include <qt/walletmodel.h>
@ -136,7 +137,7 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent)
ui->listTransactions->setMinimumHeight(NUM_ITEMS * (DECORATION_SIZE + 2)); ui->listTransactions->setMinimumHeight(NUM_ITEMS * (DECORATION_SIZE + 2));
ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false); ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false);
connect(ui->listTransactions, &QListView::clicked, this, &OverviewPage::handleTransactionClicked); connect(ui->listTransactions, &TransactionOverviewWidget::clicked, this, &OverviewPage::handleTransactionClicked);
// start with displaying the "out of sync" warnings // start with displaying the "out of sync" warnings
showOutOfSyncWarning(true); showOutOfSyncWarning(true);

@ -0,0 +1,41 @@
// Copyright (c) 2021 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_TRANSACTIONOVERVIEWWIDGET_H
#define BITCOIN_QT_TRANSACTIONOVERVIEWWIDGET_H
#include <qt/transactiontablemodel.h>
#include <QListView>
#include <QSize>
#include <QSizePolicy>
QT_BEGIN_NAMESPACE
class QShowEvent;
class QWidget;
QT_END_NAMESPACE
class TransactionOverviewWidget : public QListView
{
Q_OBJECT
public:
explicit TransactionOverviewWidget(QWidget* parent = nullptr) : QListView(parent) {}
QSize sizeHint() const override
{
return {sizeHintForColumn(TransactionTableModel::ToAddress), QListView::sizeHint().height()};
}
protected:
void showEvent(QShowEvent* event) override
{
Q_UNUSED(event);
QSizePolicy sp = sizePolicy();
sp.setHorizontalPolicy(QSizePolicy::Minimum);
setSizePolicy(sp);
}
};
#endif // BITCOIN_QT_TRANSACTIONOVERVIEWWIDGET_H
Loading…
Cancel
Save