I have the following code, and I want to make my QWebEngineView
(Qt 5.8) to go full screen.
My WebView
class is contained in a QTabWidget
, so it just fills up the tab, not entire screen.
How can I make it go fullscreen?
class WebView:public QObject{
void acceptFullScreen(QWebEngineFullScreenRequest request){
request.accept();
}
public:
char* home_page;
QWebEngineView* view=new QWebEngineView();
WebView(char* page=(char*)"file:///home/tarptaeya/Desktop/Crusta_Prototype_python/about.html"){
this->home_page=page;
createWebView();
this->view->settings()->setAttribute(QWebEngineSettings::FullScreenSupportEnabled,true);
this->view->settings()->setAttribute(QWebEngineSettings::PluginsEnabled,true);
this->view->settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows,true);
connect(this->view->page(),&QWebEnginePage::fullScreenRequested,this,&WebView::acceptFullScreen);
}
void createWebView(){
this->view->load(QUrl(this->home_page));
}
}