Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. What was changed with QObject::tr(key) in QT6?
Forum Updated to NodeBB v4.3 + New Features

What was changed with QObject::tr(key) in QT6?

Scheduled Pinned Locked Moved Solved Qt 6
translation
3 Posts 2 Posters 499 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.
  • D Offline
    D Offline
    Dmitriano
    wrote on last edited by Dmitriano
    #1

    Can't say for sure, how it worked in QT5, but at least I was able to translate my strings with

    QQuickItem::tr("<key>")
    

    and it worked like

    QCoreApplication::translate("<class name>", "<key>")
    

    where <class name> is the name of my class derived from QQuickItem.

    but in QT6 it stopped working.

    What was changed?

    Probably in QT6 ?

    Translation context with fully qualified class name with the namespace (as p_object->metaObject()->className() returns) does not help.

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

      I don't think anything changed. If so also lupdate would create a new entry. Please provide a minimal, compilable example.

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

      D 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        I don't think anything changed. If so also lupdate would create a new entry. Please provide a minimal, compilable example.

        D Offline
        D Offline
        Dmitriano
        wrote on last edited by
        #3

        @Christian-Ehrlicher Yes, nothing changes, but I moved my class to a namespace.

        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