// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void InputPathWidget::setupGui() { // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); connect(value, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&))); QFileCompleter* com = new QFileCompleter(this, false); value->setCompleter(com); QObject::connect( com, SIGNAL(activated(const QString&)), this, SLOT(widgetChanged(const QString&))); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); QString currentPath = getFilter()->property(PROPERTY_NAME_AS_CHAR).toString(); value->setText(currentPath); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void SeparatorWidget::setupGui() { // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); label->setStyleSheet(getLabelStyleSheet()); blockSignals(true); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); } blockSignals(false); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DataContainerSelectionWidget::setupGui() { if(getFilter() == NULL) { return; } // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); if (getFilterParameter() == NULL) { return; } label->setText(getFilterParameter()->getHumanLabel() ); dataContainerCombo->blockSignals(true); dataContainerCombo->clear(); // Now let the gui send signals like normal dataContainerCombo->blockSignals(false); populateComboBoxes(); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void StringWidget::setupGui() { blockSignals(true); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); QString str = getFilter()->property(PROPERTY_NAME_AS_CHAR).toString(); value->setText(str); } blockSignals(false); applyChangesBtn->setVisible(false); // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); connect(value, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&))); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void CustomWidget::setupGui() { if (getFilterParameter() != NULL) { CustomWidgetLabel->setText(getFilterParameter()->getHumanLabel() ); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DataContainerCreationWidget::setupGui() { blockSignals(true); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); QString str = getFilter()->property(PROPERTY_NAME_AS_CHAR).toString(); dataContainerName->setText(str); } blockSignals(false); applyChangesBtn->setVisible(false); // Do not allow the user to put a forward slash into the dataContainerName line edit dataContainerName->setValidator(new QRegularExpressionValidator(QRegularExpression("[^/]*"), this)); // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its dataContainerNames updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); connect(dataContainerName, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&))); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void SecondOrderPolynomialWidget::setupGui() { // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); connect(c20, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c02, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c11, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c10, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c01, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c00, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); QDoubleValidator* c20Val = new QDoubleValidator(c20); c20->setValidator(c20Val); QDoubleValidator* c02Val = new QDoubleValidator(c02); c02->setValidator(c02Val); QDoubleValidator* c11Val = new QDoubleValidator(c11); c11->setValidator(c11Val); QDoubleValidator* c10Val = new QDoubleValidator(c10); c10->setValidator(c10Val); QDoubleValidator* c01Val = new QDoubleValidator(c01); c01->setValidator(c01Val); QDoubleValidator* c00Val = new QDoubleValidator(c00); c00->setValidator(c00Val); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); Float2ndOrderPoly_t data = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<Float2ndOrderPoly_t>(); c20->setText( QString::number(data.c20) ); c02->setText( QString::number(data.c02) ); c11->setText( QString::number(data.c11) ); c10->setText( QString::number(data.c10) ); c01->setText( QString::number(data.c01) ); c00->setText( QString::number(data.c00) ); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DataArraySelectionWidget::setupGui() { // Sanity Check the filter and the filter parameter if(getFilter() == NULL) { return; } if (getFilterParameter() == NULL) { return; } // Generate the text for the QLabel label->setText(getFilterParameter()->getHumanLabel() ); // Get the default path from the Filter instance to cache m_DefaultPath = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<DataArrayPath>(); // dataContainerCombo->addItem(m_DefaultPath.getDataContainerName()); // attributeMatrixCombo->addItem(m_DefaultPath.getAttributeMatrixName() ); // attributeArrayCombo->addItem(m_DefaultPath.getDataArrayName() ); // Block Signals from the ComboBoxes while we clear them dataContainerCombo->blockSignals(true); attributeMatrixCombo->blockSignals(true); attributeArrayCombo->blockSignals(true); dataContainerCombo->clear(); attributeMatrixCombo->clear(); attributeArrayCombo->clear(); dataContainerCombo->blockSignals(false); attributeMatrixCombo->blockSignals(false); attributeArrayCombo->blockSignals(false); populateComboBoxes(); // Lastly, hook up the filter's signals and slots to our own signals and slots // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FloatVec3Widget::setupGui() { // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); connect(xData, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(yData, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(zData, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); QLocale loc = QLocale::system(); QDoubleValidator* xVal = new QDoubleValidator(xData); xData->setValidator(xVal); xVal->setLocale(loc); QDoubleValidator* yVal = new QDoubleValidator(yData); yData->setValidator(yVal); yVal->setLocale(loc); QDoubleValidator* zVal = new QDoubleValidator(zData); zData->setValidator(zVal); zVal->setLocale(loc); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); FloatVec3_t data = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<FloatVec3_t>(); xData->setText(loc.toString(data.x)); yData->setText(loc.toString(data.y)); zData->setText(loc.toString(data.z)); } errorLabel->hide(); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FloatVec3Widget::widgetChanged(const QString& text) { Q_UNUSED(text); QLineEdit* le = NULL; (sender() == xData) ? le = xData: le = NULL; (sender() == yData) ? le = yData: le = NULL; (sender() == zData) ? le = zData: le = NULL; errorLabel->hide(); if(le) { if(le->text().isEmpty()) { QString objName = le->objectName(); DREAM3DStyles::LineEditErrorStyle(le); errorLabel->setStyleSheet(QString::fromLatin1("color: rgb(255, 0, 0);")); errorLabel->setText("No value entered. Filter will use default value of " + getFilterParameter()->getDefaultValue().toString()); errorLabel->show(); } } emit parametersChanged(); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DataContainerArrayProxyWidget::filterNeedsInputParameters(AbstractFilter* filter) { // qDebug() << "DataContainerArrayProxyWidget::filterNeedsInputParameters(AbstractFilter* filter)"; QVariant var; var.setValue(m_DcaProxy); bool ok = false; // Set the value into the Filter ok = filter->setProperty(PROPERTY_NAME_AS_CHAR, var); if(false == ok) { FilterParameterWidgetsDialogs::ShowCouldNotSetFilterParameter(getFilter(), getFilterParameter()); } // if(getFilterParameter()->isConditional() ) // { // var.setValue(conditionalCB->isChecked()); // ok = filter->setProperty(getFilterParameter()->getConditionalProperty().toLatin1().constData(), var); // if(false == ok) // { // FilterParameterWidgetsDialogs::ShowCouldNotSetConditionalFilterParameter(getFilter(), getFilterParameter()); // } // } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FourthOrderPolynomialWidget::filterNeedsInputParameters(AbstractFilter* filter) { bool ok = false; Float4thOrderPoly_t data; data.c40 = c40->text().toDouble(&ok); data.c04 = c04->text().toDouble(&ok); data.c31 = c31->text().toDouble(&ok); data.c13 = c13->text().toDouble(&ok); data.c22 = c22->text().toDouble(&ok); data.c30 = c30->text().toDouble(&ok); data.c03 = c03->text().toDouble(&ok); data.c21 = c21->text().toDouble(&ok); data.c12 = c12->text().toDouble(&ok); data.c20 = c20->text().toDouble(&ok); data.c02 = c02->text().toDouble(&ok); data.c11 = c11->text().toDouble(&ok); data.c10 = c10->text().toDouble(&ok); data.c01 = c01->text().toDouble(&ok); data.c00 = c00->text().toDouble(&ok); QVariant v; v.setValue(data); ok = filter->setProperty(PROPERTY_NAME_AS_CHAR, v); if(false == ok) { FilterParameterWidgetsDialogs::ShowCouldNotSetFilterParameter(getFilter(), getFilterParameter()); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void PhaseTypeSelectionWidget::filterNeedsInputParameters(AbstractFilter* filter) { int count = phaseListWidget->count(); // { // std::cout << "PhaseTypeSelectionWidget::filterNeedsInputParameters Count = " << count << std::endl; // } PhaseTypeSelectionFilterParameter* p = dynamic_cast<PhaseTypeSelectionFilterParameter*>(getFilterParameter()); QVariant var; // QVector<uint32_t> phaseTypes(count, DREAM3D::PhaseType::UnknownPhaseType); QVector<uint32_t> phaseTypes(count + 1, DREAM3D::PhaseType::UnknownPhaseType); bool ok = false; phaseTypes[0] = DREAM3D::PhaseType::UnknownPhaseType; for (int i = 0; i < count; ++i) { QComboBox* cb = qobject_cast<QComboBox*>(phaseListWidget->itemWidget(phaseListWidget->item(i))); unsigned int sType = static_cast<unsigned int>(cb->itemData(cb->currentIndex(), Qt::UserRole).toUInt(&ok)); //phaseTypes[i+1] = sType; phaseTypes[i + 1] = sType; } UInt32Vector_t data; data.d = phaseTypes; var.setValue(data); ok = false; // Set the value into the Filter ok = filter->setProperty(p->getPhaseTypeDataProperty().toLatin1().constData(), var); if(false == ok) { FilterParameterWidgetsDialogs::ShowCouldNotSetFilterParameter(getFilter(), getFilterParameter()); } DataArrayPath path(dataContainerCombo->currentText(), attributeMatrixCombo->currentText(), ""); var.setValue(path); ok = false; // Set the value into the Filter ok = filter->setProperty(p->getAttributeMatrixPathProperty().toLatin1().constData(), var); if(false == ok) { FilterParameterWidgetsDialogs::ShowCouldNotSetFilterParameter(getFilter(), getFilterParameter()); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void StringWidget::filterNeedsInputParameters(AbstractFilter* filter) { bool ok = filter->setProperty(PROPERTY_NAME_AS_CHAR, value->text()); if(false == ok) { FilterParameterWidgetsDialogs::ShowCouldNotSetFilterParameter(getFilter(), getFilterParameter()); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DataContainerCreationWidget::filterNeedsInputParameters(AbstractFilter* filter) { bool ok = filter->setProperty(PROPERTY_NAME_AS_CHAR, dataContainerName->text()); if(false == ok) { FilterParameterWidgetsDialogs::ShowCouldNotSetFilterParameter(getFilter(), getFilterParameter()); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void BooleanWidget::filterNeedsInputParameters(AbstractFilter* filter) { QVariant var(value->isChecked() ); bool ok = filter->setProperty(PROPERTY_NAME_AS_CHAR, var); if(false == ok) { FilterParameterWidgetsDialogs::ShowCouldNotSetFilterParameter(getFilter(), getFilterParameter()); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void ChoiceWidget::filterNeedsInputParameters(AbstractFilter* filter) { int index = value->currentIndex(); QVariant v(index); bool ok = filter->setProperty(PROPERTY_NAME_AS_CHAR, v); if(false == ok) { FilterParameterWidgetsDialogs::ShowCouldNotSetFilterParameter(getFilter(), getFilterParameter()); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void UnknownWidget::setupGui() { // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); if (getFilterParameter() != NULL) { QString str = QObject::tr("%1: Unknown Filter ParameterWidgetType: %2.").arg(getFilterParameter()->getHumanLabel()).arg(getFilterParameter()->getWidgetType()); label->setText( str ); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DataContainerReaderWidget::setupGui() { connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); // Put in a QStandardItemModel QAbstractItemModel* oldModel = dcaProxyView->model(); QStandardItemModel* model = new QStandardItemModel; dcaProxyView->setModel(model); delete oldModel; // void activated(const QModelIndex& index); connect(dcaProxyView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(itemActivated(const QModelIndex))); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); } if(getFilter() != NULL) { QString path = m_Filter->getInputFile(); filePath->setText(path); on_filePath_fileDropped(path); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void BooleanWidget::setupGui() { // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); connect(value, SIGNAL(stateChanged(int)), this, SLOT(widgetChanged(int) ) ); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); QVariant objValue = getFilter()->property(PROPERTY_NAME_AS_CHAR); if (objValue.isValid() == true) { value->setChecked(objValue.toBool()); } else { QString ss = QObject::tr("Error occurred getting Filter Parameter %1 for filter %2").arg(getFilterParameter()->getPropertyName()).arg(getFilter()->getNameOfClass()); emit errorSettingFilterParameter(ss); qDebug() << ss; } } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FloatVec3Widget::filterNeedsInputParameters(AbstractFilter* filter) { bool ok = false; FloatVec3_t defValue = m_FilterParameter->getDefaultValue().value<FloatVec3_t>(); FloatVec3_t data; QLocale loc; data.x = loc.toFloat(xData->text(), &ok); if(!ok) { errorLabel->setStyleSheet(QString::fromLatin1("color: rgb(255, 0, 0);")); errorLabel->setText("X Value entered is beyond the representable range for a double.\nThe filter will use the default value of " + getFilterParameter()->getDefaultValue().toString()); errorLabel->show(); DREAM3DStyles::LineEditErrorStyle(xData); data.x = defValue.x; } data.y = loc.toFloat(yData->text(), &ok); if(!ok) { errorLabel->setStyleSheet(QString::fromLatin1("color: rgb(255, 0, 0);")); errorLabel->setText("Y Value entered is beyond the representable range for a double.\nThe filter will use the default value of " + getFilterParameter()->getDefaultValue().toString()); errorLabel->show(); DREAM3DStyles::LineEditErrorStyle(xData); data.y = defValue.y; } data.z = loc.toFloat(zData->text(), &ok); if(!ok) { errorLabel->setStyleSheet(QString::fromLatin1("color: rgb(255, 0, 0);")); errorLabel->setText("Z Value entered is beyond the representable range for a double.\nThe filter will use the default value of " + getFilterParameter()->getDefaultValue().toString()); errorLabel->show(); DREAM3DStyles::LineEditErrorStyle(zData); data.z = defValue.z; } QVariant v; v.setValue(data); ok = filter->setProperty(PROPERTY_NAME_AS_CHAR, v); if(false == ok) { FilterParameterWidgetsDialogs::ShowCouldNotSetFilterParameter(getFilter(), getFilterParameter()); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void AttributeMatrixCreationWidget::filterNeedsInputParameters(AbstractFilter* filter) { // Generate the path to the AttributeArray DataArrayPath path(dataContainerCombo->currentText(), attributeMatrixName->text(), ""); QVariant var; var.setValue(path); bool ok = false; // Set the value into the Filter ok = filter->setProperty(PROPERTY_NAME_AS_CHAR, var); if (false == ok) { FilterParameterWidgetsDialogs::ShowCouldNotSetFilterParameter(getFilter(), getFilterParameter()); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void ChoiceWidget::setupGui() { // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); connect(value, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetChanged(int) ) ); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); // setup the list of choices for the widget ChoiceFilterParameter* choice = dynamic_cast<ChoiceFilterParameter*>(getFilterParameter()); if(choice) { QList<QString> choices = choice->getChoices().toList(); value->blockSignals(true); value->addItems(choices); value->blockSignals(false); } // Get the Default value from the filter int i = getFilter()->property(PROPERTY_NAME_AS_CHAR).toInt(); value->setCurrentIndex(i); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DataContainerArrayProxyWidget::setupGui() { connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); // Put in a QStandardItemModel QAbstractItemModel* oldModel = dcaProxyView->model(); QStandardItemModel* model = new QStandardItemModel; dcaProxyView->setModel(model); delete oldModel; connect(model, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(itemActivated(QStandardItem*))); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); //If the filter is just being dragged into the pipeline then the filter is going to have an empty // Proxy object at which point nothing is going to be put into the lists. But if the Filter was // initialized from a pipeline file then it might actually have a proxy so we need to do something // with that proxy? m_DcaProxy = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<DataContainerArrayProxy>(); //m_DcaProxy.print("DataContainerArrayProxyWidget::setupGui()"); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void ChoiceWidget::widgetChanged(int index, bool emitParametersChanged) { FilterParameter* fp = getFilterParameter(); // If the parameter type is LinkedChoicesFilterParameter then we need to emit the index that // was selected LinkedChoicesFilterParameter* lnkedChoices = dynamic_cast<LinkedChoicesFilterParameter*>(fp); if(lnkedChoices) { emit conditionalPropertyChanged(index); } // We emit no matter what if(emitParametersChanged) { emit parametersChanged(); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DataArraySelectionWidget::filterNeedsInputParameters(AbstractFilter* filter) { // Generate the path to the AttributeArray QString dc = dataContainerCombo->currentText(); QString am = attributeMatrixCombo->currentText(); QString da = attributeArrayCombo->currentText(); // qDebug() << "++++++++++++++++++++++++++++++++++++++++++++"; // qDebug() << getFilterParameter()->getHumanLabel() << ":" << dc << "/" << am << "/" << da << " m_DidCausePreflight:" << (int)(m_DidCausePreflight) << " " << (int)(attributeArrayCombo->signalsBlocked()); // qDebug() << "++++++++++++++++++++++++++++++++++++++++++++"; DataArrayPath path(dc, am, da); QVariant var; var.setValue(path); bool ok = false; // Set the value into the Filter ok = filter->setProperty(PROPERTY_NAME_AS_CHAR, var); if(false == ok) { FilterParameterWidgetsDialogs::ShowCouldNotSetFilterParameter(getFilter(), getFilterParameter()); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void Symmetric6x6Widget::filterNeedsInputParameters(AbstractFilter* filter) { bool ok = false; FloatVec21_t data; data.v11 = v11->text().toDouble(&ok); data.v12 = v12->text().toDouble(&ok); data.v13 = v13->text().toDouble(&ok); data.v14 = v14->text().toDouble(&ok); data.v15 = v15->text().toDouble(&ok); data.v16 = v16->text().toDouble(&ok); data.v22 = v22->text().toDouble(&ok); data.v23 = v23->text().toDouble(&ok); data.v24 = v24->text().toDouble(&ok); data.v25 = v25->text().toDouble(&ok); data.v26 = v26->text().toDouble(&ok); data.v33 = v33->text().toDouble(&ok); data.v34 = v34->text().toDouble(&ok); data.v35 = v35->text().toDouble(&ok); data.v36 = v36->text().toDouble(&ok); data.v44 = v44->text().toDouble(&ok); data.v45 = v45->text().toDouble(&ok); data.v46 = v46->text().toDouble(&ok); data.v55 = v55->text().toDouble(&ok); data.v56 = v56->text().toDouble(&ok); data.v66 = v66->text().toDouble(&ok); QVariant v; v.setValue(data); ok = filter->setProperty(PROPERTY_NAME_AS_CHAR, v); if(false == ok) { FilterParameterWidgetsDialogs::ShowCouldNotSetFilterParameter(getFilter(), getFilterParameter()); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DataContainerReaderWidget::beforePreflight() { #if 0 if (m_DidCausePreflight == false) { // qDebug() << getFilter()->getNameOfClass() << " DataContainerReaderWidget::beforePreflight()"; // Get the DataContainerArray from the Filter instance. This will have what will become the choices for the user // to select from. DataContainerArray::Pointer dca = getFilter()->getDataContainerArray(); DataContainerArrayProxy incomingProxy = DataContainerArrayProxy(dca.get() ); incomingProxy.setAllFlags(getFilterParameter()->getDefaultFlagValue()); //incomingProxy.print("BeforePreflight INCOMING"); //Now the idea becomes to save the selections that the user has made and transfer those changes to the incoming // proxy object updateProxyFromProxy(m_DcaProxy, incomingProxy); //proxy.print("'proxy' beforePreflight AFTER updateProxyFromProxy()"); m_DcaProxy = incomingProxy; // Now that the proxy was updated with our selections, make the updated incoming proxy into our cache // Now update the Model updateModelFromProxy(m_DcaProxy); } #endif }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void Symmetric6x6Widget::setupGui() { // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); connect(v11, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v12, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v13, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v14, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v15, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v16, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v22, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v23, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v24, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v25, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v26, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v33, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v34, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v35, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v36, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v44, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v45, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v46, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v55, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v56, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v66, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); QDoubleValidator* v11Val = new QDoubleValidator(v11); v11->setValidator(v11Val); QDoubleValidator* v12Val = new QDoubleValidator(v12); v12->setValidator(v12Val); QDoubleValidator* v13Val = new QDoubleValidator(v13); v13->setValidator(v13Val); QDoubleValidator* v14Val = new QDoubleValidator(v14); v14->setValidator(v14Val); QDoubleValidator* v15Val = new QDoubleValidator(v15); v15->setValidator(v15Val); QDoubleValidator* v16Val = new QDoubleValidator(v16); v16->setValidator(v16Val); QDoubleValidator* v22Val = new QDoubleValidator(v22); v22->setValidator(v22Val); QDoubleValidator* v23Val = new QDoubleValidator(v23); v23->setValidator(v23Val); QDoubleValidator* v24Val = new QDoubleValidator(v24); v24->setValidator(v24Val); QDoubleValidator* v25Val = new QDoubleValidator(v25); v25->setValidator(v25Val); QDoubleValidator* v26Val = new QDoubleValidator(v26); v26->setValidator(v26Val); QDoubleValidator* v33Val = new QDoubleValidator(v33); v33->setValidator(v33Val); QDoubleValidator* v34Val = new QDoubleValidator(v34); v34->setValidator(v34Val); QDoubleValidator* v35Val = new QDoubleValidator(v35); v35->setValidator(v35Val); QDoubleValidator* v36Val = new QDoubleValidator(v36); v36->setValidator(v36Val); QDoubleValidator* v44Val = new QDoubleValidator(v44); v44->setValidator(v44Val); QDoubleValidator* v45Val = new QDoubleValidator(v45); v45->setValidator(v45Val); QDoubleValidator* v46Val = new QDoubleValidator(v46); v46->setValidator(v46Val); QDoubleValidator* v55Val = new QDoubleValidator(v55); v55->setValidator(v55Val); QDoubleValidator* v56Val = new QDoubleValidator(v56); v56->setValidator(v56Val); QDoubleValidator* v66Val = new QDoubleValidator(v66); v66->setValidator(v66Val); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); FloatVec21_t data = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<FloatVec21_t>(); v11->setText( QString::number(data.v11) ); v12->setText( QString::number(data.v12) ); v13->setText( QString::number(data.v13) ); v14->setText( QString::number(data.v14) ); v15->setText( QString::number(data.v15) ); v16->setText( QString::number(data.v16) ); v22->setText( QString::number(data.v22) ); v23->setText( QString::number(data.v23) ); v24->setText( QString::number(data.v24) ); v25->setText( QString::number(data.v25) ); v26->setText( QString::number(data.v26) ); v33->setText( QString::number(data.v33) ); v34->setText( QString::number(data.v34) ); v35->setText( QString::number(data.v35) ); v36->setText( QString::number(data.v36) ); v44->setText( QString::number(data.v44) ); v45->setText( QString::number(data.v45) ); v46->setText( QString::number(data.v46) ); v55->setText( QString::number(data.v55) ); v56->setText( QString::number(data.v56) ); v66->setText( QString::number(data.v66) ); } //connect combobox to symmetry state connect(comboBox, SIGNAL(currentIndexChanged( int )), this, SLOT( changeSym( int ) ) ); clearSym(); changeSym(comboBox->currentIndex()); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void PhaseTypeSelectionWidget::updatePhaseComboBoxes() { bool ok = false; // setup the list of choices for the widget PhaseTypeSelectionFilterParameter* phaseTypes = dynamic_cast<PhaseTypeSelectionFilterParameter*>(getFilterParameter()); QString countProp = phaseTypes->getPhaseTypeCountProperty(); int phaseCount = getFilter()->property(countProp.toLatin1().constData()).toInt(&ok); QString phaseDataProp = phaseTypes->getPhaseTypeDataProperty(); UInt32Vector_t vectorWrapper = getFilter()->property(phaseDataProp.toLatin1().constData()).value<UInt32Vector_t>(); QVector<quint32> dataFromFilter = vectorWrapper.d; if(phaseCount < 0 && dataFromFilter.size() < 10) // there was an issue getting the phase Count from the Filter. { phaseCount = dataFromFilter.size(); // So lets just use the count from the actual phase data } // Get our list of predefined enumeration values QVector<unsigned int> phaseTypeEnums; PhaseType::getPhaseTypeEnums(phaseTypeEnums); phaseListWidget->clear(); // Get our list of Phase Type Strings QStringList phaseListChoices = m_FilterParameter->getPhaseListChoices(); for (int i = 1; i < phaseCount; i++) { QComboBox* cb = new QComboBox(NULL); for (int s = 0; s < phaseListChoices.size(); ++s) { cb->addItem((phaseListChoices[s]), phaseTypeEnums[s]); cb->setItemData(static_cast<int>(s), phaseTypeEnums[s], Qt::UserRole); } QListWidgetItem* item = new QListWidgetItem(phaseListWidget); phaseListWidget->addItem(item); phaseListWidget->setItemWidget(item, cb); if (i < dataFromFilter.size()) { cb->setCurrentIndex(dataFromFilter[i]); } connect(cb, SIGNAL(currentIndexChanged(int)), this, SLOT(phaseTypeComboBoxChanged(int)) ); } }