Commit 942611f6 authored by mae's avatar mae
Browse files

UI fix for renaming symbols

The change makes the "replace with" line edit for symbol
renaming wide enough.

The default QLineEdit has space for ca. 17 characters, we now
expand to the maximum of 25 and the space needed for the replacement
text.
parent 313c97bc
...@@ -52,6 +52,25 @@ static const char SETTINGSKEYEXPANDRESULTS[] = "ExpandResults"; ...@@ -52,6 +52,25 @@ static const char SETTINGSKEYEXPANDRESULTS[] = "ExpandResults";
namespace Find { namespace Find {
class WideEnoughLineEdit : public QLineEdit {
Q_OBJECT
public:
WideEnoughLineEdit(QWidget *parent):QLineEdit(parent){
connect(this, SIGNAL(textChanged(QString)),
this, SLOT(updateGeometry()));
}
~WideEnoughLineEdit(){}
QSize sizeHint() const {
QSize sh = QLineEdit::minimumSizeHint();
sh.rwidth() += qMax(25 * fontMetrics().width(QLatin1Char('x')),
fontMetrics().width(text()));
return sh;
}
public slots:
void updateGeometry() { QLineEdit::updateGeometry(); }
};
struct SearchResultWindowPrivate { struct SearchResultWindowPrivate {
SearchResultWindowPrivate(); SearchResultWindowPrivate();
...@@ -97,7 +116,7 @@ SearchResultWindow::SearchResultWindow() : d(new SearchResultWindowPrivate) ...@@ -97,7 +116,7 @@ SearchResultWindow::SearchResultWindow() : d(new SearchResultWindowPrivate)
d->m_replaceLabel = new QLabel(tr("Replace with:"), d->m_widget); d->m_replaceLabel = new QLabel(tr("Replace with:"), d->m_widget);
d->m_replaceLabel->setContentsMargins(12, 0, 5, 0); d->m_replaceLabel->setContentsMargins(12, 0, 5, 0);
d->m_replaceTextEdit = new QLineEdit(d->m_widget); d->m_replaceTextEdit = new WideEnoughLineEdit(d->m_widget);
d->m_replaceButton = new QToolButton(d->m_widget); d->m_replaceButton = new QToolButton(d->m_widget);
d->m_replaceButton->setToolTip(tr("Replace all occurrences")); d->m_replaceButton->setToolTip(tr("Replace all occurrences"));
d->m_replaceButton->setText(tr("Replace")); d->m_replaceButton->setText(tr("Replace"));
...@@ -371,3 +390,5 @@ bool SearchResultWindow::canNavigate() ...@@ -371,3 +390,5 @@ bool SearchResultWindow::canNavigate()
} // namespace Find } // namespace Find
#include "searchresultwindow.moc"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment