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/panel-plugins/clock/LClock.cpp | |
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/panel-plugins/clock/LClock.cpp')
-rw-r--r-- | src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp b/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp index 2972ea86..d45853d1 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp @@ -79,7 +79,7 @@ void LClock::updateTime(bool adjustformat){ if( this->layout()->direction() == QBoxLayout::TopToBottom ){ //different routine for vertical text (need newlines instead of spaces) for(int i=0; i<label.count("\n")+1; i++){ - if(this->size().width() < (this->fontMetrics().width(label.section("\n",i,i))+10 )&& label.section("\n",i,i).contains(" ")){ + if(this->size().width() < (this->fontMetrics().horizontalAdvance(label.section("\n",i,i))+10 )&& label.section("\n",i,i).contains(" ")){ label.replace(label.section("\n",i,i), label.section("\n",i,i).replace(" ", "\n")); i--; } @@ -100,12 +100,12 @@ void LClock::updateTime(bool adjustformat){ int wid = 0; int lwid = 0; for(int i=0; i<lines.length(); i++){ - lwid = metrics.width(lines[i]); + lwid = metrics.horizontalAdvance(lines[i]); if(lwid>wid){ wid = lwid; } } qDebug() << "Verify Clock width:" << lines.length() << wid << lines; this->setMinimumWidth(wid); - this->setMaximumWidth(wid + (4*metrics.width("O"))); + this->setMaximumWidth(wid + (4*metrics.horizontalAdvance("O"))); }else{ //vertical layout this->setMinimumHeight(metrics.lineSpacing() * lines.length()); |