本文整理汇总了C++中CToolEdit::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ CToolEdit::setText方法的具体用法?C++ CToolEdit::setText怎么用?C++ CToolEdit::setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CToolEdit
的用法示例。
在下文中一共展示了CToolEdit::setText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eWidget
MsgFile::MsgFile(MsgEdit *parent, Message *msg)
: QObject(parent)
{
m_client = msg->client();
m_edit = parent;
m_bCanSend = false;
if (m_edit->m_edit->isReadOnly()){
m_edit->m_edit->setText("");
m_edit->m_edit->setReadOnly(false);
}
m_edit->m_edit->setTextFormat(Qt::PlainText);
QString t = msg->getPlainText();
if (!t.isEmpty())
m_edit->m_edit->setText(t);
Command cmd;
cmd->id = CmdFileName;
cmd->param = parent;
Event eWidget(EventCommandWidget, cmd);
CToolEdit *edtName = (CToolEdit*)(eWidget.process());
if (edtName){
connect(edtName, SIGNAL(textChanged(const QString&)), this, SLOT(changed(const QString&)));
edtName->setText(static_cast<FileMessage*>(msg)->getFile());
}
changed(static_cast<FileMessage*>(msg)->getFile());
}
示例2: selectFile
void MsgFile::selectFile()
{
Command cmd;
cmd->id = CmdFileName;
cmd->param = m_edit;
Event eWidget(EventCommandWidget, cmd);
CToolEdit *edtName = (CToolEdit*)(eWidget.process());
if (edtName == NULL)
return;
QString s = edtName->text();
#ifdef WIN32
s.replace(QRegExp("\\\\"), "/");
#endif
QStringList lst = Q3FileDialog::getOpenFileNames(QString::null, QString::null, m_edit->topLevelWidget());
if ((lst.count() > 1) || ((lst.count() > 0) && (lst[0].find(' ') >= 0))){
for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it){
#ifdef WIN32
(*it).replace(QRegExp("/"), "\\");
#endif
*it = QString("\"") + *it + QString("\"");
}
#ifdef WIN32
}else{
for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it){
QString &s = *it;
s.replace(QRegExp("/"), "\\");
}
#endif
}
edtName->setText(lst.join(" "));
}
示例3: selectFile
void MsgFile::selectFile()
{
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;
QString s = edtName->text();
QStringList lst = QFileDialog::getOpenFileNames(m_edit->topLevelWidget());
if ((lst.count() > 1) || ((lst.count() > 0) && (lst[0].indexOf(' ') >= 0))){
for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it){
*it = '\"' + QDir::convertSeparators(*it) + '\"';
}
}else{
for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it){
*it = QDir::convertSeparators(*it);
}
}
edtName->setText(lst.join(" "));
}