aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-06-07 20:47:37 -0400
committerKen Moore <ken@ixsystems.com>2017-06-07 20:47:37 -0400
commit344cf8fbc278eadb1a859a2d26b52d48ce6f62bb (patch)
treeb4f6455397500652454120db75fcbb980318429b /src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp
parentCommit some more work-in-progress for the new LuminaRandR class (replacement ... (diff)
downloadlumina-344cf8fbc278eadb1a859a2d26b52d48ce6f62bb.tar.gz
lumina-344cf8fbc278eadb1a859a2d26b52d48ce6f62bb.tar.bz2
lumina-344cf8fbc278eadb1a859a2d26b52d48ce6f62bb.zip
Re-sync the translation files with the latest sources.
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.cpp16
1 files changed, 9 insertions, 7 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 7c059844..bdf9b27e 100644
--- a/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp
+++ b/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp
@@ -88,24 +88,26 @@ void LClock::updateTime(bool adjustformat){
label.replace("\n",", ");
}
if(adjustformat){
+ QFont font = LSession::handle()->font();
+ font.setBold(true);
+ button->setFont(font);
//Check the font/spacing for the display and adjust as necessary
QStringList lines = label.split("/n");
+ QFontMetrics metrics(font);
if(this->layout()->direction()==QBoxLayout::LeftToRight){
//horizontal layout
int wid = 0;
int lwid;
for(int i=0; i<lines.length(); i++){
- lwid = button->fontMetrics().width(lines[i]);
+ lwid = metrics.width(lines[i]);
if(lwid>wid){ wid = lwid; }
}
- if(lines.length()==1){ wid+=6; } //need some extra margins for single-line
- else{ wid-=6; } // need to remove some margins for multi-line
- this->setMinimumWidth( wid - (4*button->fontMetrics().width("O")) );
- this->setMaximumWidth(wid + (4*button->fontMetrics().width("O")));
+ this->setMinimumWidth( wid - (4*metrics.width("O")) );
+ this->setMaximumWidth(wid + (4*metrics.width("O")));
}else{
//vertical layout
- this->setMinimumHeight(button->fontMetrics().lineSpacing() * lines.length());
- this->setMaximumHeight( (lines.length()+4)*button->fontMetrics().height() );
+ this->setMinimumHeight(metrics.lineSpacing() * lines.length());
+ this->setMaximumHeight( (lines.length()+4)*metrics.height() );
}
}
button->setText(label);
bgstack15