0

I was able to resolve an issue I was having with Qt by modifying the implementation of a method in a core class (see this post ). Although I believe this change would be a valuable addition to Qt, it's a completely wrong way to deal with this issue unless the change somehow makes its way into a future Qt release.

What I need to do is create a new Qt quick item that will do everything that the PositionSource item does today, but with a new implementation of the nmeaSource property handler method (void QDeclarativePositionSource::setNmeaSource(const QUrl &nmeaSource)).

The comments in the code specify that this code may change in future releases so I guess I shouldn't just subclass it and override the method. I thought of copying the header and source of the class into my project directly and make the changes there.

Any suggestions?

charles
  • 192
  • 1
  • 14
  • It seems that you have answered yourself in the last paragraph, what kind of answers do you expect? – eyllanesc Jan 02 '20 at 22:47
  • You could probably subclass it and add an invokable override of setNmeaSource, provided that implementing it won't require using private members/methods. Or else you are simply out of luck. In which case your only option left would be to push a change to Qt to change the private members you need into protected. That class is private anyway, so there's no risk of breaking binary compatibility. And is exported, meaning you can subclass it in your app. – Pa_ Jan 02 '20 at 23:39

0 Answers0