• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ WldScene类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中WldScene的典型用法代码示例。如果您正苦于以下问题:C++ WldScene类的具体用法?C++ WldScene怎么用?C++ WldScene使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了WldScene类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: mousePress

void WLD_ModeSetPoint::mousePress(QGraphicsSceneMouseEvent *mouseEvent)
{
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    if( (!s->isSelectionDialog) && ((mouseEvent->buttons() & Qt::RightButton)!=0) )
    {
        MainWinConnect::pMainWin->on_actionSelect_triggered();
        dontCallEvent = true;
        s->IsMoved = true;
        return;
    }

    if(s->cursor){
        s->cursor->setPos( QPointF(s->applyGrid( mouseEvent->scenePos().toPoint()-
                                           QPoint(WldPlacingItems::c_offset_x,
                                                  WldPlacingItems::c_offset_y),
                                           WldPlacingItems::gridSz,
                                           WldPlacingItems::gridOffset)));
    }

    s->setPoint(s->cursor->scenePos().toPoint());
    emit s->pointSelected(s->selectedPoint);

    dontCallEvent=true;
}
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:26,代码来源:wld_mode_setpoint.cpp


示例2: mousePress

void WLD_ModeErase::mousePress(QGraphicsSceneMouseEvent *mouseEvent)
{
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    if( mouseEvent->buttons() & Qt::RightButton )
    {
        MainWinConnect::pMainWin->on_actionSelect_triggered();
        dontCallEvent = true;
        s->m_mouseIsMovedAfterKey = true;
        return;
    }

    if(s->m_cursorItemImg){
       s->m_cursorItemImg->show();
       s->m_cursorItemImg->setPos(mouseEvent->scenePos());
    }

    s->m_skipChildMousePressEvent = true;
    s->mousePressEvent(mouseEvent);
    dontCallEvent = true;

    QList<QGraphicsItem*> selectedList = s->selectedItems();
    if (!selectedList.isEmpty())
    {
        s->removeItemUnderCursor();
        s->Debugger_updateItemList();
        s->m_eraserIsEnabled=true;
    }
}
开发者ID:Wohlhabend-Networks,项目名称:PGE-Project,代码行数:30,代码来源:wld_mode_erase.cpp


示例3: mouseMove

void WLD_ModeSetPoint::mouseMove(QGraphicsSceneMouseEvent *mouseEvent)
{
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    if(s->cursor)
    {

               s->cursor->setPos( QPointF(s->applyGrid( mouseEvent->scenePos().toPoint()-
                                                   QPoint(WldPlacingItems::c_offset_x,
                                                          WldPlacingItems::c_offset_y),
                                                 WldPlacingItems::gridSz,
                                                 WldPlacingItems::gridOffset)));
               s->cursor->show();

               s->setMessageBoxItem(true, mouseEvent->scenePos(),
                                      (s->cursor?
                                           (
                                      QString::number( s->cursor->scenePos().toPoint().x() ) + "x" +
                                      QString::number( s->cursor->scenePos().toPoint().y() )
                                           )
                                               :""));

    }
}
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:25,代码来源:wld_mode_setpoint.cpp


示例4: mousePress

void WLD_ModePlace::mousePress(QGraphicsSceneMouseEvent *mouseEvent)
{
    if(!scene) return;
    WldScene *s = qobject_cast<WldScene *>(scene);

    if( mouseEvent->buttons() & Qt::RightButton )
    {
        item_rectangles::clearArray();
        MainWinConnect::pMainWin->on_actionSelect_triggered();
        dontCallEvent = true;
        s->IsMoved = true;
        return;
    }

    s->last_tile_arrayID=s->WldData->tile_array_id;
    s->last_scene_arrayID=s->WldData->scene_array_id;
    s->last_path_arrayID=s->WldData->path_array_id;
    s->last_level_arrayID=s->WldData->level_array_id;
    s->last_musicbox_arrayID=s->WldData->musicbox_array_id;

    if(s->cursor){
        s->cursor->setPos( QPointF(s->applyGrid( mouseEvent->scenePos().toPoint()-
                                           QPoint(WldPlacingItems::c_offset_x,
                                                  WldPlacingItems::c_offset_y),
                                           WldPlacingItems::gridSz,
                                           WldPlacingItems::gridOffset)));
    }

    s->placeItemUnderCursor();
    s->Debugger_updateItemList();

    s->MousePressEventOnly = true;
    s->mousePressEvent(mouseEvent);
    dontCallEvent = true;
}
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:35,代码来源:wld_mode_place.cpp


