void VariogramInput::update_structures_count(int val ) { int current_count = structures_.size(); if( current_count == val ) return; if( current_count < val ) { // add one (or more) new structure(s) for( int i=0; i < val - current_count; i ++ ) { QString count_str; count_str.setNum( current_count + i + 1 ); Line_separator* separator = new Line_separator( "Structure " + count_str); Variogram_structure_input* structure = new Variogram_structure_input(); structures_frame_->layout()->addWidget(separator); structures_frame_->layout()->addWidget(structure); structure->show(); separator->show(); structures_.push_back( std::make_pair( separator, structure ) ); } } else { // remove one (or more) structure(s) for( int j = current_count-1; j >= val ; j -- ) { delete structures_[ j ].first; delete structures_[ j ].second; structures_.pop_back(); } } structures_count_->setValue( val ); }