┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAhmad Samir <[email protected]>2020-12-03 20:06:11 +0200
committerAhmad Samir <[email protected]>2020-12-03 19:50:04 +0000
commit1d64b9bb10e90a0c6a1053a3a41614caf0e0f8e4 (patch)
tree604d650c815330b50d1193c65f82a6777ad7c3ed /src
parent134464177513cba0bb5e2f64875688f70e9a622b (diff)
DolphinView: set the parent of layout in the ctor
This silences a runtime warning: QLayout: Attempting to add QLayout "" to DolphinView "", which already has a layout Remove redudant setLayout() calls, passing a parent widget to the Q*BoxLayout ctor sets that layout as the top-level layout for that widget.
Diffstat (limited to 'src')
-rw-r--r--src/search/dolphinsearchbox.cpp11
-rw-r--r--src/settings/general/configurepreviewplugindialog.cpp1
-rw-r--r--src/settings/viewpropertiesdialog.cpp5
-rw-r--r--src/settings/viewpropsprogressinfo.cpp1
-rw-r--r--src/views/dolphinview.cpp5
5 files changed, 8 insertions, 15 deletions
diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp
index 16f12b989..9143ddcb7 100644
--- a/src/search/dolphinsearchbox.cpp
+++ b/src/search/dolphinsearchbox.cpp
@@ -416,8 +416,12 @@ void DolphinSearchBox::init()
m_facetsWidget->layout()->setSpacing(Dolphin::LAYOUT_SPACING_SMALL);
connect(m_facetsWidget, &DolphinFacetsWidget::facetChanged, this, &DolphinSearchBox::slotFacetChanged);
+ // Put the options into a QScrollArea. This prevents increasing the view width
+ // in case that not enough width for the options is available.
+ QWidget* optionsContainer = new QWidget(this);
+
// Apply layout for the options
- QHBoxLayout* optionsLayout = new QHBoxLayout();
+ QHBoxLayout* optionsLayout = new QHBoxLayout(optionsContainer);
optionsLayout->setContentsMargins(0, 0, 0, 0);
optionsLayout->setSpacing(Dolphin::LAYOUT_SPACING_SMALL);
optionsLayout->addWidget(m_fileNameButton);
@@ -429,11 +433,6 @@ void DolphinSearchBox::init()
optionsLayout->addWidget(moreSearchToolsButton);
optionsLayout->addStretch(1);
- // Put the options into a QScrollArea. This prevents increasing the view width
- // in case that not enough width for the options is available.
- QWidget* optionsContainer = new QWidget(this);
- optionsContainer->setLayout(optionsLayout);
-
m_optionsScrollArea = new QScrollArea(this);
m_optionsScrollArea->setFrameShape(QFrame::NoFrame);
m_optionsScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
diff --git a/src/settings/general/configurepreviewplugindialog.cpp b/src/settings/general/configurepreviewplugindialog.cpp
index d29b63b7d..4d7ee589a 100644
--- a/src/settings/general/configurepreviewplugindialog.cpp
+++ b/src/settings/general/configurepreviewplugindialog.cpp
@@ -38,7 +38,6 @@ ConfigurePreviewPluginDialog::ConfigurePreviewPluginDialog(const QString& plugin
setMinimumWidth(400);
auto layout = new QVBoxLayout(this);
- setLayout(layout);
if (previewPlugin) {
auto configurationWidget = previewPlugin->createConfigurationWidget();
diff --git a/src/settings/viewpropertiesdialog.cpp b/src/settings/viewpropertiesdialog.cpp
index c6dbc82b4..2bf317440 100644
--- a/src/settings/viewpropertiesdialog.cpp
+++ b/src/settings/viewpropertiesdialog.cpp
@@ -64,7 +64,6 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
auto layout = new QFormLayout(this);
// Otherwise the dialog won't resize when we collapse the KCollapsibleGroupBox.
layout->setSizeConstraint(QLayout::SetFixedSize);
- setLayout(layout);
// create 'Properties' group containing view mode, sorting, sort order and show hidden files
m_viewMode = new QComboBox();
@@ -89,7 +88,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
auto additionalInfoBox = new KCollapsibleGroupBox();
additionalInfoBox->setTitle(i18nc("@title:group", "Additional Information"));
- auto innerLayout = new QVBoxLayout();
+ auto innerLayout = new QVBoxLayout(additionalInfoBox);
{
QList<QByteArray> visibleRoles = m_viewProps->visibleRoles();
@@ -133,8 +132,6 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
innerLayout->addWidget(m_listWidget);
}
- additionalInfoBox->setLayout(innerLayout);
-
QHBoxLayout* sortingLayout = new QHBoxLayout();
sortingLayout->setContentsMargins(0, 0, 0, 0);
sortingLayout->addWidget(m_sortOrder);
diff --git a/src/settings/viewpropsprogressinfo.cpp b/src/settings/viewpropsprogressinfo.cpp
index 57a00c2b1..cd4ff379c 100644
--- a/src/settings/viewpropsprogressinfo.cpp
+++ b/src/settings/viewpropsprogressinfo.cpp
@@ -44,7 +44,6 @@ ViewPropsProgressInfo::ViewPropsProgressInfo(QWidget* parent,
m_viewProps->setAutoSaveEnabled(false);
auto layout = new QVBoxLayout(this);
- setLayout(layout);
m_label = new QLabel(i18nc("@info:progress", "Counting folders: %1", 0), this);
layout->addWidget(m_label);
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index ef346b3e4..71c16bf46 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -140,9 +140,8 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
m_placeholderLabel->setGraphicsEffect(effect);
// Set initial text and visibility
updatePlaceholderLabel();
- // Add a new layout to hold it and put it in the layout
- auto *centeringLayout = new QVBoxLayout(this);
- m_container->setLayout(centeringLayout);
+
+ auto *centeringLayout = new QVBoxLayout(m_container);
centeringLayout->addWidget(m_placeholderLabel);
centeringLayout->setAlignment(m_placeholderLabel, Qt::AlignCenter);