From 1d64b9bb10e90a0c6a1053a3a41614caf0e0f8e4 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Thu, 3 Dec 2020 20:06:11 +0200 Subject: 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. --- src/search/dolphinsearchbox.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/search') 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); -- cgit v1.3