Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
f05ad6d7
Commit
f05ad6d7
authored
5 years ago
by
Juan Manuel Carmona Loaiza
Browse files
Options
Downloads
Patches
Plain Diff
ILayerView: Update the labels when updating the appearance
parent
3e41dc26
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/coregui/Views/SampleDesigner/ILayerView.cpp
+36
-0
36 additions, 0 deletions
GUI/coregui/Views/SampleDesigner/ILayerView.cpp
GUI/coregui/Views/SampleDesigner/ILayerView.h
+2
-0
2 additions, 0 deletions
GUI/coregui/Views/SampleDesigner/ILayerView.h
with
38 additions
and
0 deletions
GUI/coregui/Views/SampleDesigner/ILayerView.cpp
+
36
−
0
View file @
f05ad6d7
...
@@ -56,6 +56,7 @@ void ILayerView::onPropertyChange(const QString &propertyName)
...
@@ -56,6 +56,7 @@ void ILayerView::onPropertyChange(const QString &propertyName)
updateHeight
();
updateHeight
();
}
else
if
(
propertyName
==
LayerItem
::
P_MATERIAL
)
{
}
else
if
(
propertyName
==
LayerItem
::
P_MATERIAL
)
{
updateColor
();
updateColor
();
updateLabel
();
}
}
IView
::
onPropertyChange
(
propertyName
);
IView
::
onPropertyChange
(
propertyName
);
...
@@ -86,6 +87,40 @@ void ILayerView::updateColor()
...
@@ -86,6 +87,40 @@ void ILayerView::updateColor()
}
}
}
}
void
ILayerView
::
updateLabel
()
{
if
(
getInputPorts
().
size
()
<
1
)
return
;
NodeEditorPort
*
port
=
getInputPorts
()[
0
];
QString
material
=
""
;
if
(
m_item
->
isTag
(
LayerItem
::
P_MATERIAL
)){
QVariant
v
=
m_item
->
getItemValue
(
LayerItem
::
P_MATERIAL
);
if
(
v
.
isValid
())
{
ExternalProperty
mp
=
v
.
value
<
ExternalProperty
>
();
material
=
mp
.
text
();
}
}
/* Thickness and roughness can be added, but the length of the string
* becomes prohibitive.
QString thickness = "" ;
if(m_item->isTag(LayerItem::P_THICKNESS))
thickness = m_item->getItemValue(LayerItem::P_THICKNESS).toString();
QString roughness = "" ;
if(m_item->isTag(LayerItem::P_ROUGHNESS)){
QVariant x = m_item->getItemValue(LayerItem::P_ROUGHNESS);
{...}
}
*/
QString
infoToDisplay
=
material
;
port
->
setLabel
(
infoToDisplay
);
}
//! Detects movement of the ILayerView and sends possible drop areas to GraphicsScene
//! Detects movement of the ILayerView and sends possible drop areas to GraphicsScene
//! for visualization.
//! for visualization.
QVariant
ILayerView
::
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
)
QVariant
ILayerView
::
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
)
...
@@ -179,6 +214,7 @@ void ILayerView::update_appearance()
...
@@ -179,6 +214,7 @@ void ILayerView::update_appearance()
{
{
updateHeight
();
updateHeight
();
updateColor
();
updateColor
();
updateLabel
();
ConnectableView
::
update_appearance
();
ConnectableView
::
update_appearance
();
}
}
...
...
This diff is collapsed.
Click to expand it.
GUI/coregui/Views/SampleDesigner/ILayerView.h
+
2
−
0
View file @
f05ad6d7
...
@@ -35,6 +35,8 @@ public:
...
@@ -35,6 +35,8 @@ public:
virtual
QString
getLabel
()
const
{
return
QString
();
}
virtual
QString
getLabel
()
const
{
return
QString
();
}
void
updateLabel
();
protected
:
protected
:
QVariant
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
);
QVariant
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
);
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment