void ControllerAnnotations::connectControllerToController() {
	{
		IController* ctr = m_BioTrackerContext->requestController(ENUMS::CONTROLLERTYPE::GRAPHICSVIEW);
		auto viewController = qobject_cast<ControllerGraphicScene*>(ctr);
		auto view = dynamic_cast<GraphicsView*> (viewController->getView());
		view->addGraphicsItem(static_cast<AnnotationsView*>(getView()));

		QObject::connect(view, &GraphicsView::onMousePressEvent, this, &ControllerAnnotations::mousePressEvent, Qt::DirectConnection);
		QObject::connect(view, &GraphicsView::onMouseReleaseEvent, this, &ControllerAnnotations::mouseReleaseEvent, Qt::DirectConnection);
		QObject::connect(view, &GraphicsView::onMouseMoveEvent, this, &ControllerAnnotations::mouseMoveEvent, Qt::DirectConnection);
		//QObject::connect(view, &GraphicsView::onKeyReleaseEvent, this, &ControllerAnnotations::keyReleaseEvent, Qt::DirectConnection);
		QObject::connect(view, &GraphicsView::onKeyPressEvent, this, &ControllerAnnotations::keyPressEvent, Qt::DirectConnection);


		QWidget *viewport = view->viewport();
		QObject::connect(this, SIGNAL(onRepaintRequired()), viewport, SLOT(repaint()));
	}

	{
		IController* ctr = m_BioTrackerContext->requestController(ENUMS::CONTROLLERTYPE::PLAYER);
		auto mediaPlayerController = dynamic_cast<ControllerPlayer*> (ctr);
		assert(mediaPlayerController);
		MediaPlayer *player = dynamic_cast<MediaPlayer*> (mediaPlayerController->getModel());
		assert(player);
		QObject::connect(player, &MediaPlayer::fwdPlayerParameters, this, &ControllerAnnotations::setPlayerParameters);
	}
}
Exemplo n.º 2
0
void PokemonBox::addPokemon(const PokeTeam &poke, int slot) throw(QString)
{
    if (isFull())
        throw tr("The box is full!");

    int spot = slot==-1 ? (pokemons[currentPoke] == NULL ? currentPoke : freeSpot()) : slot;
    pokemons[spot] = new TB_PokemonItem(new PokeTeam(poke), this);

    addGraphicsItem(spot);
    changeCurrentSpot(spot);
}
Exemplo n.º 3
0
void PokemonBox::dropEvent(QDropEvent * event)
{
    int spot;

    if ( (spot = calculateSpot(event->pos())) == -1 ) {
        return;
    }

    const QMimeData *data = event->mimeData();

    if(!data->property("Box").isNull() && !data->property("Item").isNull()) {
        event->accept();

        PokemonBox *box = data->property("Box").value<PokemonBox*>();
        int item = data->property("Item").toInt();

        if (box == this && item == spot)
            return;

        changeCurrentSpot(spot);

        std::swap(pokemons[spot], box->pokemons[item]);

        addGraphicsItem(spot);

        if (box->pokemons[item])
            box->addGraphicsItem(item);

        save();
        if (box != this)
            box->save();

    } else if (!data->property("TeamSlot").isNull()) {
        event->accept();

        int slot = data->property("TeamSlot").toInt();
        emit switchWithTeam(getNum(), currentPoke, slot);
    }
}
Exemplo n.º 4
0
void KWidget::addChild(KWidget* child)
{
    addGraphicsItem(child);
    addObjectItem(child);
}
Exemplo n.º 5
0
void KWidget::insertItem( KWidget *item, int i )
{
    addObjectItem(item);
    addGraphicsItem(item);
    insertLayoutItem(item, i);
}
Exemplo n.º 6
0
void KWidget::addItem( KWidget* item )
{
    addObjectItem(item);
    addGraphicsItem(item);
    addLayoutItem(item);
}