I am trying to test some QT Dialogs (I am a new bee on QT btw) and I keep getting this message:
"qrc:/main.qml:3:1: module "QtQuick.Dialogs" version 1.3 is not installed"
I looked at this thread:
module "QtQuick.Dialogs" version 1.3 is not installed
Then, I tried to go back to 1.2 but did not resolve.
I am using:
Qt Creator 8.0.0 Based on Qt 6.3.1 (MSVC 2019, x86_64) Built on Jul 19 2022 08:06:48
Update:
I believe my problem is the CMakeLists.txt, this is what I have there:
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick QuickControls2)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick QuickControls2)
set(PROJECT_SOURCES
main.cpp
qml.qrc)
a bunch of stuff (I use the autogenerated CMakeLists.txt) then
target_link_libraries(color_dialog
PRIVATE Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Quick
Qt${QT_VERSION_MAJOR}::QuickControls2)
then the code, which I doubt is the problem:
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Dialogs 1.3
import QtQuick.Controls 2.5
Window {
visible: true
width: 640
height: 480
title: qsTr("ColorDialog Test")
Column {
spacing: 10
anchors.centerIn: parent
Button{
text : "Pick a Color"
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
colorDialogId.open()
}
}
Rectangle{
width: 300
height: 300
id : rectangleId
border.color: "cornflowerblue"
border.width: 4
anchors.horizontalCenter: parent.horizontalCenter
}
ColorDialog{
id : colorDialogId
title: "Pick The Color"
onAccepted: {
console.log("onAccepted: "+ color)
rectangleId.color = color
}
}
}
}
How do I resolve this? What I am missing on my CMakeLists.txt?
thank you!