How to create multiple instances of a static members?

kitts kitts at
Sat Feb 11 19:19:03 GMT 2006

On Saturday 11 February 2006 17:08 IST, Andreas Pakulat wrote:
> Then they're not static members, but instance members and thus you don't
> need static members. The whole point of static class members is to have
> them available when there is no instance of that class.
> > My program is structured as a trees of objects. The objects within each
> > tree are allowed to instantiate the special class. However, i want the
> > static objects of this special class to be instantiated only once for
> > each tree.
> Then static is the right choice and I don't understand your problem.
Actually, the way i was looking at it was that; within one process, i have 
one or more sets of a class's objects. Within each of these sets i want 
some static objects that remain common to all, however, i do not want these 
static members across sets.

> > I also have a static slot fucntion which i want to "connect" to when
> > the first instance in a given tree is created.
> Huh? That won't work I think. You can't connect a signal just to a
> function, you need an object and then it's already there.

From the documentation of QObject, i find two prototypes;

bool QObject::connect ( const QObject * sender, const char * signal, const 
QObject * receiver, const char * member ) [static]


bool QObject::connect ( const QObject * sender, const char * signal, const 
char * member ) const

I think the second handles this situation.

to unsubscribe from this list send an email to kdevelop-request at with the following body:
unsubscribe »your-email-address«

More information about the KDevelop mailing list