aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2021-07-29 11:20:26 +0800
committerfanquake <fanquake@gmail.com>2021-07-29 11:20:57 +0800
commit997e528a34185c68665d10cef43da883934ea03a (patch)
tree9194246a7b610b3a47b2bd074e4312be8dd4a46f
parentbd2f4164c6be0cc20af44c57b93f87c879c97729 (diff)
parente3f1da4bf3db120cc691a844d612fbc522f11fb9 (diff)
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 https://github.com/bitcoin-core/gui/pull/277, https://github.com/bitcoin-core/gui/pull/365. ACKs for top commit: fanquake: ACK e3f1da4bf3db120cc691a844d612fbc522f11fb9 jarolrod: ACK e3f1da4bf3db120cc691a844d612fbc522f11fb9 Tree-SHA512: 43cc2ac48f4e5014bfdbe86cc904bb36d2be9fcd257f0fc0800c384bd727bb98466723e450a8909b06708784ad91184be599c49cf60de2e4377202774cb878f6
-rw-r--r--src/qt/guiutil.cpp7
-rw-r--r--src/qt/overviewpage.cpp19
2 files changed, 14 insertions, 12 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index bab17562a6..cab015bdbe 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -734,8 +734,11 @@ bool SetStartOnSystemStartup(bool fAutoStart) { return false; }
void setClipboard(const QString& str)
{
- QApplication::clipboard()->setText(str, QClipboard::Clipboard);
- QApplication::clipboard()->setText(str, QClipboard::Selection);
+ QClipboard* clipboard = QApplication::clipboard();
+ clipboard->setText(str, QClipboard::Clipboard);
+ if (clipboard->supportsSelection()) {
+ clipboard->setText(str, QClipboard::Selection);
+ }
}
fs::path qstringToBoostPath(const QString &path)
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp
index 6a66584544..dfe8b6f5b0 100644
--- a/src/qt/overviewpage.cpp
+++ b/src/qt/overviewpage.cpp
@@ -68,19 +68,17 @@ public:
foreground = brush.color();
}
- 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())
- {
+ 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);
+ QRect watchonlyRect(addressRect.left(), addressRect.top(), 16, addressRect.height());
iconWatchonly.paint(painter, watchonlyRect);
- address_rect_min_width += 5 + watchonlyRect.width();
+ addressRect.setLeft(addressRect.left() + watchonlyRect.width() + 5);
}
+ painter->setPen(foreground);
+ QRect boundingRect;
+ painter->drawText(addressRect, Qt::AlignLeft | Qt::AlignVCenter, address, &boundingRect);
+
if(amount < 0)
{
foreground = COLOR_NEGATIVE;
@@ -107,7 +105,8 @@ public:
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;