mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
Merge bitcoin-core/gui#618: refactor: Add transactionoverviewwidget.cpp
source file
a50e0b1bcb
qt, refactor: Add `transactionoverviewwidget.cpp` source file (Hennadii Stepanov) Pull request description: The `TransactionOverviewWidget` class was added in bitcoin-core/gui#176 as a header-only one. Apparently, in upcoming [CMake project](https://github.com/hebasto/bitcoin/pull/3), CMake [AUTOMOC](https://cmake.org/cmake/help/latest/prop_tgt/AUTOMOC.html) could be integrated better/simpler, if `QObject`-derived class implementation been placed into a source file. From our [Developer Notes](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#source-code-organization): > Implementation code should go into the `.cpp` file and not the `.h`, unless necessary due to template usage or when performance due to inlining is critical. ACKs for top commit: Sjors: tACKa50e0b1bcb
shaavan: ACKa50e0b1bcb
Tree-SHA512: 4707b6be1c5e794c4014475f826ac45ec833e472db11f12d29995f9c5a599ee98622ad54f0af72734b192144b626411c69acdafa0e6d1a390bdebfd7e570f377
This commit is contained in:
commit
26ec2f2d6b
@ -53,6 +53,7 @@
|
||||
<ClCompile Include="..\..\src\qt\transactiondesc.cpp" />
|
||||
<ClCompile Include="..\..\src\qt\transactiondescdialog.cpp" />
|
||||
<ClCompile Include="..\..\src\qt\transactionfilterproxy.cpp" />
|
||||
<ClCompile Include="..\..\src\qt\transactionoverviewwidget.cpp" />
|
||||
<ClCompile Include="..\..\src\qt\transactionrecord.cpp" />
|
||||
<ClCompile Include="..\..\src\qt\transactiontablemodel.cpp" />
|
||||
<ClCompile Include="..\..\src\qt\transactionview.cpp" />
|
||||
|
@ -270,6 +270,7 @@ BITCOIN_QT_WALLET_CPP = \
|
||||
qt/transactiondesc.cpp \
|
||||
qt/transactiondescdialog.cpp \
|
||||
qt/transactionfilterproxy.cpp \
|
||||
qt/transactionoverviewwidget.cpp \
|
||||
qt/transactionrecord.cpp \
|
||||
qt/transactiontablemodel.cpp \
|
||||
qt/transactionview.cpp \
|
||||
|
27
src/qt/transactionoverviewwidget.cpp
Normal file
27
src/qt/transactionoverviewwidget.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
// 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.
|
||||
|
||||
#include <qt/transactionoverviewwidget.h>
|
||||
|
||||
#include <qt/transactiontablemodel.h>
|
||||
|
||||
#include <QListView>
|
||||
#include <QSize>
|
||||
#include <QSizePolicy>
|
||||
|
||||
TransactionOverviewWidget::TransactionOverviewWidget(QWidget* parent)
|
||||
: QListView(parent) {}
|
||||
|
||||
QSize TransactionOverviewWidget::sizeHint() const
|
||||
{
|
||||
return {sizeHintForColumn(TransactionTableModel::ToAddress), QListView::sizeHint().height()};
|
||||
}
|
||||
|
||||
void TransactionOverviewWidget::showEvent(QShowEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QSizePolicy sp = sizePolicy();
|
||||
sp.setHorizontalPolicy(QSizePolicy::Minimum);
|
||||
setSizePolicy(sp);
|
||||
}
|
@ -5,11 +5,8 @@
|
||||
#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;
|
||||
@ -21,21 +18,11 @@ 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()};
|
||||
}
|
||||
explicit TransactionOverviewWidget(QWidget* parent = nullptr);
|
||||
QSize sizeHint() const override;
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent* event) override
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QSizePolicy sp = sizePolicy();
|
||||
sp.setHorizontalPolicy(QSizePolicy::Minimum);
|
||||
setSizePolicy(sp);
|
||||
}
|
||||
void showEvent(QShowEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_TRANSACTIONOVERVIEWWIDGET_H
|
||||
|
Loading…
Reference in New Issue
Block a user