Commit 986341a3 authored by George Vogiatzis's avatar George Vogiatzis

[Applet]Fix traffic monitor labels width

Summary:
Use text metrics to set a proper space for labels.
And remove unused plotter width.

Test Plan:
Change default font styles and family.
Change small font size.
Space available must follow the font.

{F8145658}

{F8145661}

Reviewers: #vdg, #plasma, jgrulich, ngraham

Reviewed By: #vdg, jgrulich, ngraham

Subscribers: davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D27792
parent 999f0ad9
......@@ -18,7 +18,7 @@
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.2
import QtQuick 2.4
import org.kde.kcoreaddons 1.0 as KCoreAddons
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
import org.kde.plasma.components 2.0 as PlasmaComponents
......@@ -58,13 +58,12 @@ Item {
readonly property int maxValue: Math.max(Math.max.apply(null, downloadPlotData.values), Math.max.apply(null, uploadPlotData.values))
anchors {
left: parent.left
leftMargin: units.gridUnit * 3
leftMargin: speedMetrics.width + units.smallSpacing * 2
right: parent.right
top: parent.top
// Align plotter lines with labels.
topMargin: Math.round(labels.labelHeight / 2)
}
width: units.gridUnit * 20
height: units.gridUnit * 8
horizontalGridLineCount: 5
......@@ -100,4 +99,11 @@ Item {
}
}
}
TextMetrics {
id: speedMetrics
font.pointSize: theme.smallestFont.pointSize
// Measure 888.8 KiB/s
text: KCoreAddons.Format.formatByteSize(910131) + i18n("/s")
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment