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
6efa62d5
Commit
6efa62d5
authored
7 years ago
by
Pospelov, Gennady
Browse files
Options
Downloads
Patches
Plain Diff
Testing layoutChanged signal in ComponentProxyModel.
parent
7bf150b0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/coregui/Models/ComponentProxyModel.cpp
+1
-1
1 addition, 1 deletion
GUI/coregui/Models/ComponentProxyModel.cpp
Tests/UnitTests/GUI/TestComponentProxyModel.h
+22
-0
22 additions, 0 deletions
Tests/UnitTests/GUI/TestComponentProxyModel.h
with
23 additions
and
1 deletion
GUI/coregui/Models/ComponentProxyModel.cpp
+
1
−
1
View file @
6efa62d5
...
@@ -171,7 +171,6 @@ void ComponentProxyModel::sourceRowsInserted(const QModelIndex& parent, int star
...
@@ -171,7 +171,6 @@ void ComponentProxyModel::sourceRowsInserted(const QModelIndex& parent, int star
qDebug
()
<<
"ComponentProxyModel::sourceRowsInserted"
;
qDebug
()
<<
"ComponentProxyModel::sourceRowsInserted"
;
buildModelMap
();
buildModelMap
();
layoutChanged
();
}
}
//! Main method to build the map of persistent indeses.
//! Main method to build the map of persistent indeses.
...
@@ -197,4 +196,5 @@ void ComponentProxyModel::buildModelMap()
...
@@ -197,4 +196,5 @@ void ComponentProxyModel::buildModelMap()
// qDebug() << " ";
// qDebug() << " ";
});
});
layoutChanged
();
}
}
This diff is collapsed.
Click to expand it.
Tests/UnitTests/GUI/TestComponentProxyModel.h
+
22
−
0
View file @
6efa62d5
...
@@ -19,6 +19,7 @@ private slots:
...
@@ -19,6 +19,7 @@ private slots:
void
test_setModelWithVector
();
void
test_setModelWithVector
();
void
test_displayRole
();
void
test_displayRole
();
void
test_setData
();
void
test_setData
();
void
test_insertRows
();
};
};
//! Empty proxy model.
//! Empty proxy model.
...
@@ -187,3 +188,24 @@ inline void TestComponentProxyModel::test_setData()
...
@@ -187,3 +188,24 @@ inline void TestComponentProxyModel::test_setData()
QCOMPARE
(
model
.
data
(
model
.
index
(
0
,
1
,
QModelIndex
()),
Qt
::
DisplayRole
).
toDouble
(),
3.0
);
QCOMPARE
(
model
.
data
(
model
.
index
(
0
,
1
,
QModelIndex
()),
Qt
::
DisplayRole
).
toDouble
(),
3.0
);
QCOMPARE
(
proxy
.
data
(
proxy
.
index
(
0
,
1
,
QModelIndex
()),
Qt
::
DisplayRole
).
toDouble
(),
3.0
);
QCOMPARE
(
proxy
.
data
(
proxy
.
index
(
0
,
1
,
QModelIndex
()),
Qt
::
DisplayRole
).
toDouble
(),
3.0
);
}
}
//! Checks norification of proxy model then source inserts rows.
inline
void
TestComponentProxyModel
::
test_insertRows
()
{
SessionModel
model
(
"TestModel"
);
ComponentProxyModel
proxy
;
proxy
.
setSessionModel
(
&
model
);
QVERIFY
(
model
.
hasChildren
(
QModelIndex
())
==
false
);
QVERIFY
(
proxy
.
hasChildren
(
QModelIndex
())
==
false
);
QSignalSpy
spyProxy
(
&
proxy
,
&
ComponentProxyModel
::
layoutChanged
);
// inserting item in the source
model
.
insertNewItem
(
Constants
::
PropertyType
);
QCOMPARE
(
spyProxy
.
count
(),
1
);
QCOMPARE
(
proxy
.
rowCount
(
QModelIndex
()),
1
);
}
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