add function to sort an elements list by the positions of elements.

this function is use by:
cross ref item -> shild are always sorted
element selector widget -> list of widget are sorted.


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2931 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-03-18 12:35:36 +00:00
parent 9402541022
commit e516cc6a87
3 changed files with 34 additions and 2 deletions

View File

@@ -35,6 +35,7 @@ ElementSelectorWidget::ElementSelectorWidget(QList <Element *> elmt_list, QWidge
selected_element(0),
showed_element(0)
{
qSort(elements_list.begin(), elements_list.end(), comparPos);
ui->setupUi(this);
buildInterface();
}
@@ -86,6 +87,7 @@ void ElementSelectorWidget::clear() {
void ElementSelectorWidget::setList(QList<Element *> elmt_list) {
clear();
elements_list << elmt_list;
qSort(elements_list.begin(), elements_list.end(), comparPos);
buildInterface();
}