Open
Description
Some QLists in Qt have value types that do not implement equality. As specified in QList's documentation, if the value type of a QList does not implement ==
, then the following functions are disabled:
contains
count
indexOf
lastIndexOf
!=
==
Of those, we use contains
and indexOf
. One option here would be to have an additional trait for list element value types with equality, and then the QList implementation would use e.g.
pub fn contains(&self, value: &T) -> bool
where
T: QListElementEq,
{
T::contains(self, value)
}
At present, the workaround for the issue is to do something like this:
impl QListElement for MyType {
fn contains(list: &QList<Self>, value: &Self) -> bool {
false
}
fn index_of(list: &QList<Self>, value: &Self) -> isize {
-1
}
}
Obviously, that's not great.
Metadata
Metadata
Assignees
Labels
No labels