开发者

QWebView: Stretch to fill screen size?

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,

Ma开发者_Go百科rk


My answer is the supplement of mrmcduff, please try the below method:

void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)

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.


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


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