[英]How to catch keyboard layout change
I have several issues: 我有几个问题:
I tried this first: 我首先尝试了这个:
bool MyWindow::event(QEvent* e)
{
if (e->type() == QEvent::KeyboardLayoutChange)
qDebug() << "Keyboard Layout Changed";
return QWidget::event(e);
}
But this type of event is never passed. 但是这种事件永远不会过去。 Also, I have no idea how to solve the other 2 issues.
另外,我也不知道如何解决其他两个问题。
Could you please show me any workable example on the latest Qt version or some other cross-platform solutions of this problem? 您能否告诉我有关最新Qt版本或此问题的其他一些跨平台解决方案的任何可行示例?
Qt 5.0.2 Qt 5.0.2
Windows 7 Visual Studio 2012 Windows 7 Visual Studio 2012
Ubuntu 12.04 G++ 4.7.0 Ubuntu 12.04 G ++ 4.7.0
There is no cross-platform solution to get the keyboard language or to change its layout from within Qt. 没有跨平台的解决方案来获取键盘语言或从Qt内部更改其布局。 You'll need platform-specific solutions: one for Windows, one for X11.
您将需要特定于平台的解决方案:一个用于Windows,一个用于X11。 In the future you'd need Wayland as well, I'd presume.
我想,将来您也需要Wayland。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.