Solved How do I Install QT Web Engine for QT 6.3.1 ?
-
Hello, I am a beginner using QT Creator 6.3.1 with the MinGW 11.2 compiler trying to learn how to make my first GUI app in C++. I need QT Web engine for my project, and I'm having trouble getting set up.
My goal is to just be able to drag and drop a web engine widget component into my window designer .UI file and go from there for a separate web window I'm building in my app. I want to use this instead of something like electron so I can get the barebones functionality and performance of C++ and not be restricted to JavaScript and HTML.
Little intro aside, I've looked all over the QT's documentation trying to successfully install the QT Web Engine and its components but have had no luck. I thought it would be as simple as just checking the module on the installer, installing it, and including it in a header file but I was wrong.
So far I have it installed as a module through the qt installer, and have added the required lines to my CMake file:
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Core WebEngineWidgets )
target_link_libraries(ProjName PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt6::Core Qt::WebEngineWidgets)But when I build I get an error saying: Target "ProjName links to Qt::WebEngineWidgets but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing.
I've read in some forms that I may need to build the module from source with another compiler, but don't know where to start with proper instructions. If this is true, why is it enlisted as an option in the installer if it doesn't work once installed? If anyone could help me with this, that would be great. I appreciate your time and patience.
-
Is there any guide to getting MSVC and compiling it for QT? I've never done it before.
-
Hi, and welcome!
@firstbloodcpp said in How do I Install QT Web Engine for QT 6.3.1 ?:
MinGW 11.2 compiler
Unfortunately, Chromium does not support MinGW -- it only supports MSVC.
You'll need to change compilers (and download the MSVC kit) to use Qt WebEngine.
-
Is there any guide to getting MSVC and compiling it for QT? I've never done it before.
-
@firstbloodcpp said in How do I Install QT Web Engine for QT 6.3.1 ?:
getting MSVC
https://visualstudio.microsoft.com/downloads/
compiling it for QT
After you install MSVC, run your Qt installer. Download a copy of Qt that is marked "MSVC" instead of "MinGW"
-
Ok thanks, so far I've got a new install of QT 6.3.1 running with MSVC on a fresh new project just for testing. I've been able to successfully build when I include the webenginewidgets module in my .pro file.
The problem now is I can't find the web engine view widget to drag and drop into my form. Do I have to install something else?
-
@firstbloodcpp said in How do I Install QT Web Engine for QT 6.3.1 ?:
The problem now is I can't find the web engine view widget to drag and drop into my form.
It's a known problem with Qt Creator: https://bugreports.qt.io/browse/QTCREATORBUG-27807
You can add
QWebEngineView
dynamically using C++ code. -
Alright, thanks for letting me know. I was actually able to copy and paste the widget in my project's designer from an example project. Sort of finessed it. Got everything to compile and run now. Do you know when that issue will be fixed?
-
@firstbloodcpp said in How do I Install QT Web Engine for QT 6.3.1 ?:
Alright, thanks for letting me know. I was actually able to copy and paste the widget in my project's designer from an example project. Sort of finessed it. Got everything to compile and run now.
Great!
Do you know when that issue will be fixed?
Nope. Follow the bug report to get updates.