New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MetaSearch] mask password when opening connection properties dialog (#42760) #42767
Conversation
What about https://qgis.org/api/classQgsPasswordLineEdit.html ? |
I couldn't get this working ( |
Hi @tomkralidis, in order to correctly use QgsPasswordLineEdit it seems you need to have the following lines in newconnectiondialog.ui (note the <customwidgets>
<customwidget>
<class>QgsPasswordLineEdit</class>
<extends>QLineEdit</extends>
<header>qgis.gui</header>
</customwidget>
</customwidgets> QgsPasswordLineEdit is different from QLineEdit as the former allow the user to toggle the password visibility |
Thanks @agiudiceandrea . PR updated to use |
ce61a2a
to
a5fefb1
Compare
<widget class="QLineEdit" name="lePassword"/> | ||
<widget class="QgsPasswordLineEdit" name="lePassword"> | ||
<property name="echoMode"> | ||
<enum>QLineEdit::Password</enum> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking, but the QgsPasswordLineEdit will do it for you when it is needed :)
https://github.com/qgis/QGIS/blob/master/src/gui/qgspasswordlineedit.cpp#L54
Thanks @agiudiceandrea, indeed you might need to use the "Promote widget" for instance in QtDesigner https://doc.qt.io/qt-5/designer-using-custom-widgets.html it will add these lines. |
@Gustry the issue with QT Designer and QGIS custom widgets (at least on Windows / OSGeo4W) is that if you use e.g. a QgsPasswordLineEdit widget, the QT Designer adds the following lines to the .ui file <customwidgets>
<customwidget>
<class>QgsPasswordLineEdit</class>
<extends>QLineEdit</extends>
<header>qgspasswordlineedit.h</header>
</customwidget>
</customwidgets> The Substituting See #38472 (comment) |
<widget class="QgsPasswordLineEdit" name="lePassword"> | ||
<property name="echoMode"> | ||
<enum>QLineEdit::Password</enum> | ||
</property> | ||
</widget> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<widget class="QgsPasswordLineEdit" name="lePassword"> | |
<property name="echoMode"> | |
<enum>QLineEdit::Password</enum> | |
</property> | |
</widget> | |
<widget class="QgsPasswordLineEdit" name="lePassword"/> |
According to the discussion on gitter @tomkralidis ?
Otherwise, I was thinking the "eye" graphic icon might not be synchronized with the status of showing or not the password :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Gustry makes sense. Changes pushed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
9a63532
to
280c300
Compare
Description
Fixes #42760