Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. HTML tags in QStrings not working in Android
Qt 6.12 LTS is out! See what's new in the release blog

HTML tags in QStrings not working in Android

Scheduled Pinned Locked Moved Mobile and Embedded
7 Posts 3 Posters 2.0k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    It seems that html tags can't be handled in QString in android. Is there any way to get it working?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      You need to be more specific about what you mean by "handled" and "working" before anyone could try to answer the question.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Ok, I mean, for example, I have a

        QMessageBox::warning(this,
        tr("New Game"), QString("<p align='center'>%1</p>"
        "<p align='center'>%2</p>")
        .arg(tr("An unfinished game is in progress."))
        .arg(tr("Do you want to start a new game?")),
        QMessageBox::Yes | QMessageBox::No);

        in my program. Then on android the string appears as

        New Game <p align='center'>An unfinished game is in progress.</p>
        <p align='center'>Do you want to start a new game?</p>

        with all the html tags.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          Does calling setTextFormat(Qt::RichText); help?

          I haven't used Qt on Android, so I'm just guessing.

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            This is a reported bug: https://bugreports.qt-project.org/browse/QTBUG-34772

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              warning is a static function of QMessageBox and I can't pass setTextFormat to it. Besides, it is working on other platforms, so textFormat is actually auto and no need to explicitly declare it.

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #7

                [quote author="tomasl" date="1390914873"]This is a reported bug: https://bugreports.qt-project.org/browse/QTBUG-34772[/quote]
                I didn't see your post. Thanks

                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
                • Unsolved