Skip to content

Commit 92a0234

Browse files
fanquakeComputerCraftr
authored andcommitted
Merge bitcoin/bitcoin#22427: [0.21] gui: Backports for 0.21.2
e3f1da4bf3db120cc691a844d612fbc522f11fb9 qt: Draw "eye" sign at the beginning of watch-only addresses (Hennadii Stepanov) 6ca54ce2ae0808513172c4945e38165e766e1381 qt: Do not extend recent transaction width to address/label string (Hennadii Stepanov) f220368220abb11040fa944a853cda3d4f1fe84d qt: Do not use QClipboard::Selection on Windows and macOS. (Hennadii Stepanov) Pull request description: Backports bitcoin-core/gui#277, bitcoin-core/gui#365. ACKs for top commit: fanquake: ACK e3f1da4bf3db120cc691a844d612fbc522f11fb9 jarolrod: ACK e3f1da4bf3db120cc691a844d612fbc522f11fb9 Tree-SHA512: 43cc2ac48f4e5014bfdbe86cc904bb36d2be9fcd257f0fc0800c384bd727bb98466723e450a8909b06708784ad91184be599c49cf60de2e4377202774cb878f6
1 parent c9a1232 commit 92a0234

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

src/qt/guiutil.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -734,8 +734,11 @@ bool SetStartOnSystemStartup(bool fAutoStart) { return false; }
734734

735735
void setClipboard(const QString& str)
736736
{
737-
QApplication::clipboard()->setText(str, QClipboard::Clipboard);
738-
QApplication::clipboard()->setText(str, QClipboard::Selection);
737+
QClipboard* clipboard = QApplication::clipboard();
738+
clipboard->setText(str, QClipboard::Clipboard);
739+
if (clipboard->supportsSelection()) {
740+
clipboard->setText(str, QClipboard::Selection);
741+
}
739742
}
740743

741744
fs::path qstringToBoostPath(const QString &path)

src/qt/overviewpage.cpp

+9-10
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,17 @@ class TxViewDelegate : public QAbstractItemDelegate
6868
foreground = brush.color();
6969
}
7070

71-
painter->setPen(foreground);
72-
QRect boundingRect;
73-
painter->drawText(addressRect, Qt::AlignLeft | Qt::AlignVCenter, address, &boundingRect);
74-
int address_rect_min_width = boundingRect.width();
75-
76-
if (index.data(TransactionTableModel::WatchonlyRole).toBool())
77-
{
71+
if (index.data(TransactionTableModel::WatchonlyRole).toBool()) {
7872
QIcon iconWatchonly = qvariant_cast<QIcon>(index.data(TransactionTableModel::WatchonlyDecorationRole));
79-
QRect watchonlyRect(boundingRect.right() + 5, mainRect.top()+ypad+halfheight, 16, halfheight);
73+
QRect watchonlyRect(addressRect.left(), addressRect.top(), 16, addressRect.height());
8074
iconWatchonly.paint(painter, watchonlyRect);
81-
address_rect_min_width += 5 + watchonlyRect.width();
75+
addressRect.setLeft(addressRect.left() + watchonlyRect.width() + 5);
8276
}
8377

78+
painter->setPen(foreground);
79+
QRect boundingRect;
80+
painter->drawText(addressRect, Qt::AlignLeft | Qt::AlignVCenter, address, &boundingRect);
81+
8482
if(amount < 0)
8583
{
8684
foreground = COLOR_NEGATIVE;
@@ -107,7 +105,8 @@ class TxViewDelegate : public QAbstractItemDelegate
107105
QRect date_bounding_rect;
108106
painter->drawText(amountRect, Qt::AlignLeft | Qt::AlignVCenter, GUIUtil::dateTimeStr(date), &date_bounding_rect);
109107

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

0 commit comments

Comments
 (0)