Important: Please read the Qt Code of Conduct -

Issues with translating some buttons

  • Can someone help me with this as when I select a particular language in the application, everything changes but except few buttons in the settings menu of the application but they change when i restart the application. May I know what must have i missed.

    //void ApplicationSettingsContentWidget::retranslateUi()
      QWidget* parent = m_ButtonControlTargetLayout->parentWidget();
      Q_ASSERT(nullptr != parent);
      if(nullptr == parent) return;
      for(QPushButton *btn : parent->findChildren<QPushButton*>())
        if(true == btn->dynamicPropertyNames().contains(QString("application_settings_button").toLatin1()))
          QString name = btn->property("application_id").value<QString>();
          QString applicationPtrPath = getContext(Shared::GuiContexts::Type::eApplications,
          application = getAppConfig()->query()->getAttributeValue<
          //only valid application instances are accepted
          if(nullptr == application) continue;

  • Lifetime Qt Champion

    @Nani1504 You have several if(...) in this code: did you debug to see whether any of them evaluate to false?

  • @jsulm No everything is running well. We can see in the first pic when its in english and I changed it to DE and in the third pic it can be seen that first three options changed to DE but not the other buttons.

  • Lifetime Qt Champion

    @Nani1504 I only see the other buttons in the first pic, in second and third they disappeared.

  • @jsulm Sorry for that, please look into them in reverse order.

  • Lifetime Qt Champion


    Do you have this issue on dynamically created button ?

  • @SGaist yes, all the options in the application are translating except those three buttons which we can see in the picture 1

  • Lifetime Qt Champion

    How exactly are you generating the text for them ?

  • @SGaist Actually the break statement is the reason for not allowing the 'for' loop to continue. I have removed it and everything is working fine. Thank you

Log in to reply