Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Discover
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Plasma
Discover
Commits
d76d9c21
Commit
d76d9c21
authored
Jan 15, 2018
by
Aleix Pol Gonzalez
🐧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't add the same resource twice in the resources proxy model
parent
db01c0d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
libdiscover/resources/ResourcesProxyModel.cpp
libdiscover/resources/ResourcesProxyModel.cpp
+5
-3
No files found.
libdiscover/resources/ResourcesProxyModel.cpp
View file @
d76d9c21
...
...
@@ -445,10 +445,12 @@ void ResourcesProxyModel::sortedInsertion(const QVector<AbstractResource*> & res
}
for
(
auto
resource
:
resources
)
{
int
newIdx
=
0
;
const
auto
finder
=
[
this
,
resource
](
AbstractResource
*
res
){
return
lessThan
(
resource
,
res
);
};
const
auto
it
=
std
::
find_if
(
m_displayedResources
.
constBegin
()
+
newIdx
,
m_displayedResources
.
constEnd
(),
finder
);
newIdx
=
it
==
m_displayedResources
.
constEnd
()
?
m_displayedResources
.
count
()
:
(
it
-
m_displayedResources
.
constBegin
());
const
auto
it
=
std
::
find_if
(
m_displayedResources
.
constBegin
(),
m_displayedResources
.
constEnd
(),
finder
);
const
auto
newIdx
=
it
==
m_displayedResources
.
constEnd
()
?
m_displayedResources
.
count
()
:
(
it
-
m_displayedResources
.
constBegin
());
if
(
it
!=
m_displayedResources
.
constEnd
()
&&
*
it
==
resource
)
continue
;
beginInsertRows
({},
newIdx
,
newIdx
);
m_displayedResources
.
insert
(
newIdx
,
resource
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment