how to write and read a text to and from a LineEdit using QT Creator?

24,192

You use QLineEdit::setText() to change the text and QLineEdit::text() to read.

Your questions are very basic and show a clear lack of studying the documentation and experimenting thing yourself. Qt is one of the better documented frameworks out there and with lots of examples. Please take your time to go through them.

Share:
24,192
skywak
Author by

skywak

Updated on August 19, 2020

Comments

  • skywak
    skywak over 3 years

    I am working with QT Creator. I have a form that contains a push button and an Line Edit. I would like to print a string that i give programatically in this LineEdit.Secondly I would also like to the from the LineBox a string that I fill in and print it using QMessageBox.

    How to do it? Need some help. I don't know how to access the displayText() to write and read from a LineEdit.

    I would like to specify that I put the push button and the lineedit on the Form using drag and drop.

    I am working in c++ under Ubuntu Appreciate.

  • skywak
    skywak almost 13 years
    Can you please give me a good link from where I can start reading QT tools? I am new to this program. THX
  • Vinicius Kamakura
    Vinicius Kamakura almost 13 years
    developer.qt.nokia.com/resources, there is a whole Getting Started section.
  • ssell
    ssell almost 13 years
    Don't get confused by the Qt Tools. Creator is simply an IDE like any other that is simply tailored to Qt development, and Designer is a WYSIWYG editor.
  • Sigur
    Sigur almost 6 years
    @ViniciusKamakura, do you have a reference how to read lines from txt and fill many QLineEdits? I mean, suppose txt with 2 lines: faa and foo. I'd like to set foo to QLineEdit_1 and faa to QLineEdit_2.