Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Get classes QStringList from Html source code?
Qt 6.11 is out! See what's new in the release blog

Get classes QStringList from Html source code?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 995 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    luisvt
    wrote on last edited by
    #1

    Hello everybody, I want to extract the classes from an Html source code and get a QStringList. The way that I could figure out was the next

    @

        QString content = ui->webView->page()->mainFrame()->toHtml();
        qDebug()<<"Content: \n"<<content.split(QRegExp("type=\"[\\w\\d\\s\\.:;/=-]+\""),QString::SkipEmptyParts);@
    

    But this Returns a list of everything that is diferent from the regular expresion.

    For example if the webview contains:

    @<body class="class1">
    </body>@

    the code return a list with two elements
    @"<body " and ">\n</body>"@

    That means that I need to make something to negate the Regular Expresion or use another method instead split, like search or find. However, QString class don't has any method to search and return a QStringList.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved