本文整理汇总了C++中Relation::getEntL方法的典型用法代码示例。如果您正苦于以下问题:C++ Relation::getEntL方法的具体用法?C++ Relation::getEntL怎么用?C++ Relation::getEntL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Relation
的用法示例。
在下文中一共展示了Relation::getEntL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mousePressEvent
void WorkPlaceWidget::mousePressEvent(QMouseEvent* pe){
if(this->core->getState()==0){ // Добавление сущности
//=====================================================
string name;
int num = this->core->getCounter();
char str[255];
sprintf(str, "Entitie № %d", num);
name = (const char*)str;
Entitie* e0 = EntitieFactory::entitieFactory()->createEntitie(this->core->getEntitieType());
((IntField*)e0->fieldByID("X"))->setValue(pe->x());
((IntField*)e0->fieldByID("Y"))->setValue(pe->y());
calculateEntitie(e0);
//=====================================================
bool add = true;
for(int i=0; i<this->core->getEntitieCount(); i++){
Entitie* e = this->core->getEntitieAt(i);
int x = ((IntField*)e->fieldByID("X"))->getValue();
int y = ((IntField*)e->fieldByID("Y"))->getValue();
int w = ((IntField*)e->fieldByID("W"))->getValue();
int h = ((IntField*)e->fieldByID("H"))->getValue();
int w0 =((IntField*)e0->fieldByID("W"))->getValue();
int h0 =((IntField*)e0->fieldByID("H"))->getValue();
if((x-w0-15<pe->x())&&(y-h0-15<pe->y())&&(w+x+15>pe->x())&&(h+y+15>pe->y())){
add = false;
}
}
if(add){
this->core->Changed(true);
core->addEntitieTo(e0);
core->setFocus(core->getIndexEntitieByID(e0->getID()));
this->repaint();
}else{
delete(e0);
}
}
if(this->core->getState()==1){ // Добавление связи
//if(core->getFocusObj())
int focus = -1;
for(int i=0; i<this->core->getEntitieCount(); i++){
Entitie* e = this->core->getEntitieAt(i);
int x =((IntField*)e->fieldByID("X"))->getValue();
int y = ((IntField*)e->fieldByID("Y"))->getValue();
int w = ((IntField*)e->fieldByID("W"))->getValue();
int h = ((IntField*)e->fieldByID("H"))->getValue();
if((x<pe->x())&&(y<pe->y())&&(w+x>pe->x())&&(h+y>pe->y())){
focus = i;
}
}
if(core->getFocus()==-1 || !core->getFocusObj()){
//core->e= this->core->getEntitieCount(focus);
core->setFocus(focus);
core->setFocusObj(true);
}else{
if(focus!=this->core->getFocus() && focus!=-1){
string name;
int num = this->core->getCounter0();
char str[255];
sprintf(str, "Relation %d", num);
name = (const char*)str;
Entitie* e1 = this->core->getEntitieAt(this->core->getFocus());
Entitie* e2 = this->core->getEntitieAt(focus);
core->addRelation(e1,e2,name,"W");
this->core->Changed(true);
}
this->core->setFocus(core->getRelationCount()-1);
//core->setFocus(-1);
core->setFocusObj(false);
}
core->spotFocus();
this->repaint();
}
if(this->core->getState()==2 || this->core->getState()==10){ // Выделение объектов
this->selected = true;
core->setFocus(-1);
for(int i=0; i<this->core->getEntitieCount(); i++){
Entitie* e = this->core->getEntitieAt(i);
int x =((IntField*)e->fieldByID("X"))->getValue();
int y = ((IntField*)e->fieldByID("Y"))->getValue();
int w = ((IntField*)e->fieldByID("W"))->getValue();
int h = ((IntField*)e->fieldByID("H"))->getValue();
if((x<pe->x())&&(y<pe->y())&&(w+x>pe->x())&&(h+y>pe->y())){
if(this->currentMoved==-1){this->currentMoved=i;}
core->setFocus(i);
core->setFocusObj(true);
}
}
for(int i=0; i<this->core->getRelationCount(); i++){
Relation* r = this->core->getRelationAt(i);
Entitie* eR = r->getEntR();
Entitie* eL = r->getEntL();
int indexR = 0;
int indexL = 0;
for(int j=0; j<eR->fieldCount() && indexR==0; j++){
if(eR->fieldAt(j)->getID()==r->getKey()){
indexR = j;
}
//.........这里部分代码省略.........