QTfrontend/hedgehogerWidget.cpp
changeset 362 b28e0dd48269
parent 352 4665bfe25470
child 486 7ea71cd3acd5
equal deleted inserted replaced
361:c3eebac100c0 362:b28e0dd48269
    22 #include <QPainter>
    22 #include <QPainter>
    23 
    23 
    24 #include "frameTeam.h"
    24 #include "frameTeam.h"
    25 
    25 
    26 CHedgehogerWidget::CHedgehogerWidget(QWidget * parent) :
    26 CHedgehogerWidget::CHedgehogerWidget(QWidget * parent) :
    27   QWidget(parent)
    27   QWidget(parent), nonInteractive(false)
    28 {
    28 {
    29   if(parent) {
    29   if(parent) {
    30     pOurFrameTeams=dynamic_cast<FrameTeams*>(parent->parentWidget());
    30     pOurFrameTeams=dynamic_cast<FrameTeams*>(parent->parentWidget());
    31   }
    31   }
    32   if(pOurFrameTeams->overallHedgehogs+4>pOurFrameTeams->maxHedgehogsPerGame) {
    32   if(pOurFrameTeams->overallHedgehogs+4>pOurFrameTeams->maxHedgehogsPerGame) {
    38 CHedgehogerWidget::~CHedgehogerWidget()
    38 CHedgehogerWidget::~CHedgehogerWidget()
    39 {
    39 {
    40   pOurFrameTeams->overallHedgehogs-=numHedgehogs;
    40   pOurFrameTeams->overallHedgehogs-=numHedgehogs;
    41 }
    41 }
    42 
    42 
       
    43 void CHedgehogerWidget::setNonInteractive()
       
    44 {
       
    45   nonInteractive=true;
       
    46 }
       
    47 
    43 void CHedgehogerWidget::mousePressEvent ( QMouseEvent * event )
    48 void CHedgehogerWidget::mousePressEvent ( QMouseEvent * event )
    44 {
    49 {
       
    50   if(nonInteractive) return;
    45   if(event->button()==Qt::LeftButton) {
    51   if(event->button()==Qt::LeftButton) {
    46     event->accept();
    52     event->accept();
    47     if(numHedgehogs < 8 && pOurFrameTeams->overallHedgehogs<18) {
    53     if(numHedgehogs < 8 && pOurFrameTeams->overallHedgehogs<18) {
    48       numHedgehogs++;
    54       numHedgehogs++;
    49       pOurFrameTeams->overallHedgehogs++;
    55       pOurFrameTeams->overallHedgehogs++;