Exemplo n.º 1
0
void HostItem::updateHalos()
{
    int count = 1;

    QMap<Job,QGraphicsEllipseItem*>::Iterator it;
    for(it = m_jobHalos.begin(); it != m_jobHalos.end(); ++it) {
        QGraphicsEllipseItem *halo = it.value();
        halo->setRect(halo->x() - 5 - count * 3,
                      halo->y() - 5 - count * 3,
                      m_baseWidth + count * 6,
                      m_baseHeight + count * 6);
        halo->setBrush(m_hostInfoManager->hostColor(it.key().client()));
        halo->setPen(Qt::NoPen);
        ++count;
    }
}
Exemplo n.º 2
0
void LVL_ModeCircle::mouseRelease(QGraphicsSceneMouseEvent *mouseEvent)
{
    Q_UNUSED(mouseEvent);

    if(!scene) return;
    LvlScene *s = dynamic_cast<LvlScene *>(scene);

    if(s->m_cursorItemImg)
    {
        QGraphicsEllipseItem * cur = dynamic_cast<QGraphicsEllipseItem *>(s->m_cursorItemImg);

        // /////////// Don't draw with zero width or height //////////////
        if( (cur->rect().width()==0) || (cur->rect().height()==0))
        {
            s->m_cursorItemImg->hide();
            dontCallEvent = true;
            return;
        }
        // ///////////////////////////////////////////////////////////////

        if( ((s->m_placingItemType==LvlScene::PLC_Block)&&(!LvlPlacingItems::sizableBlock))||
                (s->m_placingItemType==LvlScene::PLC_BGO))
        {
            item_rectangles::drawRound(s, QRect(cur->x(), cur->y(), cur->rect().width(), cur->rect().height()),
                                                QSize(LvlPlacingItems::itemW, LvlPlacingItems::itemH) );
        }

        switch(s->m_placingItemType)
        {
        case LvlScene::PLC_Block:
            {
                //LvlPlacingItems::waterSet.quicksand = (LvlPlacingItems::waterType==1);
                if(LvlPlacingItems::sizableBlock)
                {
                    LvlPlacingItems::blockSet.x = s->m_cursorItemImg->scenePos().x();
                    LvlPlacingItems::blockSet.y = s->m_cursorItemImg->scenePos().y();
                    LvlPlacingItems::blockSet.w = cur->rect().width();
                    LvlPlacingItems::blockSet.h = cur->rect().height();
                    //here define placing water item.
                    s->m_data->blocks_array_id++;

                    LvlPlacingItems::blockSet.meta.array_id = s->m_data->blocks_array_id;
                    s->m_data->blocks.push_back(LvlPlacingItems::blockSet);

                    s->placeBlock(LvlPlacingItems::blockSet, true);
                    LevelData plSzBlock;
                    plSzBlock.blocks.push_back(LvlPlacingItems::blockSet);
                    s->m_history->addPlace(plSzBlock);
                    s->Debugger_updateItemList();
                    break;
                }
                else
                {
                    s->placeItemsByRectArray();
                    //LogDebug("clear collision buffer");
                    s->m_emptyCollisionCheck = false;
                    s->collisionCheckBuffer.clear();
                    #ifdef _DEBUG_
                    LogDebug("Done");
                    #endif
                    s->Debugger_updateItemList();
                    break;
                }
            }
        case LvlScene::PLC_BGO:
            {
                s->placeItemsByRectArray();

                s->m_emptyCollisionCheck = false;
                s->collisionCheckBuffer.clear();

                s->Debugger_updateItemList();
             break;
            }
        }
        s->m_data->meta.modified = true;

        s->m_cursorItemImg->hide();
    }
}