Re: Self contained objects
Quote:
I want something which can hold all of these and be able to pass it to another form.
This "something" is called QWidget. You can create your CalendarForm as custom QWidget with all those buttons, layouts etc.
Quote:
If this class ie CalenderForm can return a layout or somethin which i can use it in another form.
You can create one instance of this class and add it to a layout, remove from layout, add to another layout etc. This class don't need to return anything, the class is a "container" itself.
Re: Self contained objects
This is what im trying to achieve
*- I will have a mainTab form with a class. The form would have jus have 3 tabs, Calender, History and Statistics.
*- My project already has three forms with 3 classes CalenderForm, HistoryForm and StatForm.
*- Opening each form in each tab looks like bad GUI programming,so i was thinking if these three forms/classes can give some kinda container/layout with all the widgets, May be then i can put these into each tab in the mainform.
atleast a work around would do.
alfah
Re: Self contained objects
Quote:
Opening each form in each tab looks like bad GUI programming
What do you mean by "opening each form in each tab" ? Does each tab have a custom widget placed on it (eg. by using "Promote to...") ?
Quote:
if these three forms/classes can give some kinda container/layout with all the widgets
I'm not sure I understand. You can create a custom QTabWidget-based class for this, in which you create three tabs, each having a custom QWidget-based class added (calendar, history, stats).
Re: Self contained objects
I agree with stampede. If you want a single widget that contains a set of tabs which in turn hold your more specific widgets, then build one. I generally don't like to decompose a GUI this way, but there's nothing stopping you from doing so.
Re: Self contained objects
Quote:
Originally Posted by
alfah
hi
Are there any self contained object lin Qt. By ‘self contained’ i mean, those things which can act like a container. I checked out the containers in Qt, but those are linear ones like stack, queue and all. The following is what im trying to achieve.
I have a form with a lot of buttons, images, vertical layouts, horizontal layouts, grid etc etc. All these put together gives me a calender. I want something which can hold all of these and be able to pass it to another form. If this class ie CalenderForm can return a layout or somethin which i can use it in another form.
This "something" is called QVariant but I have no idea what you want to use it for, even after reading through this thread. Since widgets can't be copied, you can't say "here you go, make me two copies of that". You need a proper class with a constructor (or alternatively a factory function) that will create such a set of objects for you.
Re: Self contained objects
Strange,
Someone else asked an identical question. See how-to-interact-with-tabs-in-qt. Maybe some school assignment ?
Anyway, see QStackedWidget-and-QTabWidget-Structure-Advice for a solution.
Regards,
Marc