Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to set displayText() on QlineEdit
Forum Updated to NodeBB v4.3 + New Features

How to set displayText() on QlineEdit

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 510 Views 1 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.
  • U Offline
    U Offline
    Ucn_
    wrote on last edited by
    #1

    I have been reading the QlineEdit documentation and I came accross with displayText() const property. I tried to use it, but with no success, the documentation does not show how to use it or gives an example. Does anyone know how to use it? I would like to show my lineEdit password on button click that EchoMode is Password. Thanks

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

      Hi,

      This properly won't help you, since as the description says, it will return a platform specific mask char if echo mode is password.

      If you want to show the password you have to use the text property.

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

      U 1 Reply Last reply
      1
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by Christian Ehrlicher
        #3

        QLineEdit::displayText() only returns the currently displayed text. When you want to set the text in the QLineEdit you should use QLineEdit::setText()

        /edit: one second too late :)

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        1
        • SGaistS SGaist

          Hi,

          This properly won't help you, since as the description says, it will return a platform specific mask char if echo mode is password.

          If you want to show the password you have to use the text property.

          U Offline
          U Offline
          Ucn_
          wrote on last edited by
          #4

          @SGaist and @Christian-Ehrlicher thanks for the clarification. I used setEchoMode to display the text

          1 Reply Last reply
          0

          • Login

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