1 // Copyright (C) 2006-2014 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "SchemaDirLinksItem.hxx"
21 #include "SchemaLinkItem.hxx"
22 #include "SchemaModel.hxx"
23 #include "QtGuiContext.hxx"
24 #include "GuiEditor.hxx"
30 #include "YacsTrace.hxx"
33 using namespace YACS::ENGINE;
34 using namespace YACS::HMI;
36 SchemaDirLinksItem::SchemaDirLinksItem(SchemaItem *parent, QString label, Subject* subject)
37 : SchemaItem(parent, label, subject)
39 _itemDeco.replace(YLabel, QIcon("icons:folder_cyan.png"));
42 void SchemaDirLinksItem::addLinkItem(Subject* subject)
44 DEBTRACE("SchemaDirLinksItem::addTypeItem");
45 SchemaModel *model = QtGuiContext::getQtCurrent()->getSchemaModel();
46 int nbsons = childCount();
47 model->beginInsertRows(modelIndex(), nbsons, nbsons);
48 SchemaItem *item = new SchemaLinkItem(this,
49 subject->getName().c_str(),
51 model->endInsertRows();
54 Qt::ItemFlags SchemaDirLinksItem::flags(const QModelIndex &index)
56 //DEBTRACE("SchemaDirLinksItem::flags");
57 return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
60 QVariant SchemaDirLinksItem::editionWhatsThis(int column) const
62 return "<p>Links between ports or nodes under that block level appears in this folder.\n" \
63 "You can add data links (between ports) and control links (between nodes) " \
64 "by drag from origin (out node or out port) to destination (in node or in port) " \
65 "either in 2D graphic view or tree view. <a href=\"modification.html#create-a-link\">More...</a></p>";