mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-03-15 14:19:59 +01:00
Minor change according to the evolution of Qt class (remove QGraphicsScene from constructor of QGraphicsItem).
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3547 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -33,41 +33,43 @@ class Diagram;
|
||||
*/
|
||||
class ElementFactory
|
||||
{
|
||||
//methods for singleton pattern
|
||||
//methods for singleton pattern
|
||||
public:
|
||||
// return instance of factory
|
||||
static ElementFactory* Instance() {
|
||||
static QMutex mutex;
|
||||
if (!factory_) {
|
||||
mutex.lock();
|
||||
if (!factory_) factory_ = new ElementFactory();
|
||||
mutex.unlock();
|
||||
// return instance of factory
|
||||
static ElementFactory* Instance() {
|
||||
static QMutex mutex;
|
||||
if (!factory_) {
|
||||
mutex.lock();
|
||||
if (!factory_) factory_ = new ElementFactory();
|
||||
mutex.unlock();
|
||||
}
|
||||
return factory_;
|
||||
}
|
||||
return factory_;
|
||||
}
|
||||
// delete the instance of factory
|
||||
static void dropInstance () {
|
||||
static QMutex mutex;
|
||||
if (factory_) {
|
||||
mutex.lock();
|
||||
delete factory_;
|
||||
factory_ = 0;
|
||||
mutex.unlock();
|
||||
}
|
||||
}
|
||||
//attributes
|
||||
private:
|
||||
static ElementFactory* factory_;
|
||||
|
||||
//methods for the class factory himself
|
||||
// delete the instance of factory
|
||||
static void dropInstance () {
|
||||
static QMutex mutex;
|
||||
if (factory_) {
|
||||
mutex.lock();
|
||||
delete factory_;
|
||||
factory_ = 0;
|
||||
mutex.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
//attributes
|
||||
private:
|
||||
ElementFactory() {}
|
||||
ElementFactory (const ElementFactory &);
|
||||
ElementFactory operator= (const ElementFactory &);
|
||||
~ElementFactory() {}
|
||||
static ElementFactory* factory_;
|
||||
|
||||
//methods for the class factory himself
|
||||
private:
|
||||
ElementFactory() {}
|
||||
ElementFactory (const ElementFactory &);
|
||||
ElementFactory operator= (const ElementFactory &);
|
||||
~ElementFactory() {}
|
||||
|
||||
public:
|
||||
Element * createElement (const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
|
||||
Element * createElement (const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
|
||||
};
|
||||
//ElementFactory ElementFactory::factory_ = 0;
|
||||
#endif // ELEMENTFACTORY_H
|
||||
|
||||
Reference in New Issue
Block a user