[PyQt] QTranslator and QFileDialog problems
list at qtrac.plus.com
Fri Jun 25 12:35:21 BST 2010
On 2010-06-25, Eugen wrote:
> 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",
> dlg1 = QFileDialog(None, "Dialog 1", ".", "All files (*.*)")
> dlg2 = QFileDialog.getOpenFileName(None, "Dialog 2", ".", "All files
> (*.*)") dlg3 = QMessageBox.question(None,
> "Dialog 3",
The rule of thumb is that Qt uses the native file dialog where one is
available. As for the English vs. German Qt will respect the machine's
locale unless you override it as you're doing here. So maybe you don't
have the qt_de.qm file on your XP machine?
You can tell Qt not to use native dialogs:
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
C++, Python, Qt, PyQt - training and consultancy
"Advanced Qt Programming" - ISBN 0321635906
I ordered a Dell netbook with Ubuntu...
I got no OS, no apology, no solution, & no refund (so far)
More information about the PyQt