int ret = QMessageBox::question(this, "Название", "Вопрос ?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
QMessageBox mb( app_header, tr("Утвердить?"), QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No | QMessageBox::Default | QMessageBox::Escape , QMessageBox::NoButton ); mb.setButtonText(QMessageBox::Yes, tr("Да")); mb.setButtonText(QMessageBox::No, tr("Отмена")); if( mb.exec() == QMessageBox::Yes )
QTranslator * qt_translator = new QTranslator;if ( !qt_translator->load( "qt_ru.qm" ) ){ delete qt_translator; return false;}qApp->installTranslator( qt_translator );..// install additional translators for your application..return true;
<RCC> <qresource prefix="/icons" > <file>icons/preferences.png</file> <file>icons/printer.png</file> </qresource> <qresource prefix="/tr" > <file>qt_ru.qm</file> </qresource></RCC>
QTranslator *qt_translator = new QTranslator; if ( qt_translator->load( ":tr/qt_ru.qm" ) ) { application->installTranslator( qt_translator ); }