本文整理汇总了C++中QString::QT45_TOASCII方法的典型用法代码示例。如果您正苦于以下问题:C++ QString::QT45_TOASCII方法的具体用法?C++ QString::QT45_TOASCII怎么用?C++ QString::QT45_TOASCII使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QString
的用法示例。
在下文中一共展示了QString::QT45_TOASCII方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: perform_grep
sqlqueryresultlist searchhandler::perform_grep(QString searchtxt, sqlqueryresultlist searchlist, bool exactmatch)
{
QVector<QString> strvec;
sqlqueryresultlist resultlist;
QFutureWatcher<sqlqueryresultlist> futureWatcher;
QProgressDialog dialog;
unsigned int n = searchlist.resultlist.size();
if (n == 0) return resultlist;
strvec.resize(n);
for (unsigned int i=0; i < n; i++)
{
strvec.replace(i, str2qt(searchlist.resultlist[i].filepath));
}
dialog.setAutoReset(false);
dialog.setLabelText(QString("Grep ").append(QString(tr("in progress"))).append(QString(" ...")));
dialog.setCancelButtonText(tr("Cancel"));
QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset()));
QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel()));
QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int,int)), &dialog, SLOT(setRange(int,int)));
QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, SLOT(setValue(int)));
m_grepExactMatch = exactmatch;
(*m_grepRegExp) = QRegExp(searchtxt.QT45_TOASCII().data(), Qt::CaseInsensitive);
m_grepRegExp->setPatternSyntax(QRegExp::RegExp2);
futureWatcher.setFuture(QtConcurrent::mappedReduced(strvec, doGrep,
collateGrep, QtConcurrent::SequentialReduce));
dialog.exec();
futureWatcher.waitForFinished();
if (futureWatcher.isCanceled() == false)
resultlist = futureWatcher.result();
return resultlist;
}
示例2: search_declaration_qt
QString searchhandler::search_declaration_qt(QString searchtxt)
{
QString str;
sqlqueryresultlist reslst = sq->search_declaration(searchtxt.QT45_TOASCII().data());
if (reslst.resultlist.size() > 0)
str.append(reslst.resultlist[0].filename.c_str())
.append(":")
.append(reslst.resultlist[0].linenum.c_str())
.append(" ==> ")
.append(reslst.resultlist[0].linetext.c_str());
return str;
}
示例3: perform_search
void searchhandler::perform_search(QString searchtxt,
bool exactmatch,
sqlquery::en_queryType qrytyp,
QString filtertxt,
int selectitem,
bool updSearchMemory)
{
if (sq->isDBOpen() == false) return;
if (searchtxt.isEmpty()) return;
sqlqueryresultlist sqlresultlist;
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
if (m_autocompBusy)
{
m_autocompBusy = false;
m_autocompFutureWatcher.waitForFinished();
}
if (m_declarBusy)
{
m_declarBusy = false;
m_declarFutureWatcher.waitForFinished();
}
sqlquery::en_queryType querytype = qrytyp;
if (querytype == sqlquery::sqlresultDEFAULT) querytype =
(sqlquery::en_queryType)m_comboBoxQueryType->itemData(m_comboBoxQueryType->currentIndex()).toInt();
if ((filtertxt.isEmpty()) && (m_checkBoxFilter->isChecked()))
{
filtertxt = m_comboBoxFilter->lineEdit()->text().trimmed();
if (updSearchMemory) updateFilterHistory(filtertxt);
}
if (querytype == sqlquery::sqlresultGREP)
{
if (filtertxt.isEmpty()) filtertxt = "*";
sqlresultlist = sq->search(filtertxt.QT45_TOASCII().data(),
sqlquery::sqlresultFILEPATH, false);
}
else
{
sqlresultlist = sq->search(searchtxt.QT45_TOASCII().data(),
querytype, exactmatch,
filtertxt.QT45_TOASCII().data());
}
QApplication::restoreOverrideCursor();
if (sqlresultlist.result_type == sqlqueryresultlist::sqlresultERROR)
{
QMessageBox msgBox((QWidget*)mw);
msgBox.setText(str2qt(sqlresultlist.sqlerrmsg));
msgBox.exec();
}
else
{
m_pushButtonGraph->setEnabled((querytype == sqlquery::sqlresultFUNC_MACRO)||
(querytype == sqlquery::sqlresultCLASS_STRUCT));
updateSearchHistory(searchtxt);
if (updSearchMemory) addToSearchMemory(searchtxt, filtertxt);
if (querytype == sqlquery::sqlresultGREP)
{
sqlresultlist = perform_grep(searchtxt, sqlresultlist, exactmatch);
}
emit searchresults(sqlresultlist, selectitem);
QString str;
str = QString("%1").arg(sqlresultlist.resultlist.size());
str += " ";
str += tr("results found");
emit updateStatus(str, 5000);
}
}
示例4: search_autocomplete_qt
QStringList searchhandler::search_autocomplete_qt(QString searchtxt)
{
return strLst2qt(sq->search_autocomplete(searchtxt.QT45_TOASCII().data()));
}