Use fixed width for digital clock applet

Review Request #127102 - Created Feb. 17, 2016 and submitted

Daniel Faust
kde-workspace, plasma

Currently the width of the date label is not fixed but changes depending on the text. This causes the entire applet to change its width (if the time is the widest displayed item). This in turn can cause all other applets in the same panel to move whenever the displayed time changes.

This patch uses FontMetrics to iterate over all possible time strings (with different width) and chooses the widest of them as reference for the fixed width of the time label.

This way the width of the applet stays the same (unless the date is displayed and changes). The text remains centered though, which means that it can still move within the applet when the time changes.

Works with horizontal and vertical panel.
Also displaying different combinations of "seconds", "date" and "timezone" works.



  • 0
  • 2
  • 1
  • 3
Description From Last Updated
Daniel Faust
David Edmundson
David Edmundson
Daniel Faust
Daniel Faust
Martin Klapetek
Daniel Faust
Martin Klapetek
Daniel Faust
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted with commit e7f09ba1eb976c4f282145016d34fe87de515a25 by Daniel Faust to branch master.