QtStringList is not a type error even when "Qt.labs.qmlmodels 1.0" is imported
Unsolved
Qt in Education
-
Hello when im trying to use QstringList in this code:
property QStringList days: [] Component.onCompleted: { var currentDate = new Date() for (var i = 0; i < 7; i++) { var date = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() + i) var day = ("0" + date.getDate()).slice(-2) var month = ("0" + (date.getMonth() + 1)).slice(-2) var dateString = day + "/" + month days.push(dateString) } // console.log("Days array:", days)
i get
even when:
import Qt.labs.qmlmodels 1.0
is present on top of my filehow can i fix this problem?
do i need to add anything in my qt project?
those are my qt modules
im using qt 6.4.0 -
-
Hi @ZeeoTwo,
those are my qt modules
I know very little about QML, but it might be because QStringList is part of Qt Core, which you don't seem to have selected in your Qt Modules?
Cheers.
-
@ZeeoTwo said in QtStringList is not a type error even when "Qt.labs.qmlmodels 1.0" is imported:
how can i fix this problem?
QStringList is a C++ class.
You are writing a QML file which is JavaScript.
Check there for the full list of QML types: