Пример #1
0
bool MainWindow::eventFilter(QObject *obj, QEvent *event){
	if( event->type() == QEvent::KeyPress ){
		QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
		if( keyEvent->key() == Qt::Key_Space ){
			QKeyEvent firstEvent(QEvent::KeyPress, Qt::Key_Down,
								 Qt::NoModifier);
			QApplication::sendEvent( ui->treeView, &firstEvent);
			QKeyEvent secondEvent(QEvent::KeyPress, Qt::Key_Enter,
								  Qt::NoModifier);
			QApplication::sendEvent( ui->treeView, &secondEvent);
			qApp->processEvents();
			return true;
		}else if( keyEvent->key() == Qt::Key_Backspace ){
			QKeyEvent firstEvent(QEvent::KeyPress, Qt::Key_Up,
								 Qt::NoModifier);
			QApplication::sendEvent( ui->treeView, &firstEvent);
			QKeyEvent secondEvent(QEvent::KeyPress, Qt::Key_Enter,
								  Qt::NoModifier);
			QApplication::sendEvent( ui->treeView, &secondEvent);
			qApp->processEvents();
			return true;
		}
	}

	return QObject::eventFilter(obj, event);
}
Пример #2
0
bool JPetReader::loadData(const char* treename)
{
  if (!isOpen() ) {
    ERROR("File not open");
    return false;
  }
  if (!treename) {
    ERROR("empty tree name");
    return false;
  }
  fTree = static_cast<TTree*>(fFile->Get(treename));
  if (!fTree) {
    ERROR("in reading tree");
    return false;
  }
  TObjArray* arr = fTree->GetListOfBranches();
  fBranch = (TBranch*)(arr->At(0));
  if (!fBranch) {
    ERROR("in reading branch from tree");
    return false;
  }
  fBranch->SetAddress(&fEvent);
  firstEvent();
  return true;
}
Пример #3
0
/*!
    Returns a deep-copied clone of the QUmlDurationConstraint.
*/
QModelingElement *QUmlDurationConstraint::clone() const
{
    QUmlDurationConstraint *c = new QUmlDurationConstraint;
    c->asQModelingObject()->setObjectName(this->asQModelingObject()->objectName());
    c->asQModelingObject()->setProperty("role", this->asQModelingObject()->property("role"));
    foreach (QUmlComment *element, ownedComments())
        c->addOwnedComment(dynamic_cast<QUmlComment *>(element->clone()));
    c->setName(name());
    if (nameExpression())
        c->setNameExpression(dynamic_cast<QUmlStringExpression *>(nameExpression()->clone()));
    c->setVisibility(visibility());
    c->setFirstEvent(firstEvent());
    if (specification())
        c->setSpecification(dynamic_cast<QUmlDurationInterval *>(specification()->clone()));
    return c;
}
Пример #4
0
void CvPlayerAI::AI_doTurnPost()
{
	AI_PERF_FORMAT("AI-perf.csv", ("CvPlayerAI::AI_doTurnPost, Turn %03d, %s", GC.getGame().getElapsedGameTurns(), getCivilizationShortDescription()) );
	if(isHuman())
	{
		return;
	}

	// EventEngine - v0.1, Snarko
	// DO NOT pass pEvent to AI_chooseEventOption. The event is deleted when an option has been chosen.
	int iLoop = 0;
	for(CvEvent* pEvent = firstEvent(&iLoop, false); pEvent != NULL; pEvent = nextEvent(&iLoop, false))
	{
		AI_chooseEventOption(pEvent->GetID());
	}
	// END EventEngine

	if(isBarbarian())
	{
		return;
	}

	if(isMinorCiv())
	{
		return;
	}

	for(int i = 0; i < GC.getNumVictoryInfos(); ++i)
	{
		AI_launch((VictoryTypes)i);
	}

	ProcessGreatPeople();
	GetEspionageAI()->DoTurn();
	GetTradeAI()->DoTurn();
}
Пример #5
0
bool JPetHLDReader::loadData(const char* treename)
{
  if (!isOpen() ) {
    ERROR("File not open");
    return false;
  }
  if (!treename) {
    ERROR("empty tree name");
    return false;
  }
  fTree = static_cast<TTree*>(fFile->Get(treename));
  if (!fTree) {
    ERROR("in reading tree");
    return false;
  }
  fBranch = fTree->GetBranch("eventIII");
  if (!fBranch) {
    ERROR("in reading branch from tree");
    return false;
  }
  fBranch->SetAddress(&fEvent);
  firstEvent();
  return true;
}