How to properly size QWebView?
General and Desktop
12
Posts
3
Posters
11.5k
Views
1
Watching
-
eh. What?
You want to fix window size to size of webpage? Why?You can write something like:
@
//...
QWebView *view;
QMainWindow *window = new QMainWindow();
window->setCentralWidget(view);
window->show();
@Or use some layout:
@
//...
QWidget window = new QWidget();
QLayout layout = new QLayout();
QWebView* view = new QWebView();layout->addWidget(view);
window->setLayout(layout);
window->show();
@This will keep your WebView expanding
-
peppy, I want to render an email in the smallest height possible for a given width (the width of the window) so that scroll bars are avoided. The first example does not attempt to limit the height of the widget, and the second does not work because it relies on sizeHint being accurate, which it isnt.