Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

setContextProperty and Inheritance

$
0
0
Hi, I have an UiHandlerClass which has a lot of Function which are the same except from the name string in setContextProperty. As the class got to big anyway i decided to split the class in 2 classes which share a lot of code. So i thought of an abstractClass which has a function say: setStation() and in the both subclasses i can call this function. But the need to set differnet Properties. Thus i wanted to know if there is a way that in subclasses i can just define the name for the property withou changing the parent code. I hope of something like this //file parent #define NAME "parent"   class Parent{     public:      setStation(){         //some code        context->setContextProperty(NAME,someObj);      }     protected:     SomeType someObj; }   //in Child file #define NAME "childName" class Child : public Parent{   } such that qml can see properties with childName but with defines it doesn’t work.. I there some clean way to do this?

Viewing all articles
Browse latest Browse all 4972

Trending Articles