Version: 9.16.0
SchemaLinkItem.cxx
Go to the documentation of this file.
1// Copyright (C) 2006-2026 CEA, EDF
2//
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.
7//
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.
12//
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
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#include "SchemaLinkItem.hxx"
21#include "Menus.hxx"
22#include "DataStreamPort.hxx"
23
24#include <QIcon>
25
26//#define _DEVDEBUG_
27#include "YacsTrace.hxx"
28
29using namespace std;
30using namespace YACS::HMI;
31
32SchemaLinkItem::SchemaLinkItem(SchemaItem *parent, QString label, Subject* subject)
33 : SchemaItem(parent, label, subject)
34{
35 switch (subject->getType())
36 {
38 _itemDeco.replace(YLabel, QIcon("icons:control_link.png"));
39 break;
41 _itemDeco.replace(YLabel, QIcon("icons:data_link.png"));
42 if (SubjectLink *slink = dynamic_cast<SubjectLink*>(subject))
43 {
44 if (dynamic_cast<YACS::ENGINE::DataStreamPort*>(slink->getSubjectOutPort()->getPort()))
45 _itemDeco.replace(YLabel, QIcon("icons:stream_link.png"));
46 }
47 break;
48 default:
49 _itemDeco.replace(YLabel, QIcon("icons:new_link.png"));
50 }
51}
52
53void SchemaLinkItem::update(GuiEvent event, int type, Subject* son)
54{
55 DEBTRACE("SchemaLinkItem::update");
56 SchemaItem::update(event, type, son);
57}
58
59void SchemaLinkItem::popupMenu(QWidget *caller, const QPoint &globalPos)
60{
61 LinkMenu m;
62 m.popupMenu(caller, globalPos);
63}
64
65
66QVariant SchemaLinkItem::editionWhatsThis(int column) const
67{
68return "<p>Links between ports or nodes under that block level appears in this folder.\n" \
69 "You can add data links (between ports) and control links (between nodes) " \
70 "by drag from origin (out node or out port) to destination (in node or in port) " \
71 "either in 2D graphic view or tree view. <a href=\"modification.html#create-a-link\">More...</a></p>";
72}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
QList< QVariant > _itemDeco
Definition: SchemaItem.hxx:78
virtual void update(GuiEvent event, int type, Subject *son)
Definition: SchemaItem.cxx:174
virtual QVariant editionWhatsThis(int column) const
virtual void popupMenu(QWidget *caller, const QPoint &globalPos)
virtual void update(GuiEvent event, int type, Subject *son)
virtual TypeOfElem getType()