本文整理汇总了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;
}
}
}
示例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;
}
示例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;
}