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

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 6.1.3, 5.15.0 RC2
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      All

      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

        For Gerrit Dashboard: QTBUG-96212
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            eyllanesc Edwin Christian Yllanes Cucho
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There is 1 open Gerrit change