I need to use QTWebKit with CTS-3D support, which is why I used QGraphicsWebView and QGLWidget The code looks like this:
MainWindow.hpp: Main window.cpp: The problem is that web_view does not fill the QMainWindow widget. What should I do to fill up the website? - & gt; You should also add your widget to the layout (the size of the property is a layout behavior, so you have to put your widget in the layout) QVboxLayout is good for your needs.
# Include & lt; QMainWindow & gt; # Include & lt; QGraphicsScene & gt; # Include & lt; QGraphicsView & gt; # Include & lt; QGraphicsWebView & gt; Classroom Main Window: Public QMainWindow {Q_OBJECT; Public: Main Window (Const. 4 * URL); Zero init (); Private: QGraphicsView * gview; QGraphicsScene * view; QGraphicsWebView * web_view; };
#include "MainWindow Hpp "# & lt; QWebSettings & gt; Include # include & lt; QGLWidget & gt; # Include & lt; QStatusBar & gt; Main window: Main Wando (Const four * URL) {Set Windottitle ("Qt WebKit Experiment"); QWebSettings :: globalSettings () - & gt; Set Attribute (QWebSettings :: Accelerated Compositing Enabled, Enabled); Gview = New QGraphicsView (this); Gview-> SetViewportUpdateMode (QGraphicsView :: FullViewportUpdate); Gview-> SetViewport (new QGLWidget (this)); View = New QGraphicsScene (gview); Web_view = new QGraphicsWebView (); Scene-> AddItem (web_view); Gview-> SetScene (view); Web_view-> Load (QString (URL)); Web_view-> SetResizesToContents (right); SetCentralWidget (GView); } Zero MainWindow :: init () {show (); }
Comments
Post a Comment