diff options
author | lbartoletti <l.bartoletti@free.fr> | 2019-10-22 21:07:16 +0200 |
---|---|---|
committer | lbartoletti <l.bartoletti@free.fr> | 2019-10-22 21:07:16 +0200 |
commit | 7e07c3980607d8c6e394520ea2e5ea37cb8860b7 (patch) | |
tree | 7600ec29bfb937bcf2148a8a02772127fcd27013 /src-qt5/core/lumina-desktop-unified | |
parent | fix lumina-screenshot/MainUI.cpp (diff) | |
download | lumina-7e07c3980607d8c6e394520ea2e5ea37cb8860b7.tar.gz lumina-7e07c3980607d8c6e394520ea2e5ea37cb8860b7.tar.bz2 lumina-7e07c3980607d8c6e394520ea2e5ea37cb8860b7.zip |
fontMetrics().width -> fontMetrics().horizontalAdvance
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified')
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h | 6 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h index 95b6c1cb..6a33605c 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h @@ -33,8 +33,8 @@ private slots: //Note: This is horribly inefficient, but due to the inherently short length of textL it is acceptable int min = -1; int index = -1; for(int i=1; i<textL.length(); i++){ - int combined = button->fontMetrics().width(textL[i-1]+" "+textL[i]); - int tmp = button->fontMetrics().width(textL[i]); + int combined = button->fontMetrics().horizontalAdvance(textL[i-1]+" "+textL[i]); + int tmp = button->fontMetrics().horizontalAdvance(textL[i]); if( max>combined && (min<0 || tmp<min)){ min = tmp; index = i; } } if(index>0){ textL[index-1] = textL[index-1]+" "+textL[index]; textL.removeAt(index); } @@ -43,7 +43,7 @@ private slots: //Need to get a lot more complicated - need to break up sections mid-word based on widget width // NOT WORKING - can cause infinite loop somehow (perhaps max is 0 on init?) /*for(int i=0; i<textL.length(); i++){ - int tmp = button->fontMetrics().width(textL[i]); + int tmp = button->fontMetrics().horizontalAdvance(textL[i]); if(tmp>max){ //qDebug() << "CLOCK:" << i << tmp << max << textL[i]; QString tmps = button->fontMetrics().elidedText(textL[i], Qt::ElideRight, max).section("...",0,-2); //remove the three dots at end diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h index 6ba18b22..bdde5ba2 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h @@ -50,7 +50,7 @@ public: text->setFont(QFont("Courier", 24, QFont::Bold)); text->setText(display); QFontMetrics metrics(text->font()); - text->setMinimumSize(QSize( metrics.width(text->text())+10, metrics.height()*text->text().count("\n") +10)); + text->setMinimumSize(QSize( metrics.horizontalAdvance(text->text())+10, metrics.height()*text->text().count("\n") +10)); movement = new QPropertyAnimation(text); movement->setPropertyName("pos"); |