From: Peter Penz Date: Sun, 23 Jan 2011 15:03:52 +0000 (+0000) Subject: Prevent that the view is forced to increase its width when the searching is enabled... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/20664d8b723a093b5af359212bf550d63bcac1cb?ds=inline Prevent that the view is forced to increase its width when the searching is enabled and not enough width is available for all options. svn path=/trunk/KDE/kdebase/apps/; revision=1216467 --- diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index bc1445cb7..039c16ded 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -299,9 +300,22 @@ void DolphinSearchBox::init() optionsLayout->addWidget(m_everywhereButton); 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); + QScrollArea* optionsScrollArea = new QScrollArea(this); + optionsScrollArea->setFrameShape(QFrame::NoFrame); + optionsScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + optionsScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + optionsScrollArea->setMaximumHeight(optionsContainer->sizeHint().height()); + optionsScrollArea->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + optionsScrollArea->setWidget(optionsContainer); + optionsScrollArea->setWidgetResizable(true); + m_topLayout = new QVBoxLayout(this); m_topLayout->addLayout(searchInputLayout); - m_topLayout->addLayout(optionsLayout); + m_topLayout->addWidget(optionsScrollArea); searchLabel->setBuddy(m_searchInput); loadSettings();