We are developing a Qt Desktop application. Application can open multiple files one in each tab, and each tab (file) has its own context. User can open multiple files and switch among these tabs.

e.g. : Like one tab is of Truck management for which action (add_Vehicle) in tool bar should display tool-tip "Add Truck", and if another tab is of Car Management same action should display tool-tip "Add Car".

There are many things like this :


  1. If I delete truck (i.e. Vehicle from Truck management tab) it should show message box "Truck deleted successfully." and if car (i.e. Vehicle from Car management tab) is deleted "Car deleted successfully" message should be shown.

  2. There are some dialogs in which texts are directly set to the QLabels through QtDesinger.



How This problem is arised?

Previously the application is supporting only Truck management, Now we are adding support for car management in same application. All messages/UI labels/ Tool-tips are using "Truck". Now We want to change it according to the tab (file) opened.

Feasible thought solution :(Not working at run-time)

All UILabels/ToolTips/Messages are translatable [i.e. written with QObject::tr(..)]. We thought of installing QTranslator according to tab context which will automatically change the texts at all places. Installing QTranslator run-time is not working.

Is there another way of doing this? Or any pointer/hints will be very helpful.