QmlApplicationViewer::setFixedSize 未反映 xwininfo 中的相同大小
如何控制 QmlApplicationViewer 的大小?我使用 QmlApplicationViewer 作为 QML 应用程序的启动器,在 QML 中,我将大小设置为...
QmlApplicationViewer viewer;
viewer.setFixedSize(1280,720);
但在 X11 端,如果我查询大小。它与 Cpp 端请求的大小不匹配。
xwininfo -root -children | grep application_name
谁能告诉我,如何在 Qt/QML 代码中控制大小?
预先感谢您的任何提示。
How can one control the size of QmlApplicationViewer ? I am using QmlApplicationViewer as a launcher for QML application, and in QML, I set size as...
QmlApplicationViewer viewer;
viewer.setFixedSize(1280,720);
but on X11 side, if i query size. it does not match the size requested in Cpp side.
xwininfo -root -children | grep application_name
can anyone please tell, how can I control the size from with in Qt/QML code ?
Thanks in advance for any tip.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果无法让 WM 正常运行/或者没有窗口管理器,那么可以做的就是设置
这个标志位于你的顶级窗口的构造函数之后,并且
在 setFixedSize() 之前:
viewer.setWindowFlags(viewer.windowFlags() | Qt::X11BypassWindowManagerHint);
请注意此标志的文档:
“完全绕过窗口管理器。这会导致无边框
根本不受管理的窗口(即没有键盘输入,除非您
手动调用 QWidget::activateWindow())。”
What one could do, if one can't get WM to play nice/or has no window manager, is to set
this flag on your top-level window right after the constructor and
before the setFixedSize():
viewer.setWindowFlags(viewer.windowFlags() | Qt::X11BypassWindowManagerHint);
Please note the documentation for this flag:
"Bypass the window manager completely. This results in a borderless
window that is not managed at all (i.e., no keyboard input unless you
call QWidget::activateWindow() manually)."