Use command's tootltip as statustip if no statustip is specified.

This commit is contained in:
Markus Lampert
2017-09-19 21:11:37 -07:00
committed by wmayer
parent 5150737031
commit 1c9223d300

View File

@@ -1281,18 +1281,19 @@ void PythonGroupCommand::languageChange()
QList<QAction*> a = pcAction->actions();
for (QList<QAction*>::iterator it = a.begin(); it != a.end(); ++it) {
Gui::Command* cmd = rcCmdMgr.getCommandByName((*it)->property("CommandName").toByteArray());
// Python command use getName as context
if (dynamic_cast<PythonCommand*>(cmd)) {
if (cmd) {
// Python command use getName as context
const char *context = dynamic_cast<PythonCommand*>(cmd) ? cmd->getName() : cmd->className();
const char *tooltip = cmd->getToolTipText();
const char *statustip = cmd->getStatusTip();
if (!statustip || '\0' == *statustip) {
statustip = tooltip;
}
(*it)->setIcon(Gui::BitmapFactory().iconFromTheme(cmd->getPixmap()));
(*it)->setText(QApplication::translate(cmd->getName(), cmd->getMenuText()));
(*it)->setToolTip(QApplication::translate(cmd->getName(), cmd->getToolTipText()));
(*it)->setStatusTip(QApplication::translate(cmd->getName(), cmd->getStatusTip()));
}
else if (cmd) {
(*it)->setIcon(Gui::BitmapFactory().iconFromTheme(cmd->getPixmap()));
(*it)->setText(QApplication::translate(cmd->className(), cmd->getMenuText()));
(*it)->setToolTip(QApplication::translate(cmd->className(), cmd->getToolTipText()));
(*it)->setStatusTip(QApplication::translate(cmd->className(), cmd->getStatusTip()));
(*it)->setText(QApplication::translate(context, cmd->getMenuText()));
(*it)->setToolTip(QApplication::translate(context, tooltip));
(*it)->setStatusTip(QApplication::translate(context, statustip));
}
}
}