Hello,
I am trying to determine whether it is possible to implement QObject types such that they provide "logical equality". By this I mean, that 2 objects that are physically different can be determined to be representing the same application value (in my case, the QObjects are wrapping non-Q application objects). I would like to write the comparison as
Component.onCompleted: {checked = (selectedProject == project)}
Component.onCompleted: {checked = (selectedProject == project)}
To copy to clipboard, switch view to plain text mode
my investigations so far have shown that this is impossible because comparison operators in Javascript cannot be overloaded. Since I cannot ensure the uniqueness of the QObject wrappers, I will have to go with a "sameAs" Q_INVOKABLE methd, and change the QML/Javascript code to
Component.onCompleted: {checked = selectedProject.sameAs(project)}
Component.onCompleted: {checked = selectedProject.sameAs(project)}
To copy to clipboard, switch view to plain text mode
any commmments?
thanks,
chris
Bookmarks