Results 1 to 2 of 2

Thread: getting images out of html

  1. #1

    Default getting images out of html

    I've been digging around the docs for a few hours.. I have chunks of html in QString and wondering if there is anyway to do like a regex to pull out something like <img *>

    I saw find but that just returns the posistion.. I'd like to return all occurances of the regex to like a qstringlist

    thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: getting images out of html

    Here's an example from the docs:
    Qt Code:
    1. QString str = "offsets: 1.23 .50 71.00 6.00";
    2. QRegExp rx( "\\d*\\.\\d+" ); // primitive floating point matching
    3. int count = 0;
    4. int pos = 0;
    5. while ( (pos = rx.search(str, pos)) != -1 ) {
    6. count++;
    7. pos += rx.matchedLength();
    8. }
    9. // pos will be 9, 14, 18 and finally 24; count will end up as 4
    To copy to clipboard, switch view to plain text mode 
    You need something similar. QRegExp::cap( 0 ) should return the whole matched tag.

Similar Threads

  1. Need Basic html Browser
    By awalesminfo in forum Newbie
    Replies: 6
    Last Post: 21st March 2006, 18:14
  2. HTML Parsing
    By awalesminfo in forum Qt Programming
    Replies: 3
    Last Post: 19th March 2006, 12:31
  3. Replies: 1
    Last Post: 17th March 2006, 09:01
  4. working with images
    By Kapil in forum Newbie
    Replies: 2
    Last Post: 9th March 2006, 12:59
  5. [Qt 4.1]using html in QTextEdit from designer
    By patcito in forum Qt Programming
    Replies: 5
    Last Post: 16th January 2006, 23:36

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.