示例5: mouseMove

void WLD_ModeSquare::mouseMove(QGraphicsSceneMouseEvent *mouseEvent)
{
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    if(s->cursor)
    {
        if(s->cursor->isVisible())
        {
        QPoint hw = s->applyGrid( mouseEvent->scenePos().toPoint(),
                               WldPlacingItems::gridSz,
                               WldPlacingItems::gridOffset);

        QSize hs = QSize( (long)fabs(drawStartPos.x() - hw.x()),  (long)fabs( drawStartPos.y() - hw.y() ) );


        ((QGraphicsRectItem *)s->cursor)->setRect(0,0, hs.width(), hs.height());
        ((QGraphicsRectItem *)s->cursor)->setPos(
                    ((hw.x() < drawStartPos.x() )? hw.x() : drawStartPos.x()),
                    ((hw.y() < drawStartPos.y() )? hw.y() : drawStartPos.y())
                    );

        item_rectangles::drawMatrix(s, QRect (((QGraphicsRectItem *)s->cursor)->x(),
                                                ((QGraphicsRectItem *)s->cursor)->y(),
                                                ((QGraphicsRectItem *)s->cursor)->rect().width(),
                                                ((QGraphicsRectItem *)s->cursor)->rect().height()),
                                    QSize(WldPlacingItems::itemW, WldPlacingItems::itemH)
                                    );

        }
    }
}
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:32,代码来源:wld_mode_square.cpp


示例6: mousePress

void WLD_ModeSquare::mousePress(QGraphicsSceneMouseEvent *mouseEvent)
{
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    if( mouseEvent->buttons() & Qt::RightButton )
    {
        item_rectangles::clearArray();
        MainWinConnect::pMainWin->on_actionSelect_triggered();
        dontCallEvent = true;
        s->IsMoved = true;
        return;
    }

    s->last_tile_arrayID=s->WldData->tile_array_id;
    s->last_scene_arrayID=s->WldData->scene_array_id;
    s->last_path_arrayID=s->WldData->path_array_id;
    s->last_level_arrayID=s->WldData->level_array_id;
    s->last_musicbox_arrayID=s->WldData->musicbox_array_id;

    if(s->cursor){
        drawStartPos = QPointF(s->applyGrid( mouseEvent->scenePos().toPoint(),
                                          WldPlacingItems::gridSz,
                                          WldPlacingItems::gridOffset));
        s->cursor->setPos( drawStartPos );
        s->cursor->setVisible(true);

        QPoint hw = s->applyGrid( mouseEvent->scenePos().toPoint(),
                               WldPlacingItems::gridSz,
                               WldPlacingItems::gridOffset);

        QSize hs = QSize( (long)fabs(drawStartPos.x() - hw.x()),  (long)fabs( drawStartPos.y() - hw.y() ) );
        ((QGraphicsRectItem *)(s->cursor))->setRect(0,0, hs.width(), hs.height());
    }
}
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:35,代码来源:wld_mode_square.cpp


示例7: Q_UNUSED

