Results 1 to 4 of 4

Thread: How to select a email in QTextEdit

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2017
    Posts
    6
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11

    Default How to select a email in QTextEdit

    I want to select the email in a QTextEdit widget and then highlight each email . But I found that select() funciton only support 4 types: Document, BlockUnderCursor, LineUnderCursor and WordUnderCursor.

    So, is there any other way can only select an email?

    My input example in QTextEdit is

    email@abc.com , b@acb.com

    I know that I can use QTextCursor to select the text .

    Qt Code:
    1. QTextCursor tc = ui->textEdit->textCursor();
    2. tc.select(QTextCursor::WordUnderCursor);
    3. QString text = tc.selectedText();
    To copy to clipboard, switch view to plain text mode 

    using email@abc.com, b@acb.com as an example, it would return email , abc, com , b , acb ,com.
    I want to return the text like email@abc.com and b@acb.com.

    How can I do that? Please give me some helps. Thanks!
    Last edited by ng2b30; 11th April 2018 at 06:15.

Similar Threads

  1. QTextEdit copy and paste into email.
    By chris_helloworld in forum Qt Programming
    Replies: 3
    Last Post: 16th November 2010, 08:17
  2. How to select a tex in QTExtEdit
    By Furkan in forum Newbie
    Replies: 3
    Last Post: 12th September 2010, 18:00
  3. How to send email and attachement via default email client
    By richardander in forum Qt Programming
    Replies: 3
    Last Post: 1st December 2009, 04:40
  4. How to tokenize email address in QTextEdit?
    By blonde in forum Qt Programming
    Replies: 0
    Last Post: 10th November 2009, 14:34
  5. Replies: 7
    Last Post: 5th January 2009, 08:27

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.