Qt::绘制框架-选择模式-selectedMode

二维矢量动画智能制作软件开发合集 

链接:软件开发技术分享及记录合集

个人开发二维矢量动画智能制作软件界面如下:

目录

一、选择模式原理

二、选择模式代码实现

三、选择模式软件测试视频

结束语​​​​​​​


一、选择模式原理

本软件选择模式中设计了3种情况:1)选择当前图层所有节点;2)清空当前选择节点;3)反向选择当前图层未被选择节点,界面设计如下:

实现方法为根据需求对选择节点集合进行修改,当选择当前图层所有节点时则直接将选择节点集合设置为当前图层节点父对象的childItems();清空当前选择节点时则对集合进行clear();反向选择当前未被选择节点,则根据当前图层节点父对象的childItems()进行是否被选择判断,若isSelected()为false,则将该对象放入选择节点集合。

二、选择模式代码实现

.h文件变量申明:

QList<QGraphicsItem *> selectedPosItems

void Scene::selectNodes(int type)
{
    switch(type)
    {
    case 0: // 选择全部
    {
        selectedClear();
        selectedPosItems = nodeBox[currentLayerIdx]->childItems();
    }
        break;
    case 1: // 选择反向
    {
        QList<QGraphicsItem *> tmp;
        QList<QGraphicsItem *> tmp1 = nodeBox[currentLayerIdx]->childItems();
        for(int i = 0; i<tmp1.count(); i++)
            if(!tmp1[i]->isSelected())
                tmp.append(tmp1[i]);
        selectedClear();
        selectedPosItems = tmp;
    }
        break;
    default:
        break;
    }
    if(!selectedPosItems.isEmpty())
        for(int i = 0; i<selectedPosItems.count(); i++)
        {
            selectedPosItems[i]->setSelected(true);
            for(int j = 0;j<selectedPosItems[i]->curveG.count();j++)
                selectedPosItems[i]->curveG[j]->setSelected(true);
        }
    update();
}

三、选择模式软件测试视频

选择模式


结束语

本文简要梳理了软件【选择模式】的实现框架,内容均为原创。

作者文笔水平一般,请大家多多包涵和指正,十分欢迎进一步交流学习。

若需,请联系本人小红书(小红书号:YzLab96),谢谢​​​​​​​。

链接:  软件开发及测试所有视频合集见小红书​​​​​​​

最近在开发im服务器 需要大并发链接 QT默认的是使用select模型的 这种轮询方式非常慢 在高并发连接 我们需要epoll才能发挥linux服务器的性能 而且使用简单 整个服务端代码架构无需修改 直接可以使用 只要在 main文件添加: int main int argc char argv[] { #ifdef Q OS LINUX QCoreApplication::setEventDispatcher new EventDispatcherLibEvent ; qInstallMessageHandler customMessageHandler ; #endif QCoreApplication a argc argv ; auto ser new ConfigServer; ser >startServer ; return a exec ; } 在 pro文件添加 linux{ LIBS + levent core SOURCES + common eventdispatcher libevent eventdispatcher libevent cpp common eventdispatcher libevent eventdispatcher libevent config cpp common eventdispatcher libevent eventdispatcher libevent p cpp common eventdispatcher libevent socknot p cpp common eventdispatcher libevent tco eventfd cpp common eventdispatcher libevent tco pipe cpp common eventdispatcher libevent tco cpp common eventdispatcher libevent timers p cpp HEADERS + common eventdispatcher libevent common h common eventdispatcher libevent eventdispatcher libevent h common eventdispatcher libevent eventdispatcher libevent config h common eventdispatcher libevent eventdispatcher libevent config p h common eventdispatcher libevent eventdispatcher libevent p h common eventdispatcher libevent libevent2 emul h common eventdispatcher libevent qt4compat h common eventdispatcher libevent tco h common eventdispatcher libevent wsainit h } 可以直接跨平台了使用了 csdn博客:http: blog csdn net rushroom">最近在开发im服务器 需要大并发链接 QT默认的是使用select模型的 这种轮询方式非常慢 在高并发连接 我们需要epoll才能发挥linux服务器的性能 而且使用简单 整个服务端代码架构无需修改 直接可以使用 只要在 main文件添加: [更多]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值