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. Dynamic Widget Translation in QTabWidget
Forum Updated to NodeBB v4.3 + New Features

Dynamic Widget Translation in QTabWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 276 Views 2 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.
  • C Offline
    C Offline
    Creatorczyk
    wrote on last edited by
    #1

    Hi,

    My application consists of the QTabWidget system in the main window. I implemented a language change in my application. When it calls in mainwindow:

    ui->retranslateUi(this);
    

    only QMainWindow elements are translated. Unfortunately, the QWidgets in QTabWidget are not translated. How could he translate them?

    artwawA 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Do you construct the tabs from code?

      1 Reply Last reply
      1
      • C Creatorczyk

        Hi,

        My application consists of the QTabWidget system in the main window. I implemented a language change in my application. When it calls in mainwindow:

        ui->retranslateUi(this);
        

        only QMainWindow elements are translated. Unfortunately, the QWidgets in QTabWidget are not translated. How could he translate them?

        artwawA Offline
        artwawA Offline
        artwaw
        wrote on last edited by mrjj
        #3

        @Creatorczyk Like @mrjj's question suggests only designer elements are translated (to be precise - those from UI file that qmake knows of when generates ui header file). My solution to dynamically (in code) created actions/elements is to add tr() calls to changeEvent(). Works every time.

        For more information please re-read.

        Kind Regards,
        Artur

        1 Reply Last reply
        1

        • Login

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