Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. How do I change the password field to show "******" in table widget
Qt 6.11 is out! See what's new in the release blog

How do I change the password field to show "******" in table widget

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 4 Posters 1.9k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yashi95
    wrote on last edited by
    #1

    Hi,

    I am trying to show user name and password in table widget that table is editable, so while giving input for password, I want to change string as "*******" it's possible to do.

    K 1 Reply Last reply
    0
    • Y yashi95

      Hi,

      I am trying to show user name and password in table widget that table is editable, so while giving input for password, I want to change string as "*******" it's possible to do.

      K Offline
      K Offline
      koahnig
      wrote on last edited by koahnig
      #2

      @yashi95

      What are you using in QTableWidget?

      For QLineEdit you can change the property setting EchoMode

      [edit: koahnig] Just saw that the post is under "Qt for Phyton", which could be bit different. However, typically you look for similar settings in other languages.

      Vote the answer(s) that helped you to solve your issue(s)

      Y 1 Reply Last reply
      0
      • K koahnig

        @yashi95

        What are you using in QTableWidget?

        For QLineEdit you can change the property setting EchoMode

        [edit: koahnig] Just saw that the post is under "Qt for Phyton", which could be bit different. However, typically you look for similar settings in other languages.

        Y Offline
        Y Offline
        yashi95
        wrote on last edited by
        #3

        @koahnig
        QTableWidget for editable row, While giving input I am trying to give string as *****

        JonBJ 1 Reply Last reply
        0
        • Y yashi95

          @koahnig
          QTableWidget for editable row, While giving input I am trying to give string as *****

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @yashi95
          I don't know/think that you can change a QTableWidget's editor to what you want. You can for a QTableView, as per this old post from 2007 (! still valid) https://www.qtcentre.org/threads/7678-QTableWidget-editItem-how-to-get-pointer-to-the-editor?p=41223#post41223:

          You cannot obtain it from a QTableWidget.

          Use a QTableView instead and create the editor with the default item delegate, using:

          QAbstractItemView::itemDelegate and QAbstractItemDelegate::createEditor.

          The latter will also return a pointer to the editor.

          Then you can have your own QLineEdit, with EchoMode.

          Having said that: simpler would be using the approach in https://stackoverflow.com/questions/11056245/pyqt-using-qlineedit-as-cellwidget-in-a-qtablewidget, i.e. setCellWidget(QLineEdit()), if you don't want to do it "properly" with an item delegate. It will then stay as a QLineEdit even when not being edited, I don't know if you care.

          1 Reply Last reply
          1
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            I would go with a custom QStyledItemDelegate that provides a QLineEdit with the adequate echo mode.

            Note that from a security point of view, the password shall be immediately encrypted and not stored as is.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved