Qt 5 QDialogButtonBox translate not working
Hello,
I switched from Qt 4 to Qt 5 and everything is working, but all buttons from QDialogButtonBox are not translating
This is my cmake:
Code:
set (TRANSLATION_SRCS
qt_pl.ts
scc_pl.ts
)
set (TRANSLATION_QM
qt_pl.qm
scc_pl.qm
)
# translation
qt5_add_translation (TRANSLATION_FILES ${TRANSLATION_SRCS})
add_custom_target (translations DEPENDS ${TRANSLATION_FILES})
# translations
add_dependencies (scc translations)
# install
if (UNIX AND NOT APPLE)
install (FILES ${TRANSLATION_QM} DESTINATION ${SCC_DATA_DIR}/translations)
endif (UNIX AND NOT APPLE)
how I load translate (with debug)
Code:
// load translate
qDebug() << "path:" << q;
qDebug() << "load:" << load;
if (load)
qApp->installTranslator(&qtTranslator);
if (sccTranslator.
load(QString("%1/translations/scc_%2").
arg(path, strLanguage
))) qApp->installTranslator(&sccTranslator);
debug result:
Code:
path: "qt_pl"
load: true
Normal load translate:
Code:
// load translate
if (qtTranslator.
load(QString("%1/translations/qt_%2").
arg(path, strLanguage
))) qApp->installTranslator(&qtTranslator);
if (sccTranslator.
load(QString("%1/translations/scc_%2").
arg(path, strLanguage
))) qApp->installTranslator(&sccTranslator);
main cmake:
Code:
# Tell CMake to run moc when necessary:
set(CMAKE_AUTOMOC ON)
# As moc files are generated in the binary dir, tell CMake
# to always look for includes there:
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# qt
find_package(Qt5Widgets)
find_package(Qt5Multimedia)
find_package(Qt5Network)
#find_package(Qt5LinguistTools)
find_package(Qt5WebKit)
find_package(Qt5WebKitWidgets)
find_package(Qt5Xml)
# include qt qtnetwork
include_directories (
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/common
${CMAKE_CURRENT_SOURCE_DIR}/core
${CMAKE_CURRENT_SOURCE_DIR}/gui
${CMAKE_CURRENT_SOURCE_DIR}/models
${CMAKE_CURRENT_SOURCE_DIR}/onet
${CMAKE_CURRENT_SOURCE_DIR}/tab
${CMAKE_CURRENT_SOURCE_DIR}/widgets
)
# resources
set (scc_QRC ../scc.qrc)
qt5_add_resources (scc_QRC_SRCS ${scc_QRC})
# ui
qt5_wrap_ui (scc_UIS_H ${scc_UIS})
# moc
qt5_generate_moc (scc MOC_FILES ${scc_MOC_HDRS})
# resource
set (scc_RESOURCE ../scc_mingw.rc)
include_directories (${CMAKE_SOURCE_DIR}/ui)
# link
if (MINGW) # mingw
add_executable (scc ${scc_SRCS} ${MOC_FILES} ${scc_HDRS} ${scc_QRC_SRCS} ${scc_UIS_H} ${scc_RESOURCE})
else (MINGW) # linux
add_executable (scc ${scc_SRCS} ${MOC_FILES} ${scc_HDRS} ${scc_QRC_SRCS} ${scc_UIS_H})
endif (MINGW)
target_link_libraries (scc Qt5::Widgets Qt5::Multimedia Qt5::Network Qt5::WebKit Qt5::WebKitWidgets Qt5::Xml ${QCA2_LIBRARIES})
# install
if (UNIX AND NOT APPLE)
install (TARGETS scc DESTINATION ${SCC_BIN_DIR})
endif (UNIX AND NOT APPLE)
How it looks in qt creator: (good-translated)
Attachment 10498
and how it looks in application: (wrong-not translated)
Attachment 10499
so, what I do wrong ?
and why load returns true and button is not translated ?
I'm using Qt 5.3.1 mingw