[PyQt] QTranslator and QFileDialog problems

Eugen eugen.koller at gmail.com
Fri Jun 25 10:14:58 BST 2010


I have some problems with translations of QFileDialog. In the example
below "dlg2" appears in English on my Windows XP development machine,
the rest in German. "dlg1" looks like a Qt custom dialog and "dlg2"
like the windows standard file dialog but with an old icon theme. On
other computers I have tested this (Ubuntu, Windows 7 and 2000) all
dialogs are in german. How can I get more information about what file
dialog Qt is using here and also what kind of theme is used there?

import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *

app = QApplication(sys.argv)

qtTranslator = QTranslator()
if qtTranslator.load("qt_de",
                     QLibraryInfo.location(QLibraryInfo.TranslationsPath)):
    app.installTranslator(qtTranslator)

dlg1 = QFileDialog(None, "Dialog 1", ".", "All files (*.*)")
dlg1.open()
dlg2 = QFileDialog.getOpenFileName(None, "Dialog 2", ".", "All files (*.*)")
dlg3 = QMessageBox.question(None,
                            "Dialog 3",
                            "Frage?",
                            QMessageBox.Yes|QMessageBox.No|
                            QMessageBox.Cancel)

sys.exit(app.exec_())


More information about the PyQt mailing list