当前位置: 首页>>代码示例>>C++>>正文


C++ MessageDef::drag方法代码示例

本文整理汇总了C++中MessageDef::drag方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageDef::drag方法的具体用法?C++ MessageDef::drag怎么用?C++ MessageDef::drag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MessageDef的用法示例。


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

示例1: dragEvent

void FloatyWnd::dragEvent(QDropEvent *e, bool isDrop)
{
    Message *msg = NULL;
    CommandDef *cmd;
    CommandsMapIterator it(m_plugin->core->messageTypes);
    while ((cmd = ++it) != NULL){
        MessageDef *def = (MessageDef*)(cmd->param);
        if (def && def->drag){
            msg = def->drag(e);
            if (msg){
                unsigned type = cmd->id;
                if (def->base_type){
                    type = def->base_type;
                    for (;;){
                        const CommandDef *c = m_plugin->core->messageTypes.find(type);
                        if (c == NULL)
                            break;
                        MessageDef *def = (MessageDef*)(cmd->param);
                        if (def->base_type == 0)
                            break;
                        type = def->base_type;
                    }
                }
                Command cmd;
                cmd->id      = type;
                cmd->menu_id = MenuMessage;
                cmd->param	 = (void*)m_id;
                Event e(EventCheckState, cmd);
                if (e.process())
                    break;
            }
        }
    }
    if (msg){
        e->accept();
        if (isDrop){
            msg->setContact(m_id);
            Event e(EventOpenMessage, msg);
            e.process();
        }
        delete msg;
        return;
    }
    if (QTextDrag::canDecode(e)){
        QString str;
        if (QTextDrag::decode(e, str)){
            e->accept();
            if (isDrop){
                Message *msg = new Message(MessageGeneric);
                msg->setText(str);
                msg->setContact(m_id);
                Event e(EventOpenMessage, msg);
                e.process();
                delete msg;
            }
            return;
        }
    }
}
开发者ID:,项目名称:,代码行数:59,代码来源:

示例2: it

Message *MsgTextEdit::createMessage(QMimeSource *src)
{
    Message *msg = NULL;
    CommandDef *cmd;
    CommandsMapIterator it(CorePlugin::instance()->messageTypes);
    while ((cmd = ++it) != NULL){
        MessageDef *def = (MessageDef*)(cmd->param);
        if (def && def->drag){
            msg = def->drag(src);
            if (msg){
                Command c;
                c->id      = cmd->id;
                c->menu_id = MenuMessage;
                c->param	 = (void*)(m_edit->m_userWnd->id());
                if (EventCheckCommandState(c).process())
                    break;
                delete msg;
                msg = NULL;
            }
        }
    }
    return msg;
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:23,代码来源:msgedit.cpp

示例3: it

Message *MsgTextEdit::createMessage(QMimeSource *src)
{
    Message *msg = NULL;
    CommandDef *cmd;
    CommandsMapIterator it(CorePlugin::m_plugin->messageTypes);
    while ((cmd = ++it) != NULL){
        MessageDef *def = (MessageDef*)(cmd->param);
        if (def && def->drag){
            msg = def->drag(src);
            if (msg){
                unsigned type = cmd->id;
                if (def->base_type){
                    type = def->base_type;
                    for (;;){
                        const CommandDef *c = CorePlugin::m_plugin->messageTypes.find(type);
                        if (c == NULL)
                            break;
                        MessageDef *def = (MessageDef*)(cmd->param);
                        if (def->base_type == 0)
                            break;
                        type = def->base_type;
                    }
                }
                Command cmd;
                cmd->id      = type;
                cmd->menu_id = MenuMessage;
                cmd->param	 = (void*)(m_edit->m_userWnd->id());
                Event e(EventCheckState, cmd);
                if (e.process())
                    break;
                delete msg;
            }
        }
    }
    return msg;
}
开发者ID:,项目名称:,代码行数:36,代码来源:


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