Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

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

Fix layout of resolution selection

Summary:
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: https://phabricator.kde.org/D14326
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
layout->setMargin(0);
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) {
mCurrentLabel->setText(Utils::sizeToString(mModes.first()));
} 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);
mSlider->setTickInterval(1);
mSlider->setTickPosition(QSlider::TicksBelow);
......
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