JSON Wizards: Add "isPassword" property to LineEdits

Change-Id: I5539c66c162345bda052546fa02cc69d4bd55f9a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
Tobias Hunger
2016-10-09 11:55:09 +02:00
parent 0b6c2422b8
commit 318b6c9dba
3 changed files with 7 additions and 0 deletions

View File

@@ -824,6 +824,9 @@
For example, to turn the first character in the line edit to upper
case.
\li \c isPassword is a boolean value that specifies that the line edit
contains a password, which will be masked.
\endlist
\section2 Path Chooser

View File

@@ -404,6 +404,7 @@ bool LineEditField::parseData(const QVariant &data, QString *errorMessage)
QVariantMap tmp = data.toMap();
m_isPassword = tmp.value("isPassword", false).toBool();
m_defaultText = JsonWizardFactory::localizedString(tmp.value(QLatin1String("trText")).toString());
m_disabledText = JsonWizardFactory::localizedString(tmp.value(QLatin1String("trDisabledText")).toString());
m_placeholderText = JsonWizardFactory::localizedString(tmp.value(QLatin1String("trPlaceholder")).toString());
@@ -439,6 +440,8 @@ QWidget *LineEditField::createWidget(const QString &displayName, JsonFieldPage *
if (!m_historyId.isEmpty())
w->setHistoryCompleter(m_historyId, m_restoreLastHistoryItem);
w->setEchoMode(m_isPassword ? QLineEdit::Password : QLineEdit::Normal);
return w;
}

View File

@@ -105,6 +105,7 @@ private:
bool m_isModified;
bool m_isValidating;
bool m_restoreLastHistoryItem;
bool m_isPassword;
QString m_placeholderText;
QString m_defaultText;
QString m_disabledText;