SearchResultWidget: Re-layout replace options and Replace button

Placing the extra options (Preserve Case and Rename Files) left
to the Replace button looks more natural (you have to check them
*before* pressing Replace.

As benefit, the tab order automatically goes from the replace
edit to the tree and from there through the extra options to
the Replace button.

Change-Id: I922b65f6e033a8db7a0a218aba3a714cef9fbc32
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Andre Hartmann
2017-04-27 20:34:33 +02:00
committed by André Hartmann
parent ef951eaea7
commit b60c02bcc0

View File

@@ -177,16 +177,16 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
m_replaceTextEdit->setMinimumWidth(120);
m_replaceTextEdit->setEnabled(false);
m_replaceTextEdit->setTabOrder(m_replaceTextEdit, m_searchResultTreeView);
m_replaceButton = new QToolButton(m_topReplaceWidget);
m_replaceButton->setToolTip(tr("Replace all occurrences."));
m_replaceButton->setText(tr("&Replace"));
m_replaceButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
m_replaceButton->setEnabled(false);
m_preserveCaseCheck = new QCheckBox(m_topReplaceWidget);
m_preserveCaseCheck->setText(tr("Preser&ve case"));
m_preserveCaseCheck->setEnabled(false);
m_renameFilesCheckBox = new QCheckBox(m_topReplaceWidget);
m_renameFilesCheckBox->setVisible(false);
m_replaceButton = new QToolButton(m_topReplaceWidget);
m_replaceButton->setToolTip(tr("Replace all occurrences."));
m_replaceButton->setText(tr("&Replace"));
m_replaceButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
m_replaceButton->setEnabled(false);
m_preserveCaseCheck->setChecked(Find::hasFindFlag(FindPreserveCase));
connect(m_preserveCaseCheck, &QAbstractButton::clicked, Find::instance(), &Find::setPreserveCase);
@@ -201,9 +201,9 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
topFindLayout->addWidget(m_matchesFoundLabel);
topReplaceLayout->addWidget(m_replaceLabel);
topReplaceLayout->addWidget(m_replaceTextEdit);
topReplaceLayout->addWidget(m_replaceButton);
topReplaceLayout->addWidget(m_preserveCaseCheck);
topReplaceLayout->addWidget(m_renameFilesCheckBox);
topReplaceLayout->addWidget(m_replaceButton);
topReplaceLayout->addStretch(2);
setShowReplaceUI(m_replaceSupported);
setSupportPreserveCase(true);