Results 1 to 2 of 2

Thread: Adding derived objects to a list dynamically

  1. #1
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Adding derived objects to a list dynamically

    Hi ...
    I have a situation:
    I have a abstract class from QObject and base class which is derivated from the abstract. There are approximately 30 classes which are derivated from the base class. These classes are all singleton and they will be constructed within project. I want to have list of these singleton objects always. I don't want to make hard code instead i want to save and access them from base class. I have tried to create a static list in base class and add objects to this list in constructor of base class but it fails and gives and error. I'm not much expert at object oriented design with combination of static members! If someone can help me i'll be appreciated.
    Simplified form of class diagram is shown below:
    Drawing1.jpg
    If i can have a static method to return list of derivated objects, that would be great but i don't know how?! May be it's one of design patterns which i don't know...

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Adding derived objects to a list dynamically

    So what is the error you are getting?

    Cheers,
    _

Similar Threads

  1. Replies: 3
    Last Post: 5th April 2013, 21:34
  2. Dynamically allocated objects
    By DmitryNik in forum Newbie
    Replies: 4
    Last Post: 26th September 2011, 12:20
  3. Replies: 1
    Last Post: 23rd April 2011, 17:33
  4. QWizard creating objects dynamically
    By afflictedd2 in forum Qt Programming
    Replies: 5
    Last Post: 24th March 2009, 15:43
  5. Replies: 2
    Last Post: 6th December 2006, 23:41

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.