문제

I am quite new to Qt. Let MyClass be a sub-class of QObject.

Is there a way to convert properly a const MyClass * object to a MyClass * object?

I wanted to create a constructor MyClass(const MyClass *object); but it doesn't seem to be recommended.

도움이 되었습니까?

해결책

Use the following code :

 MyClass *objRef = const_cast<MyClass *>(obj);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top