Use dialogs in Qt 6
-
No, almost everything looks fine! I just get these in the Output Window:
00:47:51: Running steps for project QML_3...
00:47:51: Starting: "C:\Qt\Tools\CMake_64\bin\cmake.exe" --build D:/Projects/QML/QML_3/build-QML_3-Desktop_Qt_6_2_3_MinGW_64_bit-Debug --target all
[1/10 7.0/sec] Automatic MOC for target appQML_3
[2/9 9.6/sec] Running AUTOMOC file extraction for target appQML_3
[3/4 1.1/sec] Building CXX object CMakeFiles/appQML_3.dir/main.cpp.obj
[4/4 1.3/sec] Linking CXX executable appQML_3.exe
00:47:55: The process "C:\Qt\Tools\CMake_64\bin\cmake.exe" exited normally.
00:47:55: Elapsed time: 00:03.So what should be the reason for the window to appear this way to you, please?
That's really strange we have to do that much modification, and suffer from the output and the red line under the element just to be able to use it in the code! :| -
Sorry I don't understand anymore what the problem is.
So at runtime the program works OK, no problems, right?
You are only complaining about the editor telling you about MessageDialog being not recognised? That's just Qt Creator's code model being stupid. You can just ignore it, it's pretty common.
-
OK, I misunderstood your previous comment then.
I've never used this MessageDialog thing so it's hard for me to say. The code looks ok, maybe take a look at command line output (not compilation output you pasted above but Application Output tab in Qt Creator). Maybe there are some warnings there?
The documentation suggests this dialog is NOT available on Windows:
A native platform message dialog is currently available on the following platforms:
iOS
Android
WinRT(https://doc.qt.io/qt-5/qml-qt-labs-platform-messagedialog.html)
maybe that's the reason. Try the MessageDialog from QtQuick.Dialogs instead of Qt.labs. https://doc.qt.io/qt-5/qml-qtquick-dialogs-messagedialog.html
-
Application Output tab in Qt Creator). Maybe there are some warnings there?
No, nothing different. Normal.
maybe that's the reason
Yes, that must be.
Try the MessageDialog from QtQuick.Dialogs instead of Qt
I created a new QtQuick project using CMake and Qt version 5.15 and tested an example of that page but get this error!
QQmlApplicationEngine failed to load component
qrc:/main.qml:3:1: module "QtQuick.Dialogs" version 1.3 is not installed -
I don't know, maybe try some lower import like 1.2 or 1.1.
-
@qcoderpro said in Use dialogs in Qt 6:
qrc:/main.qml:3:1: module "QtQuick.Dialogs" version 1.3 is not installed*
If you're using Qt 6.2, then do
import QtQuick.Dialogs 6.2
.
If you're using Qt 5.15, then doimport QtQuick.Dialogs 1.3
. -
My project is using Qt 5.15 and CMake as its build system, and as stated in the prior posts, that version is tested, the error message is:
module "QtQuick.Dialogs" version 1.3 is not installedNeither Qt 5.15 nor Qt 6.2 is doing well with that element!