Sizing QWebView with expanding window

十年热恋 提交于 2019-12-11 05:49:44

问题


How would i go about sizing the QWebView window with the size of the window? Right now i see i can only give it certain dimensions, but how can i make it 100% width and 100% height, and change as i make a window bigger or smaller?

Basically if i was to resize, it would resize the QWebview as well. How do i go about this?

I see there is size dimensions but i dont see how to have it resize based on the window app.


回答1:


Add your QWebView inside a layout.

QWebView *webView = new QWebView;
QVBoxLayout *layout = new QVBoxLayout;
this->centralWidget()->setLayout(layout);
layout->addWidget(webView);

You can read more about layout management here.



来源:https://stackoverflow.com/questions/22216365/sizing-qwebview-with-expanding-window

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!