]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Prevent that the view is forced to increase its width when the searching is enabled...
authorPeter Penz <peter.penz19@gmail.com>
Sun, 23 Jan 2011 15:03:52 +0000 (15:03 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sun, 23 Jan 2011 15:03:52 +0000 (15:03 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=1216467

src/search/dolphinsearchbox.cpp

index bc1445cb75261df0c5596afc83fad30c019c5b48..039c16dedbc1ef2c48a2d2e26b3f7852a122df20 100644 (file)
@@ -34,6 +34,7 @@
 #include <QKeyEvent>
 #include <QLabel>
 #include <QPushButton>
+#include <QScrollArea>
 #include <QTimer>
 #include <QToolButton>
 #include <QVBoxLayout>
@@ -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();