forked from qt-creator/qt-creator
Find/replace tool bar wasn't usable in very small width editors.
E.g. in split editors with small main window. We now have line edits with a minimum size and use a flow layout for the replace buttons (which will reduce width when necessary by laying out vertically). Flow layout is taken from the Qt examples. Task-number: QTCREATORBUG-3279 Change-Id: Ic07d4d3e75e3d928d6b53534adb42481ce26256b Reviewed-on: http://codereview.qt.nokia.com/666 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <utils/stylehelper.h>
|
||||
#include <utils/flowlayout.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QSettings>
|
||||
@@ -87,6 +88,14 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
|
||||
{
|
||||
//setup ui
|
||||
m_ui.setupUi(this);
|
||||
// compensate for a vertically expanding spacer below the label
|
||||
m_ui.replaceLabel->setMinimumHeight(m_ui.replaceEdit->sizeHint().height());
|
||||
delete m_ui.replaceButtonsWidget->layout();
|
||||
Utils::FlowLayout *flowlayout = new Utils::FlowLayout(m_ui.replaceButtonsWidget, 0, 3, 3);
|
||||
flowlayout->addWidget(m_ui.replaceButton);
|
||||
flowlayout->addWidget(m_ui.replaceNextButton);
|
||||
flowlayout->addWidget(m_ui.replaceAllButton);
|
||||
m_ui.replaceButtonsWidget->setLayout(flowlayout);
|
||||
setFocusProxy(m_ui.findEdit);
|
||||
setProperty("topBorder", true);
|
||||
setSingleRow(false);
|
||||
@@ -348,9 +357,7 @@ void FindToolBar::updateToolBar()
|
||||
m_ui.replaceLabel->setEnabled(replaceEnabled);
|
||||
m_ui.replaceEdit->setVisible(replaceEnabled);
|
||||
m_ui.replaceLabel->setVisible(replaceEnabled);
|
||||
m_ui.replaceButton->setVisible(replaceEnabled);
|
||||
m_ui.replaceNextButton->setVisible(replaceEnabled);
|
||||
m_ui.replaceAllButton->setVisible(replaceEnabled);
|
||||
m_ui.replaceButtonsWidget->setVisible(replaceEnabled);
|
||||
m_ui.advancedButton->setVisible(replaceEnabled);
|
||||
layout()->invalidate();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user