aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/pathchooser.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2019-02-07 14:11:31 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2019-02-07 13:33:49 +0000
commit72cb9e26a1c1ba5596cb5cee94adc266ad03df91 (patch)
treed630905e84be20ce635b7c0c7f1827498c37cb85 /src/libs/utils/pathchooser.cpp
parentd122049aeea62794ba97dd60516cf97c2cdaaffa (diff)
PathChooser: Move setTextKeepingActiveCursor() to FancyLineEdit
We want to re-use it elsewhere. Change-Id: Iadb03e2e85bc25f9111a8817170b9ec1f2f0a7b1 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/libs/utils/pathchooser.cpp')
-rw-r--r--src/libs/utils/pathchooser.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp
index 45600b7aa1d..e29b0c76632 100644
--- a/src/libs/utils/pathchooser.cpp
+++ b/src/libs/utils/pathchooser.cpp
@@ -26,7 +26,6 @@
#include "pathchooser.h"
#include "environment.h"
-#include "optional.h"
#include "qtcassert.h"
#include "macroexpander.h"
@@ -348,22 +347,14 @@ QString PathChooser::expandedDirectory(const QString &input, const Environment &
return path;
}
-void setTextKeepingActiveCursor(QLineEdit *edit, const QString &text)
-{
- optional<int> cursor = edit->hasFocus() ? make_optional(edit->cursorPosition()) : nullopt;
- edit->setText(text);
- if (cursor)
- edit->setCursorPosition(*cursor);
-}
-
void PathChooser::setPath(const QString &path)
{
- setTextKeepingActiveCursor(d->m_lineEdit, QDir::toNativeSeparators(path));
+ d->m_lineEdit->setTextKeepingActiveCursor(QDir::toNativeSeparators(path));
}
void PathChooser::setFileName(const FileName &fn)
{
- setTextKeepingActiveCursor(d->m_lineEdit, fn.toUserOutput());
+ d->m_lineEdit->setTextKeepingActiveCursor(fn.toUserOutput());
}
void PathChooser::setErrorColor(const QColor &errorColor)