Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-80475

QTextCursor::mergeCharFormat unable to change font family when QTextCharFormat with default QFont passed as an arg

    XMLWordPrintable

Details

    • Windows
    • a1f4321bbba2f3bff24d753ce766be738dbfa61a (qt/qtbase/5.14)

    Description

      If a QTextDocument is given html content, attempting to change the font family by calling QTextCursor::mergeCharFormat fails consistently in changing the family if the QTextCharFormat passed as an argument has a default QFont and the font family is set by calling QTextCharFormat::setFontFamily.

      The issue is fixed by calling QTextCharFormat::setFont before passing it to mergeCharFormat.

      Steps to reproduce:

      1. Run the attached project
      2. The sample project will attempt to change the font to jokerman
      3. Monitor the output html => the span containing "Hello world" will have a wrong font family set
      4. (optional) Pass "-workaround" as an arg to apply workaround for comparison.

      Note: This problem does not appear in Qt 5.12.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ulherman Ulf Hermann
            miikapernu Miika Pernu
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes