Issue with Qt WebEngine, Missing DLLs, and Creating EXE Installer
-
@MyNameIsQt hi,
Did you run windeployqt before packing things with innosetup ?
These dlls alone are not all. There are plugins, QML files, etc.
-
This post is deleted!
-
@SGaist Yes, I ran windeployqt using Qt 6.8.2 (MSVC 2022 64-bit) before packaging the application.
I used windeployqt to deploy the necessary Qt libraries, plugins, QML files, and other dependencies required for the application to run correctly on the target system. This ensures that all the essential files are included for proper execution.
-
To clear thing up: are you able to start the application properly from the explorer once you have run windeployqt ?
-
Where are you loading your html from ?
-
@SGaist
What does it mean? Do you mean this?#include <QWebEngineSettings> #include <QWebEngineProfile> #include <QWebEnginePage> MyViewApplication::MyViewApplication(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MyViewApplication) , styleSheet() , windowSizeLabel(nullptr) , m_isCanvasLoaded(false) , webView(new QWebEngineView(this)) , channel(new QWebChannel(this)) , channelManager(new ChannelManager(this)) { setMinimumSize(960, 640); //setMinimumSize(960, 640); ui->setupUi(this); setCentralWidget(webView); QWebEngineProfile *profile = QWebEngineProfile::defaultProfile(); profile->setCachePath("C:/Users/user/Documents/Cache"); profile->setPersistentStoragePath("C:/Users/user/Documents/indexedDB"); webView->setPage(new QWebEnginePage(profile, webView)); webView->settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, true); webView->settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, true); webView->settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true); webView->page()->setDevToolsPage(new QWebEnginePage(this)); QString htmlPath = QFileInfo(__FILE__).dir().absolutePath() + "/main.html"; QFile file(htmlPath); if (file.exists()) { webView->load(QUrl::fromLocalFile(htmlPath)); } else { qDebug() << "Failed to load main.html. File not found."; } webView->page()->setWebChannel(channelManager->getChannel()); channelManager->registerObject("MyViewApplication", this); createStatusBar(); initResources(); showMaximized(); QAction *openDevToolsAction = new QAction("Open DevTools", this); connect(openDevToolsAction, &QAction::triggered, this, [this]() { QWebEngineView *devToolsView = new QWebEngineView(); devToolsView->setPage(webView->page()->devToolsPage()); devToolsView->resize(800, 600); devToolsView->show(); }); addAction(openDevToolsAction); openDevToolsAction->setShortcut(QKeySequence("F12")); }
main.cpp
#include "MyViewApplication.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MyViewApplication w; w.show(); return a.exec(); }
-
@MyNameIsQt said in Issue with Qt WebEngine, Missing DLLs, and Creating EXE Installer:
QString htmlPath = QFileInfo(FILE).dir().absolutePath() + "/main.html";
How is this going to work?!
Either put the HTML file into a recourse file or deploy the HTML file together with the application and construct correct path at runtime using https://doc.qt.io/qt-6/qstandardpaths.html#locate -