Results 1 to 5 of 5

Thread: How to set the PlaceHolderText for a TextEdit?

  1. #1
    Join Date
    Aug 2012
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default How to set the PlaceHolderText for a TextEdit?

    Can anyone Please suggest me how to set the PlaceHolderText for a QTextEdit.

    QLineEdit has a Property setPlaceHolderText, But why the QTextEdit didn’t have that?

    If i want to set a PlaceHolderText for TextEdit, How can i set this?

    Thanks & Regards,,,,

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to set the PlaceHolderText for a TextEdit?

    qtextedit doesn't have a placeholder member. You will have to do it manually/
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Aug 2012
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: How to set the PlaceHolderText for a TextEdit?

    Yeah i know that. But how to do that? Whether i have to use the focusInEvent for that?

  4. #4
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to set the PlaceHolderText for a TextEdit?

    yes, you will have to use focus events because that affects the behaviour of placeholder in LineEdit
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to set the PlaceHolderText for a TextEdit?

    I don't think using focus events is required. It should be enough to reimplement the paint event and there check if the widget has focus to decide what to draw.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. How to set the PlaceHolderText for a TextEdit?
    By JavidRoshan in forum Newbie
    Replies: 1
    Last Post: 19th November 2012, 23:56
  2. Qml TextEdit
    By goli in forum Newbie
    Replies: 4
    Last Post: 28th April 2011, 14:37
  3. textedit
    By limeir in forum Qt Programming
    Replies: 1
    Last Post: 13th July 2010, 10:27
  4. [B]tableWidget row,col to textEdit[B]
    By briang in forum Newbie
    Replies: 1
    Last Post: 6th November 2009, 04:22
  5. Printing from a textEdit
    By Nefastious in forum Newbie
    Replies: 2
    Last Post: 21st October 2009, 05:29

Tags for this Thread

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.