Results 1 to 8 of 8

Thread: how to add smilies in QTextEdit

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2010
    Location
    Chennai
    Posts
    7
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default how to add smilies in QTextEdit

    hi,

    In QTextEdit if we enter ": )" it needs to change as image .. please guide me if u have any idea?

    Thanks in advance.

    Thanks & Regards,
    Sivambigai.M

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: how to add smilies in QTextEdit

    React on text changed signals or events.
    Use setHtml and replace the :-) string with some html image tags.

  3. #3
    Join Date
    Sep 2010
    Location
    Chennai
    Posts
    7
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: how to add smilies in QTextEdit

    hi

    Thanks for your idea..

    i have used

    QObject::connect(textEdit, SIGNAL(textChanged()), this, SLOT(changePixmap()),Qt::QueuedConnection) ;

    void CSmsWidget::changePixmap()
    {
    QString text =textEdit->toPlainText();
    if (Qt::mightBeRichText(text)){
    textEdit->setHtml(text);
    }
    }

    but this is not working.. any idea?

    Thanks in advance.

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: how to add smilies in QTextEdit

    Do you think images come out of thin air?

    replace the text :-) with something like <img source="...">

  5. The following user says thank you to tbscope for this useful post:

    chris_helloworld (16th November 2010)

Similar Threads

  1. QTextEdit
    By titoaii in forum Newbie
    Replies: 3
    Last Post: 15th April 2010, 09:29
  2. QTextEdit
    By RY in forum Newbie
    Replies: 5
    Last Post: 15th October 2008, 17:52
  3. QTextEdit
    By veda in forum Qt Programming
    Replies: 4
    Last Post: 11th September 2007, 07:30
  4. Replies: 1
    Last Post: 16th February 2007, 07:22
  5. 4.1 to 4.1.1, qtextedit
    By jey in forum Qt Programming
    Replies: 5
    Last Post: 9th March 2006, 12:48

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.