mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-20 11:49:07 +02:00
Use flexible font size for QRCode image address
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user