Skip to content

Commit

Permalink
qt: Do not extend recent transaction width to address/label string
Browse files Browse the repository at this point in the history
Github-Pull: bitcoin-core/gui#365
Rebased-From: 9ea1da6
  • Loading branch information
hebasto committed Jul 11, 2021
1 parent f220368 commit 6ca54ce
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/qt/overviewpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,12 @@ class TxViewDelegate : public QAbstractItemDelegate
painter->setPen(foreground);
QRect 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.paint(painter, watchonlyRect);
address_rect_min_width += 5 + watchonlyRect.width();
}

if(amount < 0)
Expand Down Expand Up @@ -107,7 +105,8 @@ class TxViewDelegate : public QAbstractItemDelegate
QRect 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());
if (search == m_minimum_width.end() || search->second != minimum_width) {
m_minimum_width[index.row()] = minimum_width;
Expand Down

0 comments on commit 6ca54ce

Please sign in to comment.