Results 1 to 12 of 12

Thread: how to get the text from a LineEdit using QT??

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2013
    Posts
    25
    Qt products
    Qt5
    Platforms
    Windows

    Default how to get the text from a LineEdit using QT??

    I want to display the text in the LineEdit using Qt.
    but when i use the code an empty string wiil be displayed.
    The following is my code.

    Qt Code:
    1. if( QPushButton *button = (QPushButton *)sender())
    2. {// it's a "QPushButton", do something with pb here
    3. QFrame* popup1 = new QFrame(this, Qt::Tool | Qt::Window );
    4. popup1->setWindowTitle("Rename the folder");
    5. QLineEdit *lb=new QLineEdit(popup1);
    6. connect( lb, SIGNAL( returnPressed() ), lb, SLOT( hide() ) );
    7. lb->setFocus();
    8. lb->show();
    9. lb->move(QCursor::pos());
    10. qDebug()<<lb->text();
    11. button->setText(lb->text());
    12. button->setObjectName(lb->text());
    13.  
    14. } }
    To copy to clipboard, switch view to plain text mode 
    Can any one help me.
    Thanks in advance.
    Last edited by high_flyer; 4th September 2013 at 11:18. Reason: code tags

Similar Threads

  1. send text of lineedit
    By akhilteja in forum Newbie
    Replies: 1
    Last Post: 23rd August 2013, 09:53
  2. Clear text of LineEdit
    By stbb24 in forum Qt Programming
    Replies: 7
    Last Post: 12th June 2012, 13:30
  3. lineEdit's setSelection - How to show more text?
    By squidge in forum Qt Programming
    Replies: 3
    Last Post: 30th January 2010, 17:22
  4. Get text from dynamic lineedit
    By wirasto in forum Qt Programming
    Replies: 1
    Last Post: 13th January 2010, 18:56
  5. Lineedit text change signal
    By zgulser in forum Qt Tools
    Replies: 2
    Last Post: 19th January 2009, 13:38

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.