Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi ,
I have some controls in class B which is publically derived from QWidget. I want to call these controls in class A.
I declare in header of class A as ,

private:
B *obj_B;
And in A.cpp, constructor I define

obj_B = new B(this);

It calls control of class B in class A, but the controls of class A is not responding.

If same thinf I am trying to perform in some function of class A its not displaying any control in class A.

Please tell me how to resolve this.

Regards
Rahul Prakash
Posted

1 solution

Hi to all,
I solve this problem by myself. Steps to solve it are as:

1> Declare a in header file of calling class.
QVector "<"classNameOfWidgetToUse *> m_ptr;

2> In cpp file of calling class (in constructor or any function where u want to use) define

classNameOfWidgetToUse *obj = new classNameOfWidgetToUse;
m_ptr << obj;
ui.objOfCallingClassWhereUWantToWidget->addWidget(m_ptr[i]);

where i is an integer value.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900