void WLD_ModeErase::mouseRelease(QGraphicsSceneMouseEvent *mouseEvent)
{
    Q_UNUSED(mouseEvent);
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    if(!s->m_overwritedItems.tiles.isEmpty()||
        !s->m_overwritedItems.scenery.isEmpty()||
        !s->m_overwritedItems.paths.isEmpty()||
        !s->m_overwritedItems.levels.isEmpty()||
        !s->m_overwritedItems.music.isEmpty() )
    {
        s->m_history->addRemoveHistory(s->m_overwritedItems);
        s->m_overwritedItems.tiles.clear();
        s->m_overwritedItems.scenery.clear();
        s->m_overwritedItems.paths.clear();
        s->m_overwritedItems.levels.clear();
        s->m_overwritedItems.music.clear();
    }

    QList<QGraphicsItem*> selectedList = s->selectedItems();

    // check for grid snap
    if ((!selectedList.isEmpty())&&(s->m_mouseIsMoved))
    {
        s->removeWldItems(selectedList);
        selectedList = s->selectedItems();
        s->Debugger_updateItemList();
    }

    s->m_eraserIsEnabled = false;
}
开发者ID:Wohlhabend-Networks,项目名称:PGE-Project,代码行数:32,代码来源:wld_mode_erase.cpp


示例8: Q_UNUSED

void WLD_ModeResize::mousePress(QGraphicsSceneMouseEvent *mouseEvent)
{
    Q_UNUSED(mouseEvent);
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    s->MousePressEventOnly = true;
    s->mousePressEvent(mouseEvent);
    dontCallEvent = true;
}
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:10,代码来源:wld_mode_resize.cpp


示例9: mousePress

void WLD_ModeSelect::mousePress(QGraphicsSceneMouseEvent *mouseEvent)
{
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    if(s->EditingMode == WldScene::MODE_PasteFromClip)
    {
        if( mouseEvent->buttons() & Qt::RightButton )
        {
            MainWinConnect::pMainWin->on_actionSelect_triggered();
            dontCallEvent = true;
            s->IsMoved = true;
            return;
        }
        s->PasteFromBuffer = true;
        dontCallEvent = true;
        s->IsMoved = true;
        return;
    }

    if((s->disableMoveItems) && (mouseEvent->buttons() & Qt::LeftButton)
        && (Qt::ControlModifier != QApplication::keyboardModifiers()))
    { return; }

    if( mouseEvent->buttons() & Qt::MiddleButton )
    {
        if(GlobalSettings::MidMouse_allowSwitchToPlace)
        {
            if(s->selectedItems().size()==1)
            {
                QGraphicsItem * it = s->selectedItems().first();
                QString itp = it->data(0).toString();
                long itd = it->data(1).toInt();
                if(itp=="TILE")
                {MainWinConnect::pMainWin->SwitchPlacingItem(ItemTypes::WLD_Tile, itd); return;}
                else if(itp=="SCENERY")
                {MainWinConnect::pMainWin->SwitchPlacingItem(ItemTypes::WLD_Scenery, itd); return;}
                else if(itp=="PATH")
                {MainWinConnect::pMainWin->SwitchPlacingItem(ItemTypes::WLD_Path, itd); return;}
                else if(itp=="LEVEL")
                {MainWinConnect::pMainWin->SwitchPlacingItem(ItemTypes::WLD_Level, itd); return;}
                else if(itp=="MUSICBOX")
                {MainWinConnect::pMainWin->SwitchPlacingItem(ItemTypes::WLD_MusicBox, itd); return;}
            }
        }
        if(GlobalSettings::MidMouse_allowDuplicate)
        {
            if(!s->selectedItems().isEmpty())
            {
                s->WldBuffer = s->copy();
                s->PasteFromBuffer=true;
            }
        }
    }
}
开发者ID:hacheipe399,项目名称:PlatGEnWohl,代码行数:55,代码来源:wld_mode_select.cpp


示例10: mouseMove

void WLD_ModeErase::mouseMove(QGraphicsSceneMouseEvent *mouseEvent)
{
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    if(s->m_cursorItemImg) s->m_cursorItemImg->setPos(mouseEvent->scenePos());
    if (s->m_eraserIsEnabled)// Remove All items, placed under Cursor
    {
        s->removeItemUnderCursor();
        s->Debugger_updateItemList();
    }
}
开发者ID:Wohlhabend-Networks,项目名称:PGE-Project,代码行数:12,代码来源:wld_mode_erase.cpp


