mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
Merge bitcoin-core/gui#365: Draw "eye" sign at the beginning of watch-only addresses
cd46c11577
qt: Draw "eye" sign at the beginning of watch-only addresses (Hennadii Stepanov)9ea1da6fc9
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 https://github.com/bitcoin-core/gui/issues/373 ACKs for top commit: jarolrod: ACKcd46c11577
Tree-SHA512: 0602b5bb65d53c5b18e86260750006bba03adbae181917b5a2b7f89b17290bd1f57b4f80adaba32f42cc6fb468598a888b12c0b6b09005d2f2c07bd4d1ad334a
This commit is contained in:
commit
484d4ee226
1 changed files with 10 additions and 11 deletions
|
@ -69,19 +69,17 @@ public:
|
||||||
foreground = brush.color();
|
foreground = brush.color();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (index.data(TransactionTableModel::WatchonlyRole).toBool()) {
|
||||||
|
QIcon iconWatchonly = qvariant_cast<QIcon>(index.data(TransactionTableModel::WatchonlyDecorationRole));
|
||||||
|
QRect watchonlyRect(addressRect.left(), addressRect.top(), 16, addressRect.height());
|
||||||
|
iconWatchonly = platformStyle->TextColorIcon(iconWatchonly);
|
||||||
|
iconWatchonly.paint(painter, watchonlyRect);
|
||||||
|
addressRect.setLeft(addressRect.left() + watchonlyRect.width() + 5);
|
||||||
|
}
|
||||||
|
|
||||||
painter->setPen(foreground);
|
painter->setPen(foreground);
|
||||||
QRect boundingRect;
|
QRect boundingRect;
|
||||||
painter->drawText(addressRect, Qt::AlignLeft | Qt::AlignVCenter, address, &boundingRect);
|
painter->drawText(addressRect, Qt::AlignLeft | Qt::AlignVCenter, address, &boundingRect);
|
||||||
int address_rect_min_width = boundingRect.width();
|
|
||||||
|
|
||||||
if (index.data(TransactionTableModel::WatchonlyRole).toBool())
|
|
||||||
{
|
|
||||||
QIcon iconWatchonly = qvariant_cast<QIcon>(index.data(TransactionTableModel::WatchonlyDecorationRole));
|
|
||||||
QRect watchonlyRect(boundingRect.right() + 5, mainRect.top()+ypad+halfheight, 16, halfheight);
|
|
||||||
iconWatchonly = platformStyle->TextColorIcon(iconWatchonly);
|
|
||||||
iconWatchonly.paint(painter, watchonlyRect);
|
|
||||||
address_rect_min_width += 5 + watchonlyRect.width();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(amount < 0)
|
if(amount < 0)
|
||||||
{
|
{
|
||||||
|
@ -109,7 +107,8 @@ public:
|
||||||
QRect date_bounding_rect;
|
QRect date_bounding_rect;
|
||||||
painter->drawText(amountRect, Qt::AlignLeft | Qt::AlignVCenter, GUIUtil::dateTimeStr(date), &date_bounding_rect);
|
painter->drawText(amountRect, Qt::AlignLeft | Qt::AlignVCenter, GUIUtil::dateTimeStr(date), &date_bounding_rect);
|
||||||
|
|
||||||
const int minimum_width = std::max(address_rect_min_width, amount_bounding_rect.width() + date_bounding_rect.width());
|
// 0.4*date_bounding_rect.width() is used to visually distinguish a date from an amount.
|
||||||
|
const int minimum_width = 1.4 * date_bounding_rect.width() + amount_bounding_rect.width();
|
||||||
const auto search = m_minimum_width.find(index.row());
|
const auto search = m_minimum_width.find(index.row());
|
||||||
if (search == m_minimum_width.end() || search->second != minimum_width) {
|
if (search == m_minimum_width.end() || search->second != minimum_width) {
|
||||||
m_minimum_width[index.row()] = minimum_width;
|
m_minimum_width[index.row()] = minimum_width;
|
||||||
|
|
Loading…
Add table
Reference in a new issue