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

QLabel::setSelection ignores rich text

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5, 6.6
    • None
    • All

    Description

      QLabel::setSelection uses displayed text, rich text will be ignored.

      QLabel *label = new QLabel("<p>Rich text</p>");
      
      QString text = label->text();
      text.replace("<p>", "\n");
      text.replace("<br>", "\n");
      text.remove(QRegularExpression("<[^>]*>"));
      
      label->setSelection(0, int (text.length())); 

      Currently, QLabel does not has a public displayText method.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            ctlcltd Leonardo Laureti
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes