Results 1 to 5 of 5

Thread: QLineEdit empty string

  1. #1
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default QLineEdit empty string

    Hi buddies,

    I have a very trivial question..I recently noticed that when you want to setText to your QLineEdit like " 33", it sets "33". But I want to set exactly like " 33".

    First of all, is it possible? If yes, how?

    King regards.

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QLineEdit empty string

    Do you mean: le->setText(" 33"); //sets only "33"?

  3. #3
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: QLineEdit empty string

    as I said before, if I want to perform this;

    le->setText(" 33")

    it actually performs le->setText("33");

    and yes I want it to be like le->setText(" 33")

  4. #4
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QLineEdit empty string

    That should work, try a simple project with just a QLineEdit, to see if it works ( if it doesn't post your project here, and add system info like OS version, Qt version, compiler, etc...)

  5. #5
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QLineEdit empty string

    Checking with Qt Designer 4.5.2 , I see that it does display " 33" as text... no issues there !
    even tried with dummy code.. works fine for me.
    I get " 33" and NOT "33"

Similar Threads

  1. Grey text in empty QLineEdit
    By Mefisto in forum Qt Programming
    Replies: 4
    Last Post: 3rd October 2017, 11:35
  2. I cannot get the string from QLineEdit->text()!
    By MIH1406 in forum Qt Programming
    Replies: 0
    Last Post: 3rd June 2010, 11:26
  3. Empty style sheet changes QLineEdit
    By mpi in forum Qt Programming
    Replies: 3
    Last Post: 15th June 2009, 20:13
  4. Default delegate displays empty QLineEdit?
    By andy.fillebrown in forum Qt Programming
    Replies: 3
    Last Post: 16th April 2009, 13:13
  5. QSplitter::saveState returns empty string
    By miraks in forum Qt Programming
    Replies: 2
    Last Post: 21st September 2008, 21:30

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.