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. When you change the text of a control several times.
Forum Updated to NodeBB v4.3 + New Features

When you change the text of a control several times.

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 402 Views
  • 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.
  • I Offline
    I Offline
    IknowQT
    wrote on last edited by
    #1

    I'm working on changing languages using a .qm file, and sometimes I have to change the text of a control several times. For example, there is an Add button, but if you change the radio button option, the Add button changes to Del.

    In this case, how do I get the language when I work with the .qm file in multiple languages?

    J.HilkJ 1 Reply Last reply
    0
    • I IknowQT

      I'm working on changing languages using a .qm file, and sometimes I have to change the text of a control several times. For example, there is an Add button, but if you change the radio button option, the Add button changes to Del.

      In this case, how do I get the language when I work with the .qm file in multiple languages?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @IknowQT

      can you be a bit more clear on what you want to do/ what doesn't work ?

      As long as your translation is ok, it doesn't matter to what text you set your Button


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      1
      • I Offline
        I Offline
        IknowQT
        wrote on last edited by
        #3

        Sorry, it might be hard to understand because my English is weak.
        Let me give you an example.

        QPushButton* pbtn = new QPushButton(tr("btnTest"));

        Let's just say we've done a lot of multilingual work on pbtn with btnTest like this way.
        By the way, I

        if( bVisible )
        {
        pbtn->setText("Add");
        }
        else
        {
        pbtn->setText("Del");
        }

        I want to know how to define and import Add, Del from a qm file.

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @IknowQT said in When you change the text of a control several times.:

          I want to know how to define and import Add, Del from a qm file.

          According to the documentation with tr()

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          4

          • Login

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