! * \brief Iterates over all process property widgets and shows/hides * them based on group prefix * * Example for 2 groups: * -gauss_gamma * -gauss_deviation * -impulse_deviation * -impulse_type * * use * to show all groups * * \param prefix */
| 399 | * \param prefix |
| 400 | */ |
| 401 | void IPProcessPropertiesWidget::showPropertyGroup(QString prefix) |
| 402 | { |
| 403 | for (int i = 0; i < layout()->count(); ++i) |
| 404 | { |
| 405 | IPPropertyWidget* widget = dynamic_cast<IPPropertyWidget*>(layout()->itemAt(i)->widget()); |
| 406 | |
| 407 | if(!widget || !widget->processProperty()) |
| 408 | continue; |
| 409 | |
| 410 | QString name(widget->processProperty()->name()); |
| 411 | |
| 412 | if(name.contains("_")) |
| 413 | { |
| 414 | QStringList nameParts = name.split("_"); |
| 415 | |
| 416 | // QFormLayout doesn't allow to show/hide rows, |
| 417 | // so it is easier to enable/disable the controls |
| 418 | if(nameParts[0] == prefix || prefix == "*") |
| 419 | { |
| 420 | widget->setEnabled(true); |
| 421 | } |
| 422 | else |
| 423 | { |
| 424 | widget->setEnabled(false); |
| 425 | } |
| 426 | } |
| 427 | } |
| 428 | } |