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
Merge requests
!2404
ensure that there are no duplicate names in lists; disable cp/rm actions for empty lists
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
ensure that there are no duplicate names in lists; disable cp/rm actions for empty lists
j.3
into
main
Overview
0
Commits
5
Pipelines
5
Changes
1
Merged
Wuttke, Joachim
requested to merge
j.3
into
main
1 year ago
Overview
0
Commits
5
Pipelines
5
Changes
1
Expand
0
0
Merge request reports
Viewing commit
53e2307f
Show latest version
1 file
+
3
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
53e2307f
precaution against duplicate underscore
· 53e2307f
Wuttke, Joachim
authored
1 year ago
GUI/Model/Type/NamedItem.cpp
+
3
−
3
Options
@@ -19,7 +19,7 @@
namespace
{
QStringList
splitName
(
const
QString
&
s
)
{
QRegularExpression
pattern
(
"(.*)_(
\\
d+)"
);
QRegularExpression
pattern
(
"(.*)_(
\\
d+)
$
"
);
QRegularExpressionMatch
match
=
pattern
.
match
(
s
);
if
(
match
.
hasMatch
())
{
QStringList
groups
;
@@ -36,13 +36,13 @@ QStringList splitName(const QString& s) {
void
NamedItem
::
renumber
(
const
QStringList
&
extant_names
)
{
// Item name consists of a stem and an optional number
QStringList
ns
=
splitName
(
name
());
QStringList
ns
=
::
splitName
(
name
());
QString
stem
=
ns
.
isEmpty
()
?
name
()
:
ns
[
0
];
// Determine highest number for given stem in extant_items
int
imax
=
0
;
for
(
QString
tname
:
extant_names
)
{
QStringList
ts
=
splitName
(
tname
);
QStringList
ts
=
::
splitName
(
tname
);
if
(
ts
.
isEmpty
())
{
if
(
tname
==
stem
)
imax
=
std
::
max
(
imax
,
1
);
Loading