示例11: Q_UNUSED

void WLD_ModeSetPoint::mouseRelease(QGraphicsSceneMouseEvent *mouseEvent)
{
    Q_UNUSED(mouseEvent);
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    if(!s->isSelectionDialog)
    {
        MainWinConnect::pMainWin->on_actionSelect_triggered();
        MainWinConnect::pMainWin->dock_WldItemProps->WLD_returnPointToLevelProperties(s->selectedPoint);
        s->openProps();
        //s->MouseReleaseEventOnly = true;
        //s->mouseReleaseEvent(mouseEvent);
        dontCallEvent=true;
    }

}
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:17,代码来源:wld_mode_setpoint.cpp


示例12: mouseMove

void WLD_ModePlace::mouseMove(QGraphicsSceneMouseEvent *mouseEvent)
{
    if(!scene) return;
    WldScene *s = qobject_cast<WldScene *>(scene);

    s->clearSelection();

    if(mouseEvent->modifiers() & Qt::ControlModifier )
        s->setMessageBoxItem(true, mouseEvent->scenePos(),
                               (s->cursor?
                                    (
                               QString::number( s->cursor->scenePos().toPoint().x() ) + "x" +
                               QString::number( s->cursor->scenePos().toPoint().y() )
                                    )
                                        :""));
    else
        s->setMessageBoxItem(false);

    if(s->cursor)
    {
               s->cursor->setPos( QPointF(s->applyGrid( mouseEvent->scenePos().toPoint()-
                                                   QPoint(WldPlacingItems::c_offset_x,
                                                          WldPlacingItems::c_offset_y),
                                                 WldPlacingItems::gridSz,
                                                 WldPlacingItems::gridOffset)));
               s->cursor->show();
    }
    if( mouseEvent->buttons() & Qt::LeftButton )
    {
        s->placeItemUnderCursor();
        s->Debugger_updateItemList();
    }
}
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:33,代码来源:wld_mode_place.cpp


示例13: set

void WLD_ModeSelect::set()
{
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    s->resetCursor();
    s->resetResizers();
    s->m_pointSelector.unserPointSelector();

    s->m_eraserIsEnabled = false;
    s->m_pastingMode = false;
    s->m_busyMode = false;
    s->m_disableMoveItems = false;

    s->m_viewPort->setInteractive(true);
    s->m_viewPort->setCursor(Themes::Cursor(Themes::cursor_normal));
    s->m_viewPort->setDragMode(QGraphicsView::RubberBandDrag);
}
开发者ID:Wohlhabend-Networks,项目名称:PGE-Project,代码行数:18,代码来源:wld_mode_select.cpp


示例14: keyRelease

void WLD_ModeSelect::keyRelease(QKeyEvent *keyEvent)
{
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    switch(keyEvent->key())
    {
        case (Qt::Key_Delete): //Delete action
            s->removeSelectedWldItems();
            break;
        case (Qt::Key_Escape):
            if(!s->mouseMoved)
                s->clearSelection();
            break;
        default:
            break;
    }
}
开发者ID:hacheipe399,项目名称:PlatGEnWohl,代码行数:18,代码来源:wld_mode_select.cpp


示例15: set

void WLD_ModeSelect::set()
{
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    s->EraserEnabled=false;
    s->PasteFromBuffer=false;
    s->DrawMode=false;
    s->disableMoveItems=false;

    s->resetCursor();
    s->resetResizers();
    s->unserPointSelector();

    s->_viewPort->setInteractive(true);
    s->_viewPort->setCursor(Themes::Cursor(Themes::cursor_normal));
    s->_viewPort->setDragMode(QGraphicsView::RubberBandDrag);
}
开发者ID:hacheipe399,项目名称:PlatGEnWohl,代码行数:18,代码来源:wld_mode_select.cpp


示例16: set

void WLD_ModeSetPoint::set()
{
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    s->resetResizers();

    s->EraserEnabled=false;
    s->PasteFromBuffer=false;
    s->DrawMode=true;
    s->disableMoveItems=false;

    s->_viewPort->setInteractive(true);
    s->_viewPort->setCursor(Themes::Cursor(Themes::cursor_placing));
    s->_viewPort->setDragMode(QGraphicsView::NoDrag);
    s->_viewPort->setRenderHint(QPainter::Antialiasing, true);
    s->_viewPort->viewport()->setMouseTracking(true);
}
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:18,代码来源:wld_mode_setpoint.cpp


示例17: set

void WLD_ModeResize::set()
{
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    s->clearSelection();
    s->resetCursor();
    s->unserPointSelector();

    s->EraserEnabled=false;
    s->PasteFromBuffer=false;
    s->DrawMode=true;
    s->disableMoveItems=true;

    s->_viewPort->setInteractive(true);
    s->_viewPort->setCursor(Themes::Cursor(Themes::cursor_resizing));
    s->_viewPort->setDragMode(QGraphicsView::NoDrag);
}
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:18,代码来源:wld_mode_resize.cpp


示例18: keyRelease

void WLD_ModeResize::keyRelease(QKeyEvent *keyEvent)
{
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    switch(keyEvent->key())
    {
        case (Qt::Key_Escape):
            s->resetResizers();
            break;
        case (Qt::Key_Enter):
        case (Qt::Key_Return):
            s->applyResizers();
                //setSectionResizer(false, true);
            break;
        default:
            break;
    }
}
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:19,代码来源:wld_mode_resize.cpp


示例19: set

void WLD_ModeHand::set()
{
    if(!scene) return;
    WldScene *s = dynamic_cast<WldScene *>(scene);

    s->clearSelection();
    s->resetCursor();
    s->resetResizers();
    s->m_pointSelector.unserPointSelector();

    s->m_eraserIsEnabled=false;
    s->m_pastingMode=false;
    s->m_busyMode=false;
    s->m_disableMoveItems=false;

    s->m_viewPort->setCursor(Qt::ArrowCursor);
    s->m_viewPort->setInteractive(false);
    s->m_viewPort->setDragMode(QGraphicsView::ScrollHandDrag);
}
开发者ID:Wohlhabend-Networks,项目名称:PGE-Project,代码行数:19,代码来源:wld_mode_hand.cpp


示例20: Q_UNUSED

void WLD_ModeSquare::mouseRelease(QGraphicsSceneMouseEvent *mouseEvent)
{
    Q_UNUSED(mouseEvent);

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

    if(s->cursor)
    {

        // /////////// Don't draw with zero width or height //////////////
        if( (((QGraphicsRectItem *)s->cursor)->rect().width()==0) ||
          (((QGraphicsRectItem *)s->cursor)->rect().height()==0))
        {
            s->cursor->hide();
            return;
        }
        //QPointF p = ((QGraphicsRectItem *)s->cursor)->scenePos();
        //QSizeF sz = ((QGraphicsRectItem *)s->cursor)->rect().size();

//        s->collisionCheckBuffer = s->items(QRectF(
//                    p.x()-10, p.y()-10,
//                    sz.width()+20, sz.height()+20),
//                    Qt::IntersectsItemBoundingRect);

//        if(s->collisionCheckBuffer.isEmpty())
//            s->emptyCollisionCheck = true;
//        else
//            s->prepareCollisionBuffer();
        s->placeItemsByRectArray();
        s->Debugger_updateItemList();

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

        s->WldData->modified = true;
        s->cursor->hide();
    }
}
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:39,代码来源:wld_mode_square.cpp



注:本文中的WldScene类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WndButton类代码示例发布时间:2022-05-31
下一篇:
C++ WirelessPacket类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap