void procArg(const char* arg) { int c, p; // cluster/proc # char* tmp; MyString constraint; if(isdigit(*arg)) // process by cluster/proc # { c = strtol(arg, &tmp, 10); if(c <= 0) { fprintf(stderr, "Invalid cluster # from %s.\n", arg); had_error = true; return; } if(*tmp == '\0') // delete the cluster { constraint.formatstr( "%s==%d", ATTR_CLUSTER_ID, c ); addConstraint(constraint.Value()); return; } if(*tmp == '.') { p = strtol(tmp + 1, &tmp, 10); if(p < 0) { fprintf( stderr, "Invalid proc # from %s.\n", arg); had_error = 1; return; } if(*tmp == '\0') // process a proc { constraint.formatstr( "(%s==%d && %s==%d)", ATTR_CLUSTER_ID, c, ATTR_PROC_ID, p); addConstraint(constraint.Value()); return; } } fprintf( stderr, "Warning: unrecognized \"%s\" skipped.\n", arg ); return; } else if(isalpha(*arg)) // process by user name { constraint.formatstr( "%s == \"%s\"", ATTR_OWNER, arg ); addConstraint(constraint.Value()); } else { fprintf( stderr, "Warning: unrecognized \"%s\" skipped\n", arg ); } }
/** * Add constraints to the created function * @param fun :: The function * @param expr :: The constraint expression. The expression name must be either * a single constraint * expression such as "0 < Sigma < 1" or a list of constraint expressions * separated by commas ',' * and enclosed in brackets "(...)" . */ void FunctionFactoryImpl::addConstraints(IFunction_sptr fun, const Expression &expr) const { if (expr.name() == ",") { for (const auto &constraint : expr) { addConstraint(fun, constraint); } } else { addConstraint(fun, expr); } }
void Physics3DWorld::addPhysics3DConstraint(Physics3DConstraint* constraint, bool disableCollisionsBetweenLinkedObjs) { auto body = constraint->getBodyA(); if (body) body->addConstraint(constraint); body = constraint->getBodyB(); if (body) { body->addConstraint(constraint); } _btPhyiscsWorld->addConstraint(constraint->getbtContraint(), disableCollisionsBetweenLinkedObjs); }
/** * Add constraints to the created function * @param fun :: The function * @param expr :: The constraint expression. The expression name must be either a single constraint * expression such as "0 < Sigma < 1" or a list of constraint expressions separated by commas ',' * and enclosed in brackets "(...)" . */ void FunctionFactoryImpl::addConstraints(IFitFunction* fun,const Expression& expr)const { if (expr.name() == ",") { for(size_t i=0;i<expr.size();i++) { addConstraint(fun,expr[i]); } } else { addConstraint(fun,expr); } }
ofxMSAAttraction* ofxMSAPhysics::makeAttraction(ofxMSAParticle *a, ofxMSAParticle *b, float _strength, float _minimumDistance) { if(a==b) return NULL; ofxMSAAttraction* c = new ofxMSAAttraction(a, b, _strength, _minimumDistance); addConstraint(c); c->release(); // cos addConstraint(c) retains it return c; }
// Method to set multi-constraints ConstraintSystem& ConstraintSystem::setConstraint(const VariableSet& varSet, const Vector<double>& prefit) { // Fist, we check the size of inputs const int size = varSet.size(); if( prefit.size()!=size ) { Exception e("The input size doesn't match."); GPSTK_THROW(e); } clearConstraint(); int i(0); for(VariableSet::const_iterator it = varSet.begin(); it != varSet.end(); ++it) { Constraint constraint; constraint.header.prefit = prefit[i]; constraint.body[*it] = 1.0; addConstraint(constraint); i++; } return (*this); } // End of method 'ConstraintSystem::setConstraint()'
ofxMSASpring* ofxMSAPhysics::makeSpring(ofxMSAParticle *a, ofxMSAParticle *b, float _strength, float _restLength) { if(a==b) return NULL; ofxMSASpring* c = new ofxMSASpring(a, b, _strength, _restLength); addConstraint(c); c->release(); // cos addConstraint(c) retains it return c; }
AddConstraintSubjectActivityTagPreferredRoomsForm::AddConstraintSubjectActivityTagPreferredRoomsForm(QWidget* parent): QDialog(parent) { setupUi(this); addConstraintPushButton->setDefault(true); roomsListWidget->setSelectionMode(QAbstractItemView::SingleSelection); selectedRoomsListWidget->setSelectionMode(QAbstractItemView::SingleSelection); connect(closePushButton, SIGNAL(clicked()), this, SLOT(close())); connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addConstraint())); connect(roomsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(addRoom())); connect(selectedRoomsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(removeRoom())); connect(clearPushButton, SIGNAL(clicked()), this, SLOT(clear())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); QSize tmp3=subjectsComboBox->minimumSizeHint(); Q_UNUSED(tmp3); QSize tmp4=activityTagsComboBox->minimumSizeHint(); Q_UNUSED(tmp4); updateRoomsListWidget(); for(int i=0; i<gt.rules.subjectsList.size(); i++){ Subject* sb=gt.rules.subjectsList[i]; subjectsComboBox->addItem(sb->name); } for(int i=0; i<gt.rules.activityTagsList.size(); i++){ ActivityTag* sb=gt.rules.activityTagsList[i]; activityTagsComboBox->addItem(sb->name); } }
bool EntryDelegate::editorEvent( QEvent* event, QAbstractItemModel *model, const QStyleOptionViewItem& option, const QModelIndex& index ) { if ( event->type() != QEvent::MouseButtonDblClick ) return false; if ( !index.isValid() ) return QItemDelegate::editorEvent( event, model, option, index ); QPointer<EntryDialog> dialog = new EntryDialog( model ); dialog->initFrom( index, constraintModel ); dialog->setWindowTitle( tr( "Edit Entry" ) ); dialog->exec(); if ( !dialog ) return false; int row = index.row(); const QModelIndex parent = index.parent(); model->setData( model->index( row, 0, parent ), dialog->name() ); model->setData( model->index( row, 1, parent ), dialog->type() ); if ( dialog->type() != KGantt::TypeSummary ) { model->setData( model->index( row, 2, parent ), dialog->startDate(), KGantt::StartTimeRole ); model->setData( model->index( row, 3, parent ), dialog->endDate(), KGantt::EndTimeRole ); } model->setData( model->index( row, 4, parent ), dialog->completion() ); model->setData( model->index( row, 5, parent ), dialog->legend() ); addConstraint( dialog->depends(), model->index( row, 0, parent ) ); setReadOnly( model->index( row, 0, parent ), dialog->readOnly() ); delete dialog; return true; }
ScenarioModel::ScenarioModel(const ScenarioModel& source, const id_type<ProcessModel>& id, QObject* parent) : ProcessModel {source, id, "ScenarioModel", parent}, m_startTimeNodeId{source.m_startTimeNodeId}, m_endTimeNodeId{source.m_endTimeNodeId}, m_startEventId{source.m_startEventId}, m_endEventId{source.m_endEventId} { pluginModelList = new iscore::ElementPluginModelList(*source.pluginModelList, this); for(TimeNodeModel* timenode : source.m_timeNodes) { addTimeNode(new TimeNodeModel {*timenode, timenode->id(), this}); } for(EventModel* event : source.m_events) { addEvent(new EventModel {*event, event->id(), this}); } for(StateModel* state : source.m_states) { addDisplayedState(new StateModel{*state, state->id(), this}); } for(ConstraintModel* constraint : source.m_constraints) { addConstraint(new ConstraintModel {*constraint, constraint->id(), this}); } }
/// Adds a default constraint so cell angles are in the range 0 to 180. void PawleyParameterFunction::addAngleConstraint( const std::string ¶meterName) { BoundaryConstraint *cellAngleConstraint = new BoundaryConstraint(this, parameterName, 0.0, 180.0, true); cellAngleConstraint->setPenaltyFactor(1e12); addConstraint(cellAngleConstraint); }
ConstraintSubjectPreferredRoomsForm::ConstraintSubjectPreferredRoomsForm(QWidget* parent): QDialog(parent) { setupUi(this); currentConstraintTextEdit->setReadOnly(true); modifyConstraintPushButton->setDefault(true); constraintsListWidget->setSelectionMode(QAbstractItemView::SingleSelection); connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addConstraint())); connect(removeConstraintPushButton, SIGNAL(clicked()), this, SLOT(removeConstraint())); connect(closePushButton, SIGNAL(clicked()), this, SLOT(close())); connect(constraintsListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(constraintChanged(int))); connect(modifyConstraintPushButton, SIGNAL(clicked()), this, SLOT(modifyConstraint())); connect(subjectsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(constraintsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(modifyConstraint())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); QSize tmp3=subjectsComboBox->minimumSizeHint(); Q_UNUSED(tmp3); subjectsComboBox->addItem(""); for(int i=0; i<gt.rules.subjectsList.size(); i++){ Subject* sb=gt.rules.subjectsList[i]; subjectsComboBox->addItem(sb->name); } this->refreshConstraintsListWidget(); }
ConstraintStudentsActivityTagMaxHoursDailyForm::ConstraintStudentsActivityTagMaxHoursDailyForm(QWidget* parent): QDialog(parent) { setupUi(this); currentConstraintTextEdit->setReadOnly(true); modifyConstraintPushButton->setDefault(true); constraintsListWidget->setSelectionMode(QAbstractItemView::SingleSelection); connect(constraintsListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(constraintChanged(int))); connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addConstraint())); connect(closePushButton, SIGNAL(clicked()), this, SLOT(close())); connect(removeConstraintPushButton, SIGNAL(clicked()), this, SLOT(removeConstraint())); connect(modifyConstraintPushButton, SIGNAL(clicked()), this, SLOT(modifyConstraint())); connect(constraintsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(modifyConstraint())); connect(activityTagsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(helpPushButton, SIGNAL(clicked()), this, SLOT(help())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); QSize tmp4=activityTagsComboBox->minimumSizeHint(); Q_UNUSED(tmp4); activityTagsComboBox->clear(); activityTagsComboBox->addItem(""); foreach(ActivityTag* at, gt.rules.activityTagsList) activityTagsComboBox->addItem(at->name); this->filterChanged(); }
// Remove a single constraint ConstraintSystem& ConstraintSystem::removeConstraint( const Constraint& constraint ) { ConstraintList backupList; for(ConstraintList::iterator it= constraintList.begin(); it!=constraintList.end(); ++it) { bool isEqual(true); if(it->header.prefit!=constraint.header.prefit) isEqual=false; if(it->header.variance!=constraint.header.variance) isEqual=false; if(it->body != constraint.body) isEqual = false; if( !isEqual ) backupList.push_back(*it); } clearConstraint(); for(ConstraintList::iterator it= backupList.begin(); it!=backupList.end(); ++it) { addConstraint(*it); } return (*this); } // End of method 'ConstraintSystem::removeConstraint()'
ConstraintTeacherNotAvailableTimesForm::ConstraintTeacherNotAvailableTimesForm(QWidget* parent): QDialog(parent) { setupUi(this); currentConstraintTextEdit->setReadOnly(true); modifyConstraintPushButton->setDefault(true); constraintsListWidget->setSelectionMode(QAbstractItemView::SingleSelection); connect(constraintsListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(constraintChanged(int))); connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addConstraint())); connect(closePushButton, SIGNAL(clicked()), this, SLOT(close())); connect(removeConstraintPushButton, SIGNAL(clicked()), this, SLOT(removeConstraint())); connect(modifyConstraintPushButton, SIGNAL(clicked()), this, SLOT(modifyConstraint())); connect(teachersComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(constraintsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(modifyConstraint())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); QSize tmp1=teachersComboBox->minimumSizeHint(); Q_UNUSED(tmp1); teachersComboBox->addItem(""); for(int i=0; i<gt.rules.teachersList.size(); i++){ Teacher* tch=gt.rules.teachersList[i]; teachersComboBox->addItem(tch->name); } this->filterChanged(); }
AddConstraintActivitiesPreferredStartingTimesForm::AddConstraintActivitiesPreferredStartingTimesForm(QWidget* parent): QDialog(parent) { setupUi(this); addConstraintPushButton->setDefault(true); connect(preferredTimesTable, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(itemClicked(QTableWidgetItem*))); connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addConstraint())); connect(closePushButton, SIGNAL(clicked()), this, SLOT(close())); connect(setAllAllowedPushButton, SIGNAL(clicked()), this, SLOT(setAllSlotsAllowed())); connect(setAllNotAllowedPushButton, SIGNAL(clicked()), this, SLOT(setAllSlotsNotAllowed())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); QSize tmp1=teachersComboBox->minimumSizeHint(); Q_UNUSED(tmp1); QSize tmp2=studentsComboBox->minimumSizeHint(); Q_UNUSED(tmp2); QSize tmp3=subjectsComboBox->minimumSizeHint(); Q_UNUSED(tmp3); QSize tmp4=activityTagsComboBox->minimumSizeHint(); Q_UNUSED(tmp4); updateTeachersComboBox(); updateStudentsComboBox(); updateSubjectsComboBox(); updateActivityTagsComboBox(); preferredTimesTable->setRowCount(gt.rules.nHoursPerDay); preferredTimesTable->setColumnCount(gt.rules.nDaysPerWeek); for(int j=0; j<gt.rules.nDaysPerWeek; j++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.daysOfTheWeek[j]); preferredTimesTable->setHorizontalHeaderItem(j, item); } for(int i=0; i<gt.rules.nHoursPerDay; i++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.hoursOfTheDay[i]); preferredTimesTable->setVerticalHeaderItem(i, item); } for(int i=0; i<gt.rules.nHoursPerDay; i++) for(int j=0; j<gt.rules.nDaysPerWeek; j++){ QTableWidgetItem* item=new QTableWidgetItem(YES); item->setTextAlignment(Qt::AlignCenter); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); colorItem(item); preferredTimesTable->setItem(i, j, item); } preferredTimesTable->resizeRowsToContents(); connect(preferredTimesTable->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(horizontalHeaderClicked(int))); connect(preferredTimesTable->verticalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(verticalHeaderClicked(int))); preferredTimesTable->setSelectionMode(QAbstractItemView::NoSelection); tableWidgetUpdateBug(preferredTimesTable); setStretchAvailabilityTableNicely(preferredTimesTable); }
ofxMSACollision* ofxMSAPhysics::makeCollision(ofxMSAParticle *a, ofxMSAParticle *b) { if(a==b) return NULL; if(getConstraint(a, b, OFX_MSA_CONSTRAINT_TYPE_COLLISION) != NULL) return NULL; ofxMSACollision* c = new ofxMSACollision(a, b); addConstraint(c); c->release(); // cos addConstraint(c) retains it return c; }
void handleAll() { char constraint[128]; sprintf( constraint, "%s >= 0", ATTR_CLUSTER_ID ); addConstraint(constraint); }
/** * Fit peak without background i.e, with background removed * inspired from FitPowderDiffPeaks.cpp * copied from PoldiPeakDetection2.cpp * @param workspaceindex :: indice of the row to use @param center :: gaussian parameter - center @param sigma :: gaussian parameter - width @param height :: gaussian parameter - height @param startX :: fit range - start X value @param endX :: fit range - end X value @returns A boolean status flag, true for fit success, false else */ bool ConvertEmptyToTof::doFitGaussianPeak(int workspaceindex, double ¢er, double &sigma, double &height, double startX, double endX) { g_log.debug("Calling doFitGaussianPeak..."); // 1. Estimate sigma = sigma * 0.5; // 2. Use factory to generate Gaussian auto temppeak = API::FunctionFactory::Instance().createFunction("Gaussian"); auto gaussianpeak = boost::dynamic_pointer_cast<API::IPeakFunction>(temppeak); gaussianpeak->setHeight(height); gaussianpeak->setCentre(center); gaussianpeak->setFwhm(sigma); // 3. Constraint double centerleftend = center - sigma * 0.5; double centerrightend = center + sigma * 0.5; std::ostringstream os; os << centerleftend << " < PeakCentre < " << centerrightend; auto *centerbound = API::ConstraintFactory::Instance().createInitialized( gaussianpeak.get(), os.str(), false); gaussianpeak->addConstraint(centerbound); g_log.debug("Calling createChildAlgorithm : Fit..."); // 4. Fit API::IAlgorithm_sptr fitalg = createChildAlgorithm("Fit", -1, -1, true); fitalg->initialize(); fitalg->setProperty( "Function", boost::dynamic_pointer_cast<API::IFunction>(gaussianpeak)); fitalg->setProperty("InputWorkspace", m_inputWS); fitalg->setProperty("WorkspaceIndex", workspaceindex); fitalg->setProperty("Minimizer", "Levenberg-MarquardtMD"); fitalg->setProperty("CostFunction", "Least squares"); fitalg->setProperty("MaxIterations", 1000); fitalg->setProperty("Output", "FitGaussianPeak"); fitalg->setProperty("StartX", startX); fitalg->setProperty("EndX", endX); // 5. Result bool successfulfit = fitalg->execute(); if (!fitalg->isExecuted() || !successfulfit) { // Early return due to bad fit g_log.warning() << "Fitting Gaussian peak for peak around " << gaussianpeak->centre() << '\n'; return false; } // 6. Get result center = gaussianpeak->centre(); height = gaussianpeak->height(); double fwhm = gaussianpeak->fwhm(); return fwhm > 0.0; }
void WorkloadGenerator::generateAndAddFilter(set<simple_filter *> &subscriptions) { simple_filter *filter = new simple_filter(); int numConstr = paramHandler->getMinConstr()+rand()%(1+paramHandler->getMaxConstr()-paramHandler->getMinConstr()); set<int> alreadyConsidered; for (int i=0; i<numConstr; i++) { addConstraint(filter, alreadyConsidered); } subscriptions.insert(filter); }
value camlidl_accessMinisatP_addConstraint( value _v_ps, value _v_cs, value _v_rhs, value _v_ineq) { //char (*ps)[30]; /*in*/ char** ps; int *cs = NULL; /*in*/ int n_p; int rhs; /*in*/ int ineq; /*in*/ value _v_ps_tmp, _v_cs_tmp; rhs = Int_val(_v_rhs); ineq = Int_val(_v_ineq); _v_ps_tmp = _v_ps; _v_cs_tmp = _v_cs; int i=0; //Determine ist length - maybe list length should be required as a parameter while ((_v_ps_tmp != Val_int(0)) && (_v_cs_tmp != Val_int(0))){ //while no list end reached i++; _v_cs_tmp = Field(_v_cs_tmp, 1); _v_ps_tmp = Field(_v_ps_tmp, 1); } n_p=i; // fail if there are not as many variables as coefficients if ((_v_ps_tmp != Val_int(0)) || (_v_cs_tmp != Val_int(0))) caml_failwith("invalid constraint: lists have different lengths"); //causes Failure "..." //allocate array space ps = malloc(n_p * sizeof(*ps)); cs = malloc(n_p * sizeof(int)); //hope that strings are not longer than 30 //printf("In addConstraint. list should have %i members.\n", n_p); _v_ps_tmp = _v_ps; _v_cs_tmp = _v_cs; for (i=0; i<n_p; i++){ cs[i] = Int_val(Field(_v_cs_tmp, 0)); //first part of cons cell contains list element ... ps[i] = malloc(30); strncpy(ps[i], String_val(Field(_v_ps_tmp, 0)), 29); //printf(" Filled\n"); _v_cs_tmp = Field(_v_cs_tmp, 1); // second component contains rest of list _v_ps_tmp = Field(_v_ps_tmp, 1); //printf(" Component %i: %i * %s\n", i, cs[i], ps[i]); } addConstraint(ps, cs, n_p, rhs, ineq); return Val_unit; }
void MtxLP::cutSolution(stomap *sol, bool tmp){ double colsum = 0; stomap sto; for (stomap::iterator it = sol->begin(); it != sol->end(); ++it){ colsum += it->second; sto[it->first] = 1; } double dif = getKind() == MILP ? 1 : 0.1; addConstraint(&sto, 0, colsum - dif, tmp); }
ParallelConstraint(unsigned int links, unsigned int chains, double radius = 1, double length = 1, double jointRadius = 0.2) : ob::ConstraintIntersection(3 * links * chains, {}) , links_(links) , chains_(chains) , radius_(radius) , length_(length) , jointRadius_(jointRadius) { Eigen::Vector3d offset = Eigen::Vector3d::UnitX(); for (unsigned int i = 0; i < chains_; ++i) { addConstraint(std::make_shared<ParallelChain>(chains * links * 3, offset, links, i, length)); offset = Eigen::AngleAxisd(2 * boost::math::constants::pi<double>() / (double)chains, Eigen::Vector3d::UnitZ()) * offset; } addConstraint(std::make_shared<ParallelPlatform>(links, chains, radius)); }
// Add a constraint list ConstraintSystem& ConstraintSystem::addConstraintList( const ConstraintList& equationList) { for(ConstraintList::const_iterator it = equationList.begin(); it != equationList.end(); ++it) { addConstraint(*it); } return (*this); }
OptionDescription& OptionDescription::format(const std::string& regexFormat, const std::string& displayFormat) { if (_type != String) { StringBuilder sb; sb << "Could not register option \"" << _dottedName << "\": " << "only options registered as a string type can have a required format, " << "but option has type: " << _type; throw DBException(sb.str(), ErrorCodes::InternalError); } return addConstraint(new StringFormatKeyConstraint(_dottedName, regexFormat, displayFormat)); }
ConstraintStudentsSetActivityTagMaxHoursDailyForm::ConstraintStudentsSetActivityTagMaxHoursDailyForm(QWidget* parent): QDialog(parent) { setupUi(this); currentConstraintTextEdit->setReadOnly(true); modifyConstraintPushButton->setDefault(true); constraintsListWidget->setSelectionMode(QAbstractItemView::SingleSelection); connect(constraintsListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(constraintChanged(int))); connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addConstraint())); connect(closePushButton, SIGNAL(clicked()), this, SLOT(close())); connect(removeConstraintPushButton, SIGNAL(clicked()), this, SLOT(removeConstraint())); connect(modifyConstraintPushButton, SIGNAL(clicked()), this, SLOT(modifyConstraint())); connect(studentsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(constraintsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(modifyConstraint())); connect(activityTagsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(helpPushButton, SIGNAL(clicked()), this, SLOT(help())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); QSize tmp2=studentsComboBox->minimumSizeHint(); Q_UNUSED(tmp2); QSize tmp4=activityTagsComboBox->minimumSizeHint(); Q_UNUSED(tmp4); studentsComboBox->addItem(""); for(int i=0; i<gt.rules.yearsList.size(); i++){ StudentsYear* sty=gt.rules.yearsList[i]; studentsComboBox->addItem(sty->name); for(int j=0; j<sty->groupsList.size(); j++){ StudentsGroup* stg=sty->groupsList[j]; studentsComboBox->addItem(stg->name); if(SHOW_SUBGROUPS_IN_COMBO_BOXES) for(int k=0; k<stg->subgroupsList.size(); k++){ StudentsSubgroup* sts=stg->subgroupsList[k]; studentsComboBox->addItem(sts->name); } } } activityTagsComboBox->clear(); activityTagsComboBox->addItem(""); foreach(ActivityTag* at, gt.rules.activityTagsList) activityTagsComboBox->addItem(at->name); this->filterChanged(); }
void PlanningTaskModelConstraintAdapter::createConstraints() { int rowCount = _model->rowCount(QModelIndex()); for (int i = 0; i < rowCount; ++i) { PlanningTaskConstraintPtr pt = qSharedPointerDynamicCast<PlanningTaskConstraint>(_model->getItemByRowid(i)); QModelIndex startTask = _planningModel->index(pt->idTask1()); QModelIndex endTask = _planningModel->index(pt->idTask2()); KDGantt::Constraint::Type type = static_cast<KDGantt::Constraint::Type>(pt->Type()); KDGantt::Constraint::RelationType relType = static_cast<KDGantt::Constraint::RelationType>(pt->RelationType()); KDGantt::Constraint c(startTask, endTask, type, relType); addConstraint(c); } }
ConstraintStudentsSetHomeRoomForm::ConstraintStudentsSetHomeRoomForm(QWidget* parent): QDialog(parent) { setupUi(this); currentConstraintTextEdit->setReadOnly(true); modifyConstraintPushButton->setDefault(true); constraintsListWidget->setSelectionMode(QAbstractItemView::SingleSelection); connect(constraintsListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(constraintChanged(int))); connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addConstraint())); connect(closePushButton, SIGNAL(clicked()), this, SLOT(close())); connect(removeConstraintPushButton, SIGNAL(clicked()), this, SLOT(removeConstraint())); connect(modifyConstraintPushButton, SIGNAL(clicked()), this, SLOT(modifyConstraint())); connect(constraintsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(modifyConstraint())); connect(studentsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(roomsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); QSize tmp2=studentsComboBox->minimumSizeHint(); Q_UNUSED(tmp2); QSize tmp5=roomsComboBox->minimumSizeHint(); Q_UNUSED(tmp5); studentsComboBox->addItem(""); for(int i=0; i<gt.rules.yearsList.size(); i++){ StudentsYear* sty=gt.rules.yearsList[i]; studentsComboBox->addItem(sty->name); for(int j=0; j<sty->groupsList.size(); j++){ StudentsGroup* stg=sty->groupsList[j]; studentsComboBox->addItem(stg->name); for(int k=0; k<stg->subgroupsList.size(); k++){ StudentsSubgroup* sts=stg->subgroupsList[k]; studentsComboBox->addItem(sts->name); } } } roomsComboBox->addItem(""); foreach(Room* rm, gt.rules.roomsList) roomsComboBox->addItem(rm->name); this->filterChanged(); }
OptionDescription& OptionDescription::validRange(long min, long max) { if (_type != Double && _type != Int && _type != Long && _type != UnsignedLongLong && _type != Unsigned) { StringBuilder sb; sb << "Could not register option \"" << _dottedName << "\": " << "only options registered as a numeric type can have a valid range, " << "but option has type: " << _type; throw DBException(sb.str(), ErrorCodes::InternalError); } return addConstraint(new NumericKeyConstraint(_dottedName, min, max)); }
ConstraintsDialog::ConstraintsDialog( QWidget *parent, Qt::WindowFlags f ) : QDialog( parent, f ) { ui.setupUi(this); connect( ui.ConstraintsOK, SIGNAL( clicked() ), this, SLOT( acceptConstraints() )); connect( ui.ConstraintsAdd, SIGNAL( clicked() ), this, SLOT( addConstraint() )); connect( ui.ConstraintsDelete, SIGNAL( clicked() ), this, SLOT( deleteConstraint() )); connect( ui.ConstraintsDeleteAll, SIGNAL( clicked() ), this, SLOT( deleteAllConstraints() )); connect( ui.comboType, SIGNAL( currentIndexChanged(int) ), this, SLOT( comboTypeChanged(int) )); m_forceField = OpenBabel::OBForceField::FindForceField( "MMFF94" ); ui.editValue->setMinimum(0.0); ui.editValue->setMaximum(0.0); }