From b0b0842b03320d03d335ee40d361d774e93ee2f4 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 6 Dec 2011 16:57:09 +0100 Subject: 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 Reviewed-by: Eike Ziller --- src/plugins/find/finddialog.ui | 150 +++++++++++++++----------------- src/plugins/find/findtoolwindow.cpp | 14 +++ src/plugins/find/searchresultwindow.cpp | 26 +++++- 3 files changed, 107 insertions(+), 83 deletions(-) diff --git a/src/plugins/find/finddialog.ui b/src/plugins/find/finddialog.ui index 4a57a70787..d77ad32132 100644 --- a/src/plugins/find/finddialog.ui +++ b/src/plugins/find/finddialog.ui @@ -7,7 +7,7 @@ 0 0 673 - 210 + 240 @@ -17,28 +17,53 @@ - - - - - 0 - 0 - - - - - 80 - 0 - - + + QLayout::SetFixedSize + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + &Search + + + true + + + + + + + Search && &Replace + + + + + + + - Sco&pe: + Sear&ch for: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - filterList + searchTerm @@ -77,22 +102,6 @@ - - - - Sear&ch for: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - searchTerm - - - - - - @@ -136,6 +145,34 @@ + + + + + 0 + 0 + + + + + 80 + 0 + + + + Sco&pe: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + filterList + + + + + + @@ -146,53 +183,6 @@ - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - &Search - - - true - - - - - - - Search && &Replace - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - diff --git a/src/plugins/find/findtoolwindow.cpp b/src/plugins/find/findtoolwindow.cpp index f2c284a165..1aecc9f975 100644 --- a/src/plugins/find/findtoolwindow.cpp +++ b/src/plugins/find/findtoolwindow.cpp @@ -40,6 +40,7 @@ #include #include #include +#include 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(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) diff --git a/src/plugins/find/searchresultwindow.cpp b/src/plugins/find/searchresultwindow.cpp index aed3329cfc..37ddce4371 100644 --- a/src/plugins/find/searchresultwindow.cpp +++ b/src/plugins/find/searchresultwindow.cpp @@ -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); -- cgit v1.2.3