mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-09 08:59: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:
@@ -31,29 +31,31 @@ ElementFactory* ElementFactory::factory_ = 0;
|
||||
* @brief ElementFactory::createElement
|
||||
* @param location create element at this location
|
||||
* @param qgi parent item for this elemnt
|
||||
* @param s diagram of the element
|
||||
* @param state state of the creation
|
||||
* @return the element or 0
|
||||
*/
|
||||
Element * ElementFactory::createElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) {
|
||||
// recupere la definition de l'element
|
||||
Element * ElementFactory::createElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state)
|
||||
{
|
||||
// recupere la definition de l'element
|
||||
ElementsCollectionItem *element_item = QETApp::collectionItem(location);
|
||||
ElementDefinition *element_definition;
|
||||
if (!element_item ||\
|
||||
!element_item -> isElement() ||\
|
||||
!(element_definition = qobject_cast<ElementDefinition *>(element_item))) {
|
||||
!(element_definition = qobject_cast<ElementDefinition *>(element_item)))
|
||||
{
|
||||
if (state) *state = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (element_definition->xml().hasAttribute("link_type")) {
|
||||
if (element_definition->xml().hasAttribute("link_type"))
|
||||
{
|
||||
QString link_type = element_definition->xml().attribute("link_type");
|
||||
if (link_type == "next_report" || link_type == "previous_report") return (new ReportElement(location, link_type, qgi, s, state));
|
||||
if (link_type == "master") return (new MasterElement (location, qgi, s, state));
|
||||
if (link_type == "slave") return (new SlaveElement (location, qgi, s, state));
|
||||
if (link_type == "terminal") return (new TerminalElement (location, qgi, s, state));
|
||||
if (link_type == "next_report" || link_type == "previous_report") return (new ReportElement(location, link_type, qgi, state));
|
||||
if (link_type == "master") return (new MasterElement (location, qgi, state));
|
||||
if (link_type == "slave") return (new SlaveElement (location, qgi, state));
|
||||
if (link_type == "terminal") return (new TerminalElement (location, qgi, state));
|
||||
}
|
||||
|
||||
//default if nothing match for link_type
|
||||
return (new SimpleElement(location, qgi, s, state));
|
||||
//default if nothing match for link_type
|
||||
return (new SimpleElement(location, qgi, state));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user