0
我有一些問題翻譯QActions
在翻譯文件有翻譯FILETAB_ *絃樂
但在應用這些翻譯不使用,用戶看到
FILETAB_OPEN_FILE例如。
任何人都可以幫忙嗎?的QAction翻譯
void Application::setLanguage(const QString& locale)
{
// remove previous
if (current)
{
removeTranslator(current);
}
current_locale=locale;
// install new
current = translators.value(locale, 0);
if (current)
{
installTranslator(current);
}
}
void MainWindow::changeEvent(QEvent *event)
{
if (event->type()==QEvent::LanguageChange)
{
retranslateUi(this);
}
QMainWindow::changeEvent(event);
}
void MainWindow::setupFileTabel()
{
fileTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
fileTableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
setupFileTabelContextMenu();
}
void MainWindow::setupFileTabelContextMenu()
{
fileTabMenu = new QMenu(fileTableWidget);
openFile = new QAction(tr("FILETAB_OPEN_FILE"), fileTabMenu);
QObject::connect(openFile, SIGNAL(triggered()), this, SLOT(OpenFileSelected()));
fileTabMenu->addAction(openFile);
openDir = new QAction(tr("FILETAB_OPEN_FOLDER"), this);
QObject::connect(openDir, SIGNAL(triggered()), this, SLOT(OpenDirSelected()));
fileTabMenu->addAction(openDir);
fileTabMenu->addSeparator();
priority = new QMenu(fileTabMenu);
priority->setTitle(tr("FILETAB_PRIORITY"));
lowPriority = new QAction(tr("FILETAB_PRIORITY_LOW"), fileTabMenu);
lowPriority->setCheckable(true);
QObject::connect(lowPriority, SIGNAL(triggered()), this, SLOT(setLowForCurrentFile()));
priority->addAction(lowPriority);
mediumPriority = new QAction(tr("FILETAB_PRIORITY_MEDIUM"), fileTabMenu);
mediumPriority->setCheckable(true);
QObject::connect(mediumPriority, SIGNAL(triggered()), this, SLOT(setMediumForCurrentFile()));
priority->addAction(mediumPriority);
highPriority = new QAction(tr("FILETAB_PRIORITY_HIGH"), fileTabMenu);
highPriority->setCheckable(true);
QObject::connect(highPriority, SIGNAL(triggered()), this, SLOT(setHighForCurrentFile()));
priority->addAction(highPriority);
fileTabMenu->addMenu(priority);
fileTabMenu->addSeparator();
dontDownload = new QAction(tr("FILETAB_PRIORITY_ZERO"), fileTabMenu);
dontDownload->setCheckable(true);
QObject::connect(dontDownload, SIGNAL(triggered()), this, SLOT(setNotDownloadForCurrentFile()));
fileTabMenu->addAction(dontDownload);
}