tags:

views:

32

answers:

2

Hello

Question

i have more than 5 radio buttons in my software and i want that when i click a radio button

then the text related to that button appears into the Qtab widget.

but i tried a lot but when i click a radio button the text related to that radio button

doesn't appear into the Qtabwidget.

my header file v_lab.h is here at pastebin(http://www.pastebin.org/880642)

at line 42 the function void peeyush(bool) is used to change the text

my header file v_lab.cpp is here at pastebin(http://www.pastebin.org/880690)

at line 128 of file v_lab.cpp i calling constructor

so please help me in changing the text in tab widget when i click on the radio button named as Binary Search

-Thanks

+2  A: 

Pass your main widget as the parent of the algorithm widget you are creating. Without that it's leaking memory anyway. To do this, pass a pointer to the instance of the main widget to the constructor of the algorithm.

new algorithm(string2, this);

Why is algorithm a widget anyway? That's not a very good approach.

If I were you, I'd create an Algorithm class with pure virtual functions, and subclass it for each algorithm implementation. connect the toggle signals of the radio buttons to different slots, and instantiate the chosen subclass in them.

Tamás Szelei
can you explain me how can i make my widget as a parent??
neha
I edited my answer.
Tamás Szelei
Thanks Tamas,I was doing some mistake in connect.I solved it.Thanks.
neha
new edited code is at
neha
new edited code is at http://www.pastebin.org/883834http://www.pastebin.org/883832
neha
A: 

new edited code is at pastebin.org/883834 pastebin.org/883832

problem was in connect and function.

neha