QWebView:拉伸以填充屏幕尺寸?
我是 QT 移动开发的新手,正在尝试研究如何拉伸 QWebView 以填充整个用户屏幕。我找到了 showFullScreen() 方法,但它似乎没有做任何事情。
有人可以建议这是否可能吗?
谢谢,
马克
I'm new to QT mobile development and am trying to work out how to stretch a QWebView to fill the entire user screen. I found the showFullScreen() method but it doesn't seem to do anything.
Can anybody advise if this is possible?
Thanks,
Mark
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我的答案是mrmcduff的补充,请尝试下面的方法:
将两个参数都设置为
QSizepolicy::Expanding
,写一个demo来测试一下,对Qt布局应该很有用,至少我是这么认为的。My answer is the supplement of mrmcduff, please try the below method:
set both of the parameters to be
QSizepolicy::Expanding
, write a demo to test and view it, it should be very useful to Qt layout, at least I think so.您需要将 QWebView 对象放入布局中。对于使用 qt 的任何类型的 UI 实现,了解布局管理都很重要。
以下链接可以帮助您:
http://doc.qt.io/qt-5 /layout.html
http://doc.qt.io/qt -5/designer-layouts.html
You need to put QWebView object in the layout. For any kind of UI implementation using qt it is important to understand layout management.
Following links can help you in that:
http://doc.qt.io/qt-5/layout.html
http://doc.qt.io/qt-5/designer-layouts.html
确保 QWebView 所在的布局具有 0 边距。您可能想验证您是否意外地在 QWebView 中添加了填充或边距。您还需要将尺寸策略设置为拉伸。
您使用的是哪个版本的 Qt?
Be sure the layout you've got the QWebView in has 0 margin. You may want to verify that you're not accidentally adding padding or margin inside QWebView. You also want to set your size policy to stretch.
Which version of Qt are you using?