Initial testing using QWebEngineView

This commit is contained in:
Jørgen Herje 2023-06-19 16:07:58 +02:00
parent 67c46288d8
commit fd962faebd
3 changed files with 21 additions and 7 deletions

View File

@ -18,9 +18,9 @@ set(QRC_FILES ${QRC_FILES} textedit.qrc)
find_package( find_package(
Qt5 Qt5
COMPONENTS COMPONENTS
REQUIRED Core Gui Widgets OpenGL Svg REQUIRED Core Gui Widgets OpenGL Svg WebEngineWidgets
) )
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL Qt5::Svg) set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL Qt5::Svg Qt5::WebEngineWidgets)
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
qt5_add_resources(QRC_FILES_CPP ${QRC_FILES}) qt5_add_resources(QRC_FILES_CPP ${QRC_FILES})

View File

@ -49,6 +49,7 @@
#include <QMenuBar> #include <QMenuBar>
#include <QTreeView> #include <QTreeView>
#include <QUndoView> #include <QUndoView>
#include <QWebEngineView>
class DemoPdmObjectGroup : public caf::PdmDocument class DemoPdmObjectGroup : public caf::PdmDocument
{ {
@ -1180,7 +1181,14 @@ MainWindow::MainWindow()
m_plotLabel->setPixmap( pix.scaled( 250, 100 ) ); m_plotLabel->setPixmap( pix.scaled( 250, 100 ) );
m_smallPlotLabel = new QLabel( this ); m_smallPlotLabel = new QLabel( this );
m_smallPlotLabel->setPixmap( pix.scaled( 100, 50 ) ); m_smallPlotLabel->setPixmap( pix.scaled( 1000, 500 ) );
m_webView = new QWebEngineView( this );
m_webView->load( QUrl( "https://www.google.com" ) );
/*m_webView->load( QUrl::fromLocalFile(
"D:/Git/ResInsight/build/Fwk/AppFwk/cafTests/cafTestApplication/RelWithDebInfo/HTML-dist/index.html" ) );*/
/*m_webView->load( QUrl::fromLocalFile(
"D:/Git/ResInsight/build/Fwk/AppFwk/cafTests/cafTestApplication/RelWithDebInfo/HTML-dist/testIndex.html" ) );*/
createActions(); createActions();
createDockPanels(); createDockPanels();
@ -1377,15 +1385,18 @@ void MainWindow::setPdmRoot( caf::PdmObjectHandle* pdmRoot )
m_customObjectEditor->removeWidget( m_plotLabel ); m_customObjectEditor->removeWidget( m_plotLabel );
m_customObjectEditor->removeWidget( m_smallPlotLabel ); m_customObjectEditor->removeWidget( m_smallPlotLabel );
m_customObjectEditor->removeWidget( m_webView );
if ( obj.size() == 1 ) if ( obj.size() == 1 )
{ {
m_customObjectEditor->setPdmObject( obj[0] ); m_customObjectEditor->setPdmObject( obj[0] );
m_customObjectEditor->defineGridLayout( 5, 4 ); m_customObjectEditor->defineGridLayout( 1, 1 );
m_customObjectEditor->addBlankCell( 0, 0 ); //m_customObjectEditor->addBlankCell( 0, 0 );
m_customObjectEditor->addWidget( m_plotLabel, 0, 1, 1, 2 ); //m_customObjectEditor->addWidget( m_plotLabel, 0, 1, 1, 2 );
m_customObjectEditor->addWidget( m_smallPlotLabel, 1, 2, 2, 1 ); //m_customObjectEditor->addWidget( m_smallPlotLabel, 1, 2, 2, 1 );
m_customObjectEditor->addWidget( m_webView, 0, 0, 1, 1 );
} }
else else
{ {

View File

@ -3,6 +3,7 @@
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QItemSelection> #include <QItemSelection>
#include <QMainWindow> #include <QMainWindow>
#include <QWebEngineView>
class DemoPdmObject; class DemoPdmObject;
class DemoPdmObjectGroup; class DemoPdmObjectGroup;
@ -68,4 +69,6 @@ private:
QLabel* m_plotLabel; QLabel* m_plotLabel;
QLabel* m_smallPlotLabel; QLabel* m_smallPlotLabel;
QWebEngineView* m_webView;
}; };