QT中函数void Dialog:changeEvent 什么作用
1个回答
展开全部
//change event一般是当前widget状态改变后触发的
//如字体改变、语言改变之类的。
//该方法主要捕获改变事件,当语言改变后,执行相关操作。
void player::changeEvent(QEvent *e) //重写的事件处理方法
{
QDialog::changeEvent(e); //让基类执行事件处理方法
switch (e->type()) { //根据事件类型判别
case QEvent::LanguageChange: //如果是语言改变事件
<a href="https://www.baidu.com/s?wd=ui&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLPAw-PvF9P16Ym1Tsn1KW0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHmzPjTvrjcY" target="_blank" class="baidu-highlight">ui</a>->retranslate<a href="https://www.baidu.com/s?wd=Ui&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLPAw-PvF9P16Ym1Tsn1KW0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHmzPjTvrjcY" target="_blank"class="baidu-highlight">Ui</a>(t<a href="https://www.baidu.com/s?wd=hi&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLPAw-PvF9P16Ym1Tsn1KW0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHmzPjTvrjcY" target="_blank" class="baidu-highlight">hi</a>s); //更新<a href="https://www.baidu.com/s?wd=UI&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLPAw-PvF9P16Ym1Tsn1KW0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHmzPjTvrjcY" target="_blank" class="baidu-highlight">UI</a>的语言(看方法字面的,用户自定义方法)
break;
default:
break;
}
}
//如字体改变、语言改变之类的。
//该方法主要捕获改变事件,当语言改变后,执行相关操作。
void player::changeEvent(QEvent *e) //重写的事件处理方法
{
QDialog::changeEvent(e); //让基类执行事件处理方法
switch (e->type()) { //根据事件类型判别
case QEvent::LanguageChange: //如果是语言改变事件
<a href="https://www.baidu.com/s?wd=ui&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLPAw-PvF9P16Ym1Tsn1KW0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHmzPjTvrjcY" target="_blank" class="baidu-highlight">ui</a>->retranslate<a href="https://www.baidu.com/s?wd=Ui&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLPAw-PvF9P16Ym1Tsn1KW0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHmzPjTvrjcY" target="_blank"class="baidu-highlight">Ui</a>(t<a href="https://www.baidu.com/s?wd=hi&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLPAw-PvF9P16Ym1Tsn1KW0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHmzPjTvrjcY" target="_blank" class="baidu-highlight">hi</a>s); //更新<a href="https://www.baidu.com/s?wd=UI&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLPAw-PvF9P16Ym1Tsn1KW0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPHmzPjTvrjcY" target="_blank" class="baidu-highlight">UI</a>的语言(看方法字面的,用户自定义方法)
break;
default:
break;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询