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
f11d8338
Commit
f11d8338
authored
3 years ago
by
Matthias Puchner
Browse files
Options
Downloads
Patches
Plain Diff
add top/bottom info to layer
parent
4a613b32
No related branches found
No related tags found
1 merge request
!570
remove SessionModel/Item from SampleModel and all related items
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GUI/Model/Sample/LayerItem.cpp
+20
-0
20 additions, 0 deletions
GUI/Model/Sample/LayerItem.cpp
GUI/Model/Sample/LayerItem.h
+10
-0
10 additions, 0 deletions
GUI/Model/Sample/LayerItem.h
GUI/Model/Sample/MultiLayerItem.cpp
+27
-9
27 additions, 9 deletions
GUI/Model/Sample/MultiLayerItem.cpp
with
57 additions
and
9 deletions
GUI/Model/Sample/LayerItem.cpp
+
20
−
0
View file @
f11d8338
...
...
@@ -165,3 +165,23 @@ void LayerItem::setColor(const QColor& color)
{
setItemValue
(
P_COLOR
,
color
);
}
void
LayerItem
::
setIsTopLayer
(
bool
b
)
{
m_isTopLayer
=
b
;
}
bool
LayerItem
::
isTopLayer
()
const
{
return
m_isTopLayer
;
}
void
LayerItem
::
setIsBottomLayer
(
bool
b
)
{
m_isBottomLayer
=
b
;
}
bool
LayerItem
::
isBottomLayer
()
const
{
return
m_isBottomLayer
;
}
This diff is collapsed.
Click to expand it.
GUI/Model/Sample/LayerItem.h
+
10
−
0
View file @
f11d8338
...
...
@@ -61,6 +61,16 @@ public:
QColor
color
()
const
;
void
setColor
(
const
QColor
&
color
);
void
setIsTopLayer
(
bool
b
);
bool
isTopLayer
()
const
;
void
setIsBottomLayer
(
bool
b
);
bool
isBottomLayer
()
const
;
private
:
bool
m_isTopLayer
=
false
;
bool
m_isBottomLayer
=
false
;
private
:
// -- Only for testing
friend
class
TestMapperForItem_onPropertyChange_Test
;
...
...
This diff is collapsed.
Click to expand it.
GUI/Model/Sample/MultiLayerItem.cpp
+
27
−
9
View file @
f11d8338
...
...
@@ -106,23 +106,35 @@ LayerItem* MultiLayerItem::addLayer(int index)
if
(
index
<
0
)
index
=
m_layers
.
size
();
auto
*
l
=
new
LayerItem
();
m_layers
.
insert
(
index
,
l
);
return
l
;
auto
*
layer
=
new
LayerItem
();
m_layers
.
insert
(
index
,
layer
);
layer
->
setIsTopLayer
(
m_layers
.
first
()
==
layer
);
layer
->
setIsBottomLayer
(
m_layers
.
last
()
==
layer
);
return
layer
;
}
void
MultiLayerItem
::
removeLayer
(
LayerItem
*
item
)
void
MultiLayerItem
::
removeLayer
(
LayerItem
*
layer
)
{
m_layers
.
removeAll
(
item
);
m_layers
.
removeAll
(
layer
);
delete
layer
;
if
(
!
m_layers
.
isEmpty
())
{
m_layers
.
first
()
->
setIsTopLayer
(
true
);
m_layers
.
last
()
->
setIsBottomLayer
(
true
);
}
}
void
MultiLayerItem
::
moveLayer
(
LayerItem
*
item
,
LayerItem
*
beforeThisLayer
)
void
MultiLayerItem
::
moveLayer
(
LayerItem
*
layer
,
LayerItem
*
beforeThisLayer
)
{
m_layers
.
removeAll
(
item
);
int
index
=
-
1
;
// move to end
m_layers
.
removeAll
(
layer
);
int
index
=
m_layers
.
size
()
;
// move to end
if
(
beforeThisLayer
!=
nullptr
)
index
=
m_layers
.
indexOf
(
beforeThisLayer
);
m_layers
.
insert
(
index
,
item
);
m_layers
.
insert
(
index
,
layer
);
for
(
auto
l
:
m_layers
)
{
l
->
setIsTopLayer
(
m_layers
.
first
()
==
l
);
l
->
setIsBottomLayer
(
m_layers
.
last
()
==
l
);
}
}
void
MultiLayerItem
::
writeContentTo
(
QXmlStreamWriter
*
writer
)
const
...
...
@@ -144,6 +156,12 @@ void MultiLayerItem::writeContentTo(QXmlStreamWriter* writer) const
void
MultiLayerItem
::
readContentFrom
(
QXmlStreamReader
*
reader
)
{
// #baMigration ++ implement
// set non-stored infos
for
(
auto
l
:
m_layers
)
{
l
->
setIsTopLayer
(
m_layers
.
first
()
==
l
);
l
->
setIsBottomLayer
(
m_layers
.
last
()
==
l
);
}
}
QString
MultiLayerItem
::
uidForDescriptor
(
const
QString
&
lastPart
)
const
...
...
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