void Area::showChangeLanguageBox()
{
QMessageBox msg(this->pluginWidget);
msg.setIcon(QMessageBox::Warning);
msg.setText(tr("Modification of system language needs to be logged out to take effect, whether to log out?"));
msg.addButton(tr("Log out later"), QMessageBox::NoRole);
msg.addButton(tr("Log out now"), QMessageBox::ApplyRole);
int ret = msg.exec();
if (ret == 1) {
system("ukui-session-tools --logout");
}
return;
}
要注意,ret的值实际上与addButton设置的 ButtonRole role 没有关系
本文介绍了一个用于确认系统语言更改操作的对话框实现方法,该对话框使用Qt库创建,并提供两个选项:立即注销以使更改生效或稍后注销。
1045

被折叠的 条评论
为什么被折叠?



