Fix the height of the new search result pane.

For the bigger search filters like C++ Symbols & Files on File System
it was unusable e.g. on Mac.

Change-Id: I1839238660cc7508ada4e580388ee08d8eca8a6a
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
Eike Ziller
2011-12-06 16:57:09 +01:00
parent 0840b93ff5
commit b0b0842b03
3 changed files with 107 additions and 83 deletions

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>673</width>
<height>210</height>
<height>240</height>
</rect>
</property>
<property name="maximumSize">
@@ -17,28 +17,53 @@
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item row="4" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="searchButton">
<property name="text">
<string>&amp;Search</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="replaceButton">
<property name="text">
<string>Search &amp;&amp; &amp;Replace</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Sco&amp;pe:</string>
<string>Sear&amp;ch for:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>filterList</cstring>
<cstring>searchTerm</cstring>
</property>
</widget>
</item>
@@ -77,22 +102,6 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Sear&amp;ch for:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>searchTerm</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="searchTerm"/>
</item>
<item row="2" column="1">
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
@@ -136,6 +145,34 @@
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Sco&amp;pe:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>filterList</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="searchTerm"/>
</item>
<item row="3" column="0" colspan="2">
<widget class="QWidget" name="configWidget" native="true">
<property name="sizePolicy">
@@ -146,53 +183,6 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="searchButton">
<property name="text">
<string>&amp;Search</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="replaceButton">
<property name="text">
<string>Search &amp;&amp; &amp;Replace</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>

View File

@@ -40,6 +40,7 @@
#include <QtGui/QStringListModel>
#include <QtGui/QCompleter>
#include <QtGui/QKeyEvent>
#include <QtGui/QScrollArea>
using namespace Find;
using namespace Find::Internal;
@@ -186,6 +187,19 @@ void FindToolWindow::setCurrentFilter(int index)
configWidget->setParent(0);
}
}
QWidget *w = m_ui.configWidget;
while (w) {
QScrollArea *sa = qobject_cast<QScrollArea *>(w);
if (sa) {
sa->updateGeometry();
break;
}
w = w->parentWidget();
}
for (w = m_configWidget ? m_configWidget : m_ui.configWidget; w; w = w->parentWidget()) {
if (w->layout())
w->layout()->activate();
}
}
void FindToolWindow::acceptAndGetParameters(QString *term, IFindFilter **filter)

View File

@@ -58,7 +58,28 @@ namespace Find {
namespace Internal {
class SearchResultWindowPrivate : public QObject {
class InternalScrollArea : public QScrollArea
{
Q_OBJECT
public:
explicit InternalScrollArea(QWidget *parent)
: QScrollArea(parent)
{
setFrameStyle(QFrame::NoFrame);
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
}
QSize sizeHint() const
{
if (widget())
return widget()->size();
return QScrollArea::sizeHint();
}
};
class SearchResultWindowPrivate : public QObject
{
Q_OBJECT
public:
SearchResultWindowPrivate(SearchResultWindow *window);
@@ -210,8 +231,7 @@ SearchResultWindow::SearchResultWindow(QWidget *newSearchPanel)
d->m_widget = new QStackedWidget;
d->m_widget->setWindowTitle(displayName());
QScrollArea *newSearchArea = new QScrollArea(d->m_widget);
newSearchArea->setFrameStyle(QFrame::NoFrame);
InternalScrollArea *newSearchArea = new InternalScrollArea(d->m_widget);
newSearchArea->setWidget(newSearchPanel);
newSearchArea->setFocusProxy(newSearchPanel);
d->m_widget->addWidget(newSearchArea);