QTfrontend/hedgehogerWidget.cpp
changeset 352 4665bfe25470
parent 207 287077789132
child 362 b28e0dd48269
equal deleted inserted replaced
351:29bc9c36ad5f 352:4665bfe25470
    45   if(event->button()==Qt::LeftButton) {
    45   if(event->button()==Qt::LeftButton) {
    46     event->accept();
    46     event->accept();
    47     if(numHedgehogs < 8 && pOurFrameTeams->overallHedgehogs<18) {
    47     if(numHedgehogs < 8 && pOurFrameTeams->overallHedgehogs<18) {
    48       numHedgehogs++;
    48       numHedgehogs++;
    49       pOurFrameTeams->overallHedgehogs++;
    49       pOurFrameTeams->overallHedgehogs++;
       
    50       emit hedgehogsNumChanged();
    50     }
    51     }
    51   } else if (event->button()==Qt::RightButton) {
    52   } else if (event->button()==Qt::RightButton) {
    52     event->accept();
    53     event->accept();
    53     if(numHedgehogs > 3) {
    54     if(numHedgehogs > 3) {
    54       numHedgehogs--;
    55       numHedgehogs--;
    55       pOurFrameTeams->overallHedgehogs--;
    56       pOurFrameTeams->overallHedgehogs--;
       
    57       emit hedgehogsNumChanged();
    56     }
    58     }
    57   } else {
    59   } else {
    58     event->ignore();
    60     event->ignore();
    59     return;
    61     return;
    60   }
    62   }
       
    63   repaint();
       
    64 }
       
    65 
       
    66 void CHedgehogerWidget::setHHNum(unsigned int num)
       
    67 {
       
    68   unsigned int diff=numHedgehogs-num;
       
    69   numHedgehogs=num;
       
    70   pOurFrameTeams->overallHedgehogs+=diff;
    61   repaint();
    71   repaint();
    62 }
    72 }
    63 
    73 
    64 void CHedgehogerWidget::paintEvent(QPaintEvent* event)
    74 void CHedgehogerWidget::paintEvent(QPaintEvent* event)
    65 {
    75 {