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

The visibility of placeHolderText of the QPlainTextEdit is not reevaluated in the setter

    XMLWordPrintable

Details

    • All
    • d54bb53247 (qt/qtbase/dev) 4d210319e6 (qt/qtbase/6.2) 4d210319e6 (qt/tqtc-qtbase/6.2) d54bb53247 (qt/tqtc-qtbase/dev)

    Description

      If empty text is set before setting the placeHolderText then the placeHolderText is not visible:

      #include <QApplication>
      #include <QPlainTextEdit>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QPlainTextEdit w;
          w.setPlainText("");
          w.setPlaceholderText("Qt is awesome!!!");
          w.show();
          return a.exec();
      }
      

      If instead if I reverse the order the placeHolderText is visible:

      w.setPlaceholderText("Qt is awesome!!!");
      w.setPlainText("");
      

      Reviewing the source code I discovered that in setPlaceholderText the variable placeholderVisible is not reevaluated causing this unexpected behavior.

      so a possible solution would be to invoke QPlainTextEditPrivate:: _q_textChanged in QPlainTextEdit::setPlaceholderText

      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
            eyllanesc Edwin Christian Yllanes Cucho
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes