Commit 5b6e9767 authored by Frederik Gladhorn's avatar Frederik Gladhorn
Browse files

Fix layout of resolution selection

When there is only one widget inside the layout, it would have double
margins. In case of the slider, the top and bottom margins are slightly
off (same as before), but at least on the left and right they now fit.

Reviewers: #plasma, #vdg, ngraham

Reviewed By: #vdg, ngraham

Subscribers: andreaska, abetts, ngraham, broulik, zzag, plasma-devel

Tags: #plasma

Differential Revision:
parent 6dd05a59
......@@ -53,6 +53,9 @@ ResolutionSlider::ResolutionSlider(const KScreen::OutputPtr &output, QWidget *pa
qSort(mModes.begin(), mModes.end(), sizeLessThan);
QGridLayout *layout = new QGridLayout(this);
int margin = layout->margin();
// Avoid double margins
if (mModes.count() > 15) {
std::reverse(mModes.begin(), mModes.end());
......@@ -79,6 +82,8 @@ ResolutionSlider::ResolutionSlider(const KScreen::OutputPtr &output, QWidget *pa
} else if (mModes.count() == 1) {
} else {
// No double margins left and right, but they are needed on top and bottom
layout->setContentsMargins(0, margin, 0, margin);
mSlider = new QSlider(Qt::Horizontal, this);
Supports Markdown
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