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. Retrieving the text from QLineEdit

Retrieving the text from QLineEdit

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 16.5k 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.
  • A Offline
    A Offline
    Arnon
    wrote on last edited by
    #1

    I want to retrieve the entered text from QLineEdit and put it into a variable
    QString name;
    My question is what is the proper code to perform this action?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koplersky
      wrote on last edited by
      #2

      You use the "text" method.
      @QString name = ui->lineEdit->text();@

      Refer to the QLineEdit documentation to see its members and information:
      http://qt-project.org/doc/qt-5/qlineedit.html

      1 Reply Last reply
      0
      • K Offline
        K Offline
        koahnig
        wrote on last edited by
        #3

        You can retrieve the input with "text()":http://qt-project.org/doc/qt-5/qlineedit.html#text-prop

        However, you might to checkout the "tutorials and examples":http://qt-project.org/doc/qt-5/qtexamplesandtutorials.html for more details on the different ways to use QLineEdit

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

        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