1 year ago

#184799

test-img

AntDevPlus

Qt 4.8, canConvert with template

i would like to create a converter based on QVariant.

I have make this methode: find()

template <typename T>
T find(const QVariant variant, T type) {
  if (variant.canConvert<type>()){
    return variant;
  }
  return T();
}

It is called like that:

find(qVariant, QString());

And after make I've got this error: No matching function 'QVariant::canConvert()'

Thanks for your help

c++

qt

qvariant

0 Answers

Your Answer

Accepted video resources