Solved Opening a URL in a widget using QTWebEngineView
-
Hi All
I want to open up a webpage, but display it in a widget other than centralWidget, how do I do this?
My code:
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QUrl> #include <QWebEngineView> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); view = new QWebEngineView(this); connect(ui->web, SIGNAL(clicked(bool)),this,SLOT(webclick())); } MainWindow::~MainWindow() { delete ui; } void MainWindow::webclick() { QUrl site("http://www.gogle.co.uk"); view->load(site); }
i have a a widget labelled ui->screen in which I want to display the website.
Ta
J
-
@James-Sprinks said in Opening a URL in a widget using QTWebEngineView:
ui->screen in which I want to display the website.
You have to add a layout to that widget (call it
screenLayout
then from the constructor callui->screenLayout->addWidget(view);
or, if you want
ui->screen
to become the view then removeview
altogether, right click onui->screen
in designer and promote toQWebEngineView
then directly callui->screen->load(site)
-
-
@James-Sprinks said in Opening a URL in a widget using QTWebEngineView:
Hoq do I add a layout?
right click on the widget->layout
it will not let me promote the widget to QWebEngineView
then add, select it and click promote
-
@VRonin All I can do is change the size...
-
@James-Sprinks said in Opening a URL in a widget using QTWebEngineView:
All I can do is change the size...