You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

21

Friday, December 9th 2011, 4:29pm

ie, what happens to 'w'
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

enrique.fe

Beginner

  • "enrique.fe" is male

Posts: 3

Location: Mexico

Occupation: Software developer

  • Send private message

22

Friday, December 9th 2011, 6:53pm

your declared
private slots: //is wrong

public slots: //it's works!!

23

Friday, December 9th 2011, 7:33pm

w is used to call the class function.

it still dosent work when using public slots.

24

Saturday, December 10th 2011, 11:40am

it's nothing to do with public/private slots.


Your wierd (ie bad design) homewindow class makes another widget to show and connects that new widget to a slot on homewindow. BUT you made homewindow on the stack. Do you know what happesn to stack objects when they leave scope?
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

25

Saturday, December 10th 2011, 7:56pm

Look Im New to qt, i was just trying things out.

How would you design it so that it works?

26

Saturday, December 10th 2011, 8:03pm

You need to learn about instances, heap objects and stack objects, otherwise you will never be able to understand why your code doesn't work.

Your mistake is a c++ one, not a Qt one.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

27

Saturday, December 10th 2011, 8:18pm

Im switching to wxWidgets its so much easier

28

Saturday, December 10th 2011, 8:28pm

lol. Your lack of knowledge of c++ will cause you as many problems in wx as it will in Qt. Having used both, I would prefer Qt, not least because the docs are so much better.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

29

Sunday, December 11th 2011, 1:24pm

How would you create a widget on the heap instead of the stack?

This post has been edited 1 times, last edit by "dannyH" (Dec 11th 2011, 3:38pm)


30

Sunday, December 11th 2011, 4:30pm

As I said, your problems are c++, not Qt. You make a widget on the heap the same way you make any instance on the heap.
http://www.cplusplus.com/reference/std/new/operator%20new/
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.