Skip to content

Commit 484d4ee

Browse files
committed
Merge bitcoin-core/gui#365: Draw "eye" sign at the beginning of watch-only addresses
cd46c11 qt: Draw "eye" sign at the beginning of watch-only addresses (Hennadii Stepanov) 9ea1da6 qt: Do not extend recent transaction width to address/label string (Hennadii Stepanov) Pull request description: This PR guaranties that the "eye" sign won't be hidden for very long addresses/labels. No longer need to extend `TransactionOverviewWidget` widget width to make "eye" signs shown: ![Screenshot from 2021-06-15 00-21-05](https://user-images.githubusercontent.com/32963518/121961807-9123b600-cd70-11eb-8cdd-8b2b0d1bf44f.png) Fixes bitcoin-core/gui#373 ACKs for top commit: jarolrod: ACK cd46c11 Tree-SHA512: 0602b5bb65d53c5b18e86260750006bba03adbae181917b5a2b7f89b17290bd1f57b4f80adaba32f42cc6fb468598a888b12c0b6b09005d2f2c07bd4d1ad334a
2 parents 2711559 + cd46c11 commit 484d4ee

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/qt/overviewpage.cpp

+9-10
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,18 @@ class TxViewDelegate : public QAbstractItemDelegate
6969
foreground = brush.color();
7070
}
7171

72-
painter->setPen(foreground);
73-
QRect boundingRect;
74-
painter->drawText(addressRect, Qt::AlignLeft | Qt::AlignVCenter, address, &boundingRect);
75-
int address_rect_min_width = boundingRect.width();
76-
77-
if (index.data(TransactionTableModel::WatchonlyRole).toBool())
78-
{
72+
if (index.data(TransactionTableModel::WatchonlyRole).toBool()) {
7973
QIcon iconWatchonly = qvariant_cast<QIcon>(index.data(TransactionTableModel::WatchonlyDecorationRole));
80-
QRect watchonlyRect(boundingRect.right() + 5, mainRect.top()+ypad+halfheight, 16, halfheight);
74+
QRect watchonlyRect(addressRect.left(), addressRect.top(), 16, addressRect.height());
8175
iconWatchonly = platformStyle->TextColorIcon(iconWatchonly);
8276
iconWatchonly.paint(painter, watchonlyRect);
83-
address_rect_min_width += 5 + watchonlyRect.width();
77+
addressRect.setLeft(addressRect.left() + watchonlyRect.width() + 5);
8478
}
8579

80+
painter->setPen(foreground);
81+
QRect boundingRect;
82+
painter->drawText(addressRect, Qt::AlignLeft | Qt::AlignVCenter, address, &boundingRect);
83+
8684
if(amount < 0)
8785
{
8886
foreground = COLOR_NEGATIVE;
@@ -109,7 +107,8 @@ class TxViewDelegate : public QAbstractItemDelegate
109107
QRect date_bounding_rect;
110108
painter->drawText(amountRect, Qt::AlignLeft | Qt::AlignVCenter, GUIUtil::dateTimeStr(date), &date_bounding_rect);
111109

112-
const int minimum_width = std::max(address_rect_min_width, amount_bounding_rect.width() + date_bounding_rect.width());
110+
// 0.4*date_bounding_rect.width() is used to visually distinguish a date from an amount.
111+
const int minimum_width = 1.4 * date_bounding_rect.width() + amount_bounding_rect.width();
113112
const auto search = m_minimum_width.find(index.row());
114113
if (search == m_minimum_width.end() || search->second != minimum_width) {
115114
m_minimum_width[index.row()] = minimum_width;

0 commit comments

Comments
 (0)