Line: 1: Qt Quick emulation layer crashed - qt

I created an empty QT Quick Application. my compiler is MinGW 64.
My project has main.qml file:
import QtQuick 2.14
import QtQuick.Window 2.14
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
}
but when I want to see its UI in designer it gives me an error:
Line: 1: Qt Quick emulation layer crashed.
I change User fallback QML emulation layer to "C:\Qt\Qt5.14.0\Tools\QtCreator\bin" but it does not work.

I had the same misbehaviour with my fresh Qt Creator installation on Ubuntu 20.04 with Qt6.
I solved my specific misbehaviour with the installation and usage of Qt5.12. In the Qt Quick Settings I chose the new installed Qt5.12 installation.

Related

Module QtCharts not installed - Qt Quick for Python

I am new to Qt Quick for Python and I have a problem importing QtCharts in the QML file.
This image explain my whole Problemmodule QtCharts not installed
I allready verified the installation from the Qt Maintenance Tool.
Do you have any Suggestion ?
Thanks !

QML QtGraphicalEffects is not Installed

I am trying to build any random QML component, and having this line import QtGraphicalEffects 1.15 will cause an error: 'module "QtGraphicalEffects" is not installed`
I am running on a virtual machine and just created a new virtual environment with Pyside6 and Python using pip install PySide6==6.1.2 to get the latest version. I can find the folder GraphicalEffects with a qtgraphicaleffectsplugin.dll in the Qt5Compat folder of the PySide6 Lib so I do not know why it cannot import this module. The other ones like QtQuick.Controls import fine.
I have also used print("Qt version: " + str(QtCore.qVersion())) to double check Qt version, and I get Qt version: 6.1.2
There seems to be some solutions in other discussion posts, but I have not found one that refers to Python side of things. I am aware Qt 6.0 does not seem to have QtGraphicalEffects, but it's supposed to be in 6.1. I am also not sure if this has to do with the virtual machine because on host I actually have no issue using QtGraphicalEffects
Qt QtGraphicalEffects is available in PySide6 but the module has changed the way of importing to import Qt5Compat.GraphicalEffects as indicated in the docs.

PySide2 'TLS initialization failed' or Where to put OpenSSL dlls?

I'm using PySide2 and QML.
I have an Image element in my qml file, and whenever I try to load an https URL in that image element I get the following error: QSslSocket::connectToHostEncrypted: TLS initialization failed
I'm on windows, and after looking online for this error it was suggested to put OpenSSL dlls alongside the executable when using vanilla Qt. Problem is that I'm using Python and I don't know where PySide2 looks for those dlls.
Any help would be appreciated.
Here is my QML image item:
Image {
id: image
height: parent.height - 5
width: parent.width - 5
source: url
sourceSize.width: image.width
sourceSize.height: image.height
asynchronous: true
fillMode: Image.PreserveAspectFit
}
url is a role in a python side model that is shared with QML using the setContextProperty method. The model is populated with image URLs from Reddit.
Download the OpenSSL version that's compatible with the version that's used to build the version of Qt you have installed. Make sure you put it where the Qt runtime can see when running your application.
Note OpenSSL version 1.0 is not backward compatible with 1.1
If you installed Qt using the pre-configured installer, then check the version that is pre-built with the version e.g OpenSSL v1.1 come with Qt 5.12

Unable to import QtQuick 1.1 in Qt Creator 4.0.3

I am using Qt Creator 4.0.3 and when looking at an older project using QtQuick 1.1 and trying to view in the designer, I get "Cannot open this QML document because of an error in QML file: Unsupported QtQuick version (0:0).
"Go to error" brings me to the line import QtQuick 1.1 in my .qml file. I do not know if QtQuick 1.1 is loaded or available nor do I know how to find that info.
I'd guess the reason ist that QtQuick 1 was removed with Qt 5.6 (at least from the release packages).
Qt_5.6 Removed_Modules
Either Qt uses Qt 5.6/5.7 and/or was built with 5.6/5.7
You would need to build and use QtCreator with Qt 5.5 I guess.

import QtQuick.Controls 2.1 QML MODULE NOT FOUND

I am using Qt Creator 2.4.1 base on Qt 4.7.4(32 bit) on windows. I have to create a table in QML using Table View. When i try import QtQuick.Controls 2.1 i get the error QML MODULE NOT FOUND. Same error on Qt Creator 2.6.2 based on Qt 5.0.1.
Any help appreciated.
In my case running qmake fixed issue.
Update 2020 (new way):
In some cases it not helped. Instead this solution helped greatly.
In the QtCreator, open settings/preferences and go to QtQuick > QtQuick Designer and select Use QML emulation layer... option in Qml Emulation Layer section and get your most newer version of Qt to it as follow:
The module QtQuick.Controls has been added on Qt 5.1 and is currently at the 1.0 version. It also requires you having QtQuick version 2.0, introduced with Qt 5 So if you want to use TableView you would have to update your current Qt version to at least 5.1 and then use these import statement:
import QtQuick 2.0
import QtQuick.Controls 1.0
Also, as indicated by Armaghast in the comment, if you are moving to the latest Qt version (currently Qt 5.2.1) you should use
import QtQuick 2.2
import QtQuick.Controls 1.1
In October 2016, Qt Qtuick Controls 2.1 were released as part of Qt 5.8
If anybody (like me) stumbles upon this error when using someone else code, you need to install Qt 5.8 or newer. Lower versions will fail to run the QML GUI.
More info at: http://blog.qt.io/blog/2016/10/06/qt-quick-controls-2-1-and-beyond/

Resources