本文整理汇总了C++中FileMessage::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ FileMessage::setText方法的具体用法?C++ FileMessage::setText怎么用?C++ FileMessage::setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileMessage
的用法示例。
在下文中一共展示了FileMessage::setText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eWidget
void *MsgFile::processEvent(Event *e)
{
if (e->type() == EventCheckState){
CommandDef *cmd = (CommandDef*)(e->param());
if (cmd->param == m_edit){
unsigned id = cmd->bar_grp;
if ((id >= MIN_INPUT_BAR_ID) && (id < MAX_INPUT_BAR_ID)){
cmd->flags |= BTN_HIDE;
if (cmd->id == CmdFileName)
cmd->flags &= ~BTN_HIDE;
return e->param();
}
switch (cmd->id){
case CmdTranslit:
case CmdSmile:
case CmdSend:
case CmdSendClose:
e->process(this);
cmd->flags &= ~BTN_HIDE;
return e->param();
case CmdNextMessage:
case CmdMsgAnswer:
e->process(this);
cmd->flags |= BTN_HIDE;
return e->param();
}
}
}
if (e->type() == EventCommandExec){
CommandDef *cmd = (CommandDef*)(e->param());
if (cmd->param == m_edit){
if (cmd->id == CmdSend){
Command cmd;
cmd->id = CmdFileName;
cmd->param = m_edit;
Event eWidget(EventCommandWidget, cmd);
CToolEdit *edtName = (CToolEdit*)(eWidget.process());
if (edtName == NULL)
return NULL;
QString msgText = m_edit->m_edit->text();
QString file = edtName->text();
QStringList files;
QString f;
for (int i = 0; i < (int)file.length(); i++){
if (file[i] == '\"'){
f = trim(f);
if (!f.isEmpty())
files.append(f);
f = "";
for (i++; i < (int)file.length(); i++){
if (file[i] == '\"')
break;
f += file[i];
}
f = trim(f);
if (!f.isEmpty())
files.append(f);
f = "";
continue;
}
f += file[i];
}
f = trim(f);
if (!f.isEmpty())
files.append(f);
file = "";
for (QStringList::Iterator it = files.begin(); it != files.end(); ++it){
if (!file.isEmpty())
file += ";";
file += quoteChars(*it, ";");
}
if (!file.isEmpty()){
FileMessage *msg = new FileMessage;
msg->setText(msgText);
msg->setFile(file);
msg->setContact(m_edit->m_userWnd->id());
msg->setClient(m_client.c_str());
m_edit->sendMessage(msg);
}
return e->param();
}
if (cmd->id == CmdFileName){
selectFile();
return e->param();
}
}
}
return NULL;
}
示例2: processEvent
bool MsgFile::processEvent(Event *e)
{
if (e->type() == eEventCheckCommandState){
EventCheckCommandState *ecs = static_cast<EventCheckCommandState*>(e);
CommandDef *cmd = ecs->cmd();
if (cmd->param == m_edit){
unsigned id = cmd->bar_grp;
if ((id >= MIN_INPUT_BAR_ID) && (id < MAX_INPUT_BAR_ID)){
cmd->flags |= BTN_HIDE;
if (cmd->id == CmdFileName)
cmd->flags &= ~BTN_HIDE;
return true;
}
switch (cmd->id){
case CmdTranslit:
case CmdSmile:
case CmdSend:
case CmdSendClose:
e->process(this);
cmd->flags &= ~BTN_HIDE;
return true;
case CmdNextMessage:
case CmdMsgAnswer:
e->process(this);
cmd->flags |= BTN_HIDE;
return true;
}
}
} else
if (e->type() == eEventCommandExec){
EventCommandExec *ece = static_cast<EventCommandExec*>(e);
CommandDef *cmd = ece->cmd();
if (cmd->param == m_edit){
if (cmd->id == CmdSend){
Command cmd;
cmd->id = CmdFileName;
cmd->param = m_edit;
EventCommandWidget eWidget(cmd);
eWidget.process();
CToolEdit *edtName = qobject_cast<CToolEdit*>(eWidget.widget());
if (edtName == NULL)
return false;
QString msgText = m_edit->m_edit->toPlainText();
QString file = edtName->text();
QStringList files;
QString f;
for (int i = 0; i < (int)file.length(); i++){
if (file[i] == '\"'){
f = f.trimmed();
if (!f.isEmpty())
files.append(f);
f = QString::null;
for (i++; i < (int)file.length(); i++){
if (file[i] == '\"')
break;
f += file[i];
}
f = f.trimmed();
if (!f.isEmpty())
files.append(f);
f = QString::null;
continue;
}
f += file[i];
}
f = f.trimmed();
if (!f.isEmpty())
files.append(f);
file = QString::null;
for (QStringList::Iterator it = files.begin(); it != files.end(); ++it){
if (!file.isEmpty())
file += ';';
file += quoteChars(*it, ";");
}
if (!file.isEmpty()){
FileMessage *msg = new FileMessage;
msg->setText(msgText);
msg->setFile(file);
msg->setContact(m_edit->m_userWnd->id());
msg->setClient(m_client);
m_edit->sendMessage(msg);
}
return true;
}
if (cmd->id == CmdFileName){
selectFile();
return true;
}
}
}
return false;
}