Masking QLineEdit text

后端 未结 5 998
灰色年华
灰色年华 2021-02-06 11:53

I am using PyQt4 QLineEdit widget to accept password. There is a setMasking property, but not following how to set the masking character.<

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-06 12:43

    There is no setMasking property for QLineEdit in either PyQt4 or Qt4. Are you talking about setInputMask()? If you are, this does not do what you seem to think it does. It sets the mask against which to validate the input.

    To get the control to hide what is typed, use the setEchoMode() method, which will (should) display the standard password hiding character for the platform. From what I can see from the documentation, if you want a custom character to be displayed, you will need to derive a new class. In general however, this is a bad idea, since it goes against what users expect to see.

提交回复
热议问题