diff options
author | Mitch Curtis <mitch.curtis@digia.com> | 2013-03-13 14:32:08 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-19 09:57:09 +0200 |
commit | f3612f39ff5fb07f83b89732e8b7a643ee6d5cd3 (patch) | |
tree | ffa806bc1a504f456ede3c01ec43f2eec48057c4 /src/widgets | |
parent | 8597458cebf1df64b5559426ec5c1d14567b2a83 (diff) |
Make password mask characters themeable.
Task-number: QTBUG-29871
Change-Id: I3cf739a321d7917f8f8431992e29bba0871b1934
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 16 | ||||
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 3 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsstyle.cpp | 15 | ||||
-rw-r--r-- | src/widgets/widgets/qlineedit.cpp | 13 |
4 files changed, 11 insertions, 36 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index f7ae667a82..c6edbee67d 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -4905,20 +4905,12 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget ret = -1; break; case SH_LineEdit_PasswordCharacter: { - const QFontMetrics &fm = opt ? opt->fontMetrics - : (widget ? widget->fontMetrics() : QFontMetrics(QFont())); - ret = 0; - if (fm.inFont(QChar(0x25CF))) { - ret = 0x25CF; - } else if (fm.inFont(QChar(0x2022))) { - ret = 0x2022; - } else { - ret = '*'; - } + const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme(); + const QPlatformTheme::ThemeHint hintType = QPlatformTheme::PasswordMaskCharacter; + const QVariant hint = theme ? theme->themeHint(hintType) : QPlatformTheme::defaultThemeHint(hintType); + ret = hint.toChar().unicode(); break; } - - case SH_ToolBox_SelectedPageTitleBold: ret = 1; break; diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index ed721e06c4..b2bf2c5565 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -2466,9 +2466,6 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_TabBar_PreferNoArrows: ret = true; break; - case SH_LineEdit_PasswordCharacter: - ret = kBulletUnicode; - break; /* case SH_DialogButtons_DefaultButton: ret = QDialogButtons::Reject; diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 86fccabcbc..0acd6052c8 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -602,21 +602,6 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid } break; #endif // QT_NO_RUBBERBAND - case SH_LineEdit_PasswordCharacter: - { -#ifdef Q_OS_WIN - if (widget && (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { - const QFontMetrics &fm = widget->fontMetrics(); - if (fm.inFont(QChar(0x25CF))) - ret = 0x25CF; - else if (fm.inFont(QChar(0x2022))) - ret = 0x2022; - } -#endif - if (!ret) - ret = '*'; - } - break; #ifndef QT_NO_WIZARD case SH_WizardStyle: ret = QWizard::ModernStyle; diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index ea58ec1429..abef6e8832 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -360,9 +360,9 @@ void QLineEdit::setPlaceholderText(const QString& placeholderText) \brief the displayed text If \l echoMode is \l Normal this returns the same as text(); if - \l EchoMode is \l Password or \l PasswordEchoOnEdit it returns a string of asterisks - text().length() characters long, e.g. "******"; if \l EchoMode is - \l NoEcho returns an empty string, "". + \l EchoMode is \l Password or \l PasswordEchoOnEdit it returns a string of + platform-dependent password mask characters text().length() in size, + e.g. "******"; if \l EchoMode is \l NoEcho returns an empty string, "". By default, this property contains an empty string. @@ -440,10 +440,11 @@ void QLineEdit::setFrame(bool enable) \value NoEcho Do not display anything. This may be appropriate for passwords where even the length of the password should be kept secret. - \value Password Display asterisks instead of the characters - actually entered. + \value Password Display platform-dependent password mask characters instead + of the characters actually entered. \value PasswordEchoOnEdit Display characters as they are entered - while editing otherwise display asterisks. + while editing otherwise display characters as with + \c Password. \sa setEchoMode(), echoMode() */ |