Commit ed64dbc7 authored by Ismael Asensio's avatar Ismael Asensio
Browse files

IconView: Fix header padding

We weren't setting the vertical spacing for the page's GridLayout,
so it took the standard 6px causing this extra padding on top and
bottom for every KCM.

Better apply this margins to the title widget which is only shown
for iconview.

The horizontal spacing is not needed, so that part can be simplified.

BUG: 449040
FIXED-IN: 5.24
parent f92b8fb2
Pipeline #131708 passed with stage
in 52 seconds
......@@ -283,22 +283,18 @@ void ModuleView::updatePageIconHeader(KPageWidgetItem *page)
page->setIcon(QIcon::fromTheme(moduleProxy->metaData().iconName()));
const bool isQml = moduleProxy->realModule() && moduleProxy->realModule()->inherits("KCModuleQml");
QGridLayout *gridLayout = static_cast<QGridLayout *>(d->mPageWidget->layout());
if (isQml) {
// QML KCM: We don't use any widgets header
d->mCustomHeader->setVisible(false);
page->setHeaderVisible(false);
gridLayout->setHorizontalSpacing(0);
} else if (faceType() == KPageView::Plain) {
// QWidgets KCM on Sidebar mode: Use the custom header
d->mCustomHeader->setVisible(true);
page->setHeaderVisible(false);
gridLayout->setHorizontalSpacing(0);
} else {
// QWidgets KCM on Icons mode: Use the module's header
d->mCustomHeader->setVisible(false);
page->setHeaderVisible(true);
gridLayout->setHorizontalSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
}
}
......@@ -433,6 +429,13 @@ void ModuleView::activeModuleChanged(KPageWidgetItem *current, KPageWidgetItem *
0, // Remove extra space between KCM content and bottom buttons
style()->pixelMetric(QStyle::PM_LayoutRightMargin),
style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
d->mPageWidget->layout()->setSpacing(0);
if (auto titleWidget = qobject_cast<KTitleWidget *>(d->mPageWidget->pageHeader())) {
titleWidget->layout()->setContentsMargins(style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
style()->pixelMetric(QStyle::PM_LayoutRightMargin),
style()->pixelMetric(QStyle::PM_LayoutRightMargin),
style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
}
updatePageIconHeader(current);
moduleShowDefaultsIndicators(d->mDefaultsIndicatorsVisible);
......
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