Qt tr for internationalisation does not work in main function?

The translation function tr is a static method of QObject. Since QWidget is a subclass of QObject, tr is available in methods of QWidget, but in main() you have to use QObject::tr in order to use the function, as shown below.

#include <QObject>
int main(int argc, char *argv[])
{   
    QApplication a(argc, argv);
    QDialog dialog; 
    QString temp = QObject::tr("dadasda");//works fine
    dialog.show();
    return a.exec();
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)