Ejemplo n.º 1
0
void RS_ActionDrawLineTangent2::mouseReleaseEvent(QMouseEvent* e) {

    if (e->button()==Qt::RightButton) {
        deletePreview();
		init(getStatus()-1);
		if(getStatus()>=0){
			clearHighlighted();
        }
        return;
    }
    switch (getStatus()) {
    case SetCircle1:
    {
        circle1 = catchEntity(e, circleType, RS2::ResolveAll);
		if(!circle1) return;
        circle1->setHighlighted(true);
		graphicView->drawEntity(circle1);
        setStatus(getStatus()+1);
    }
        break;

    case SetCircle2:
        if(valid) trigger();
        break;
    }
}
Ejemplo n.º 2
0
void BoardTable::sortEvent(int c)
{
    //qDebug()<<c;
    //return;d
    if (Global::alreadyJudging) return;
    
    if (preHeaderClicked!=c)
    {
        clearHighlighted(preHeaderClicked);
        setHighlighted(c);
    }
    
    this->horizontalHeader()->setSortIndicatorShown(true);
    if (preHeaderClicked!=c&&c) this->horizontalHeader()->setSortIndicator(c,Qt::DescendingOrder);
    Global::preSortOrder=this->horizontalHeader()->sortIndicatorOrder();
    
    if (!c) sortByName();
    else if (c==1) sortBySumScore();
    else sortByProblem(c-2);
    
    int k=0;
    for (auto&i:Global::players)
    {
        this->item(i.id,c)->setData(Qt::DisplayRole,k);
        i.id=Global::logicalRow(k);//
        k++;
    }
    this->sortByColumn(c);
    this->verticalScrollBar()->setValue(0);
  //  for (int i=0; i<playerNum; i++) qDebug()<<ui->tableWidget->item(i,c)->data(Qt::DisplayRole);
    
    preHeaderClicked=c;
}
Ejemplo n.º 3
0
void RS_ActionDrawLineTangent2::trigger() {
    RS_PreviewActionInterface::trigger();

	RS_Entity* newEntity = new RS_Line(container, *lineData);

    if (newEntity) {
        newEntity->setLayerToActive();
        newEntity->setPenToActive();
        container->addEntity(newEntity);

        // upd. undo list:
        if (document) {
            document->startUndoCycle();
            document->addUndoable(newEntity);
            document->endUndoCycle();
		}
		clearHighlighted();

        setStatus(SetCircle1);
    }
    tangent.reset();
}