v30.3-roots.1 · Commit 44: [PATCH 44/68] fix(qt): preserve QString size types when wrapping QR labels
src/qt/qrimagewidget.cpp
Before: src/qt/qrimagewidget.cpp · After: src/qt/qrimagewidget.cpp
File metadata
index 916e9aa292168c93f9703890d527ed7ccc9e436f..4da6359723e7fa165e544ff0717c7679c1ddae8a 100644
Download original patch · Release notes
Diff rows 1–11 of 11. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
src/qt/qrimagewidget.cpp
CHANGED
|
@@ -98,8 +98,9 @@ bool QRImageWidget::setQR(const QString& data, const QString& text, const QFont&
|
|
| 98 |
QRect padded_rect{qrAddrImage.rect()};
|
| 99 |
padded_rect.setHeight(padded_rect.height() - QR_IMAGE_TEXT_MARGIN);
|
| 100 |
QString text_wrapped{text};
|
| 101 |
-
const int chars_per_line{(text.size() + text_lines - 1) / text_lines};
|
| 102 |
-
for (int line{1}, pos{0}; line < text_lines; ++line) {
|
|
|
|
| 103 |
pos += chars_per_line;
|
| 104 |
text_wrapped.insert(pos, QChar{'\n'});
|
| 105 |
}
|
|
|
|
| 98 |
QRect padded_rect{qrAddrImage.rect()};
|
| 99 |
padded_rect.setHeight(padded_rect.height() - QR_IMAGE_TEXT_MARGIN);
|
| 100 |
QString text_wrapped{text};
|
| 101 |
+
const auto chars_per_line{(text.size() + text_lines - 1) / text_lines};
|
| 102 |
+
decltype(text.size()) pos{0};
|
| 103 |
+
for (int line{1}; line < text_lines; ++line) {
|
| 104 |
pos += chars_per_line;
|
| 105 |
text_wrapped.insert(pos, QChar{'\n'});
|
| 106 |
}
|