Пример #1
0
// shows the item
// if coordY >0, this is taken as the middle y-coordinate
void KDGanttViewSummaryItem::showItem( bool show, int coordY )
{
  isVisibleInGanttView = show;
  invalidateHeight () ;
  if (!show) {
    hideMe();
    return;
  }
 if ( displaySubitemsAsGroup() && !parent() && !isOpen() ) {
    hideMe();
    return;
  }
  float prio = ((float) ( priority() - 100 )) / 100.0;
  startShape->setZ( prio + 0.0055 );
  midShape->setZ( prio + 0.004 );
  endShape->setZ( prio + 0.005 );
  startShapeBack->setZ( prio + 0.003 );
  midShapeBack->setZ( prio + 0.003 );
  endShapeBack->setZ( prio + 0.003 );
  startLine->setZ( prio + 0.0015  );
  endLine->setZ( prio + 0.001 );
  textCanvas->setZ( prio + 0.006 );
  startLineBack->setZ( prio );
  endLineBack->setZ( prio );
  actualEnd->setZ( prio  + 0.007 );
  if ( displaySubitemsAsGroup() && firstChild() ) {
    myStartTime = myChildStartTime();
    myEndTime = myChildEndTime();
  }
  int startX, endX, midX = 0,allY;
  if ( coordY )
    allY = coordY;
  else
    allY = getCoordY();
  startX = myGanttView->myTimeHeader->getCoordX(myStartTime);
  endX = myGanttView->myTimeHeader->getCoordX(myEndTime);
  if (myMiddleTime)
    midX = myGanttView->myTimeHeader->getCoordX(*myMiddleTime);
  else
    midX = endX;

  startLine->setPoints(startX,allY,midX,allY);
  startLine->show();
  startLineBack->setPoints(startX-1,allY,midX+1,allY);
  startLineBack->show();
  startShape->move(startX,allY);
  startShapeBack->move(startX,allY);

  endShape->move(endX,allY);
  endShapeBack->move(endX,allY);
  moveTextCanvas(endX,allY);
  startShape->show();
  startShapeBack->show();
  endShape->show();
  endShapeBack->show();
  textCanvas->show();
  if (myMiddleTime) {
    endLine->setPoints(midX,allY,endX,allY);
    endLine->show();
    endLineBack->setPoints(midX,allY,endX+1,allY);
    endLineBack->show();
    midShape->move(midX,allY);
    midShape->show();
    midShapeBack->move(midX,allY);
    midShapeBack->show();
  }
  else {
    endLine->hide();
    endLineBack->hide();
    midShape->hide();
    midShapeBack->hide();
  }
  if (myActualEndTime) {
    if ( *myActualEndTime == myEndTime ) {
      actualEnd->hide();
    }
    else {
      int actendX = myGanttView->myTimeHeader->getCoordX(*myActualEndTime);
      actualEnd->setPoints(actendX,allY-5,actendX,allY+5);
      actualEnd->show();
    }
  }
  else {
    actualEnd->hide();
  }
  if(myStartTime == myEndTime)
    {
      endShape->moveBy(myItemSize+4,0);
      endShapeBack->moveBy(myItemSize+4,0);
      textCanvas->moveBy(myItemSize+4,0);
      midShape->hide();
      midShapeBack->hide();
      startLine->hide();
      endLine->hide();
      startLineBack->hide();
      endLineBack->hide();
    }
  if (textCanvas->text().isEmpty())
    textCanvas->hide();
}
Пример #2
0
void KDGanttViewEventItem::showItem(bool show, int coordY)
{
  isVisibleInGanttView = show;
  invalidateHeight () ;
  if (!show) {
    hideMe();
    return;
  }
  float prio = ((float) ( priority() - 100 )) / 100.0;
  startShape->setZ( prio + 0.0055 );
  startShapeBack->setZ( prio + 0.003 );
  startLine->setZ( prio + 0.0015  );
  floatStartShape->setZ(prio + 0.004);
  floatStartShape->hide();
  floatEndShape->setZ(prio + 0.004);
  floatEndShape->hide();
  textCanvas->setZ( prio + 0.006 );
  startLineBack->setZ( prio );

  if ( displaySubitemsAsGroup() && firstChild() ) {
    myStartTime = myChildStartTime();
    myEndTime = myChildEndTime();
  }
  int startX, endX, allY;
  if ( coordY )
    allY = coordY;
  else
    allY = getCoordY();
  startX = myGanttView->myTimeHeader->getCoordX(myStartTime);
  if (myLeadTime) {
    endX = myGanttView->myTimeHeader->getCoordX(*myLeadTime);
    startLine->setPoints(startX,allY,endX,allY);
    startLine->show();
    startLineBack->setPoints(startX+1,allY,endX-1,allY);
    startLineBack->show();
  }
  else {
    startLine->hide();
    startLineBack->hide();
  }
  startShape->move(startX,allY);
  startShape->show();
  startShapeBack->move(startX,allY);
  startShapeBack->show();
  if (myFloatStartTime.isValid()) {
    KDCanvasRectangle* floatStartTemp = (KDCanvasRectangle*) floatStartShape;
    int floatStartX = myGanttView->myTimeHeader->getCoordX(myFloatStartTime);
    int hei = startShape->boundingRect().height();
    // FIXME: Configurable colors
    QBrush b(startShape->brush().color(), Dense4Pattern);
    floatStartTemp->setBrush(b);
    floatStartTemp->setPen(QPen(gray));
    if (floatStartX < startX) {
        floatStartTemp->setSize(startX - floatStartX, hei/2);
        floatStartTemp->move(floatStartX, allY-hei/4);
    } else {
        floatStartTemp->setSize(floatStartX - startX, hei/2);
        floatStartTemp->move(startX, allY-hei/4);
    }
    floatStartShape->show();    
  }
  if (myFloatEndTime.isValid()) {
    KDCanvasRectangle* floatEndTemp = (KDCanvasRectangle*) floatEndShape;
    int floatEndX = myGanttView->myTimeHeader->getCoordX(myFloatEndTime);
    int hei = startShape->boundingRect().height();
    // FIXME: Configurable colors
    QBrush b(startShape->brush().color(), Dense4Pattern);
    floatEndTemp->setBrush(b);
    floatEndTemp->setPen(QPen(gray));
    if (floatEndX > startX) {
        floatEndTemp->setSize(floatEndX - startX, hei/2);
        floatEndTemp->move(startX, allY-hei/4);
    } else {
        floatEndTemp->setSize(startX - floatEndX, hei/2);
        floatEndTemp->move(floatEndX, allY-hei/4);
    }
    floatEndShape->show();    
   }

  moveTextCanvas(startX,allY);
  textCanvas->show();
  if (textCanvas->text().isEmpty())
    textCanvas->hide();
}