Results 1 to 2 of 2

Thread: How to clear data from LineEdit after pressing PushButton?

  1. #1
    Join Date
    Aug 2014
    Posts
    1
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Windows

    Default How to clear data from LineEdit after pressing PushButton?

    I had made an user interface in which i have 1)lineEdit 2) pushButton.

    I Want that after pressing push button data written by user in LineEdit would be cleared.

    For this, i have construct this code but note working:-

    QString a;
    a=ui->lineEdit->text;
    a.clear();


    Please Reply!!
    Thanks in advance!!

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to clear data from LineEdit after pressing PushButton?

    That clears the string, if you want to clear the line edit, call its clear() method, i.e. QLineEdit::clear().

    Cheers,
    _

Similar Threads

  1. Replies: 9
    Last Post: 8th July 2013, 09:41
  2. Replies: 7
    Last Post: 26th June 2012, 11:24
  3. Clear text of LineEdit
    By stbb24 in forum Qt Programming
    Replies: 7
    Last Post: 12th June 2012, 14:30
  4. Replies: 4
    Last Post: 4th March 2011, 17:15

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.