Results 1 to 7 of 7

Thread: Self contained objects

  1. #1
    Join Date
    Jul 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows Symbian S60

    Default Self contained objects

    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.

    I dont know if this is possible. but is there anything close to what im trying to achieve????

    alfah

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Self contained objects

    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.
    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.

  3. #3
    Join Date
    Jul 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows Symbian S60

    Default 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

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Self contained objects

    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...") ?
    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).

  5. #5
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default 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.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Self contained objects

    Quote Originally Posted by alfah View Post
    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default 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

Similar Threads

  1. Replies: 3
    Last Post: 9th January 2010, 15:47
  2. can a qdockwidget be smaller than the contained widgets?
    By billconan in forum Qt Programming
    Replies: 1
    Last Post: 14th November 2009, 08:21
  3. Self contained, small as possible app.
    By squidge in forum Installation and Deployment
    Replies: 4
    Last Post: 16th October 2009, 15:58
  4. is qt self contained?
    By Dumbledore in forum Qt Tools
    Replies: 7
    Last Post: 11th October 2007, 18:35
  5. Replies: 7
    Last Post: 18th July 2006, 21:33

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.