[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/apps/dolphin/src/search
From:       Peter Penz <peter.penz19 () gmail ! com>
Date:       2011-01-23 15:03:52
Message-ID: 20110123150352.427AFAC8BB () svn ! kde ! org
[Download RAW message or body]

SVN commit 1216467 by ppenz:

Prevent that the view is forced to increase its width when the searching is enabled \
and not enough width is available for all options.


 M  +15 -1     dolphinsearchbox.cpp  


--- trunk/KDE/kdebase/apps/dolphin/src/search/dolphinsearchbox.cpp #1216466:1216467
@@ -34,6 +34,7 @@
 #include <QKeyEvent>
 #include <QLabel>
 #include <QPushButton>
+#include <QScrollArea>
 #include <QTimer>
 #include <QToolButton>
 #include <QVBoxLayout>
@@ -299,9 +300,22 @@
     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();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic