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

QProgressDialog: LanguageChange event has no effect on cancel button text

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Done
    • Affects Version/s: 5.3.1
    • Fix Version/s: 5.4.0
    • Labels:
      None
    • Commits:
      c7386938b43f3564b3e3a6fe5f98009e39d52e4c

      Description

      The following test fails:

          class QTestTranslator : public QTranslator
          {
              const QString m_str;
          public:
               explicit QTestTranslator(QString m_str) : m_str(qMove(m_str)) {}
               QString translate(const char *, const char *sourceText, const char *, int) const Q_DECL_OVERRIDE
               { return m_str + sourceText + m_str; }
               bool isEmpty() const Q_DECL_OVERRIDE { return false; }
          };
      
          template <typename Translator>
          class QTranslatorGuard {
              Translator t;
          public:
              template <typename Arg>
              explicit QTranslatorGuard(Arg a) : t(qMove(a))
              { qApp->installTranslator(&t); }
              ~QTranslatorGuard()
              { qApp->removeTranslator(&t); }
          };
      
          QProgressDialog dlg;
          QPushButton *btn = dlg.findChild<QPushButton*>();
          QVERIFY(btn);
          const QString xxx = QStringLiteral("xxx");
          const QString yyy = QStringLiteral("yyy");
          {
              QTranslatorGuard<QTestTranslator> guard(xxx);
              {
                  QPushButton *btn = dlg.findChild<QPushButton*>();
                  QVERIFY(btn);
                  QTRY_COMPARE(btn->text(), QProgressDialog::tr("Cancel"));
                  QVERIFY(btn->text().startsWith(xxx));
              }
          }
          QVERIFY(btn);
          QTRY_COMPARE(btn->text(), QProgressDialog::tr("Cancel"));
          QVERIFY(!btn->text().startsWith(xxx));
      

        Attachments

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

          Activity

            People

            Assignee:
            mmutz Marc Mutz
            Reporter:
            mmutz Marc Mutz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes