Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Issues with translating some buttons
Forum Updated to NodeBB v4.3 + New Features

Issues with translating some buttons

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 842 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nani1504
    wrote on last edited by
    #1

    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()
    {
      m_ui->retranslateUi(this);
    
      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,
                                                  CTX_APPS_CONTEXT_INSTANCES,
                                                  name,
                                                  CTX_APPS_CONTEXT_APP);
          Utilities::ApplicationPlugins::ApplicationPluginInterfacePtr
          application = getAppConfig()->query()->getAttributeValue<
                        Utilities::ApplicationPlugins::ApplicationPluginInterfacePtr>(applicationPtrPath);
    
          //only valid application instances are accepted
          if(nullptr == application) continue;
          btn->setText(application->getApplicationName());
          break;
        }
      }
    }
    
    jsulmJ 1 Reply Last reply
    0
    • N Nani1504

      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()
      {
        m_ui->retranslateUi(this);
      
        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,
                                                    CTX_APPS_CONTEXT_INSTANCES,
                                                    name,
                                                    CTX_APPS_CONTEXT_APP);
            Utilities::ApplicationPlugins::ApplicationPluginInterfacePtr
            application = getAppConfig()->query()->getAttributeValue<
                          Utilities::ApplicationPlugins::ApplicationPluginInterfacePtr>(applicationPtrPath);
      
            //only valid application instances are accepted
            if(nullptr == application) continue;
            btn->setText(application->getApplicationName());
            break;
          }
        }
      }
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      N 1 Reply Last reply
      1
      • jsulmJ jsulm

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

        N Offline
        N Offline
        Nani1504
        wrote on last edited by Nani1504
        #3

        @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.

        jsulmJ 1 Reply Last reply
        0
        • N Nani1504

          @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.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

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

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          N 1 Reply Last reply
          0
          • jsulmJ jsulm

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

            N Offline
            N Offline
            Nani1504
            wrote on last edited by
            #5

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

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              Do you have this issue on dynamically created button ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              N 1 Reply Last reply
              0
              • SGaistS SGaist

                Hi,

                Do you have this issue on dynamically created button ?

                N Offline
                N Offline
                Nani1504
                wrote on last edited by
                #7

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

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  How exactly are you generating the text for them ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  N 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    How exactly are you generating the text for them ?

                    N Offline
                    N Offline
                    Nani1504
                    wrote on last edited by
                    #9

                    @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

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved