QDialog focus without window manager
I'm working on a touchscreen kiosk app and I'm having trouble setting focus on qdialog.
When dialog is shown it is not in focus and I first have to press somewhere inside the dialog before I can press on a button in the dialog. I'm setting dialog flags Qt::Dialog | Qt::FramelessWindowHint. I've tried overriding dialog showEvent and using setFocus, activateWindow and grabKeyboard methods but nothing works. However if I plug the mouse I can cllick on the button I want without having to click on the dialog first. It seems the dialog gains focus when the mouse is over it. I also have a QMessageBox which is displayed fine, without focus issues.
My window is a child of a stacked widget placed inside of MainWinow. That window is set as the parent of the dialog, but the dialog show method is called from QItemDelegate which set on a QListView placed inside that window.
I start the application with 'startx /etc/X11/Xsesion path/to/my/app -- -nocursor'. I'm running the app on ubuntu server 16.04 x64 with additional 'xinit', 'xserver-xorg-legacy' and 'x11-xserver-utils' packages installed.
链接地址: http://www.djcxy.com/p/6692.html上一篇: 用递归方法计算最长路径算法的复杂度
下一篇: 没有窗口管理器的QDialog焦点