Commit 0393c1bd authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

Container selection with checkbox in statistics

parent b15edf5d
......@@ -25,23 +25,31 @@ void Stats_window::set_container_names() {
}
// Add the root container names
QList<QTreeWidgetItem *> items;
QFlags<Qt::ItemFlag> flg=Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsTristate;
for (list<Container *>::const_iterator it = root_containers->begin();
it != root_containers->end();
it ++) {
string name = (*it)->get_name().to_string();
QStringList temp(QString::fromStdString(name));
string name = (*it)->get_name().to_string();
QStringList temp(QString::fromStdString(name));
QTreeWidgetItem *current_node = new QTreeWidgetItem((QTreeWidgetItem *)0, temp);
current_node->setFlags(flg);
current_node->setCheckState(0,Qt::Unchecked);
items.append(current_node);
// Recursivity to add the children names
set_container_names_rec(current_node, (*it));
}
(*(items.begin()))->setExpanded(true);
_nodes_selected->insertTopLevelItems(0, items);
}
void Stats_window::set_container_names_rec(QTreeWidgetItem *current_node, Container *current_container) {
const list<Container *> *children = current_container->get_children();
QFlags<Qt::ItemFlag> flg = Qt::ItemIsUserCheckable | Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsTristate;
for (list<Container *>::const_iterator it = children->begin();
it != children->end();
it ++) {
......@@ -49,6 +57,8 @@ void Stats_window::set_container_names_rec(QTreeWidgetItem *current_node, Contai
string name = (*it)->get_name().to_string();
QStringList temp(QString::fromStdString(name));
QTreeWidgetItem *node = new QTreeWidgetItem(current_node, temp);
node->setFlags(flg);
node->setCheckState(0,Qt::Unchecked);
set_container_names_rec(node ,(*it));
}
}
......@@ -85,9 +95,10 @@ void Stats_window::set_selected_nodes(){
}
// We fill the new selected containers
// TODO : Use the tree instead of the list
QTreeWidgetItemIterator it(_nodes_selected);
while (*it) {
if ((*it)->isSelected()){
if ((*it)->checkState(0) == Qt::Checked){
_selected_containers.push_back(_trace->search_container((*it)->text(0).toStdString()));
}
it ++;
......@@ -136,7 +147,6 @@ void Stats_window::on_reload_button_clicked() {
}
drawer->set_times(_start_time, _end_time);
drawer->build(_ui_stats_area, _selected_containers);
_ui_stats_area->updateGL();
delete drawer;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment