aboutsummaryrefslogtreecommitdiff
path: root/src/qt/guiutil.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2018-01-12 11:09:59 -1000
committerJonas Schnelli <dev@jonasschnelli.ch>2018-01-15 09:33:46 -1000
commit59f9e2aaf3fe73961cc02042f929b430fee59f9c (patch)
tree69ab23e141f12ae3da92b06a6a52a193bb790c39 /src/qt/guiutil.cpp
parent0910cbe4ef31eb95fd76c7c2f820419fe64a3150 (diff)
Use flexible font size for QRCode image address
Diffstat (limited to 'src/qt/guiutil.cpp')
-rw-r--r--src/qt/guiutil.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index 670d6108db..558d4f108c 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -995,6 +995,18 @@ QString formatBytes(uint64_t bytes)
return QString(QObject::tr("%1 GB")).arg(bytes / 1024 / 1024 / 1024);
}
+qreal calculateIdealFontSize(int width, const QString& text, QFont font, qreal minPointSize, qreal font_size) {
+ while(font_size >= minPointSize) {
+ font.setPointSizeF(font_size);
+ QFontMetrics fm(font);
+ if (fm.width(text) < width) {
+ break;
+ }
+ font_size -= 0.5;
+ }
+ return font_size;
+}
+
void ClickableLabel::mouseReleaseEvent(QMouseEvent *event)
{
Q_EMIT clicked(event->pos());