本文整理汇总了C++中QString::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ QString::c_str方法的具体用法?C++ QString::c_str怎么用?C++ QString::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QString
的用法示例。
在下文中一共展示了QString::c_str方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendNotification
bool CContainersDispatcher::SendNotification(TContainerIdentifyNotificationMessage &Message)
{
int count = 0;
#ifdef _DEBUG
QString event;
if(Message.MessageBody.EventType == TANK_INSERTED)
event = "Inserted";
else if(Message.MessageBody.EventType == TANK_REMOVED)
event = "Removed";
else if(Message.MessageBody.EventType == TANK_UPDATE_CONSUMPTION)
event = "Consumption updated";
else
event = "Incorrect event type";
count = m_SMContainerIDEventQueue->ItemsCount;
QString str = QFormatStr("ContainersDispatcher::SendNotification. m_SMContainerIDEventQueue->ItemsCount: %d, Tank: %s (%d), Event: %s",
count,
TankToStr(Message.TankIndex).c_str(),
Message.TankIndex, event.c_str());
CQLog::Write(LOG_TAG_RACCOON, str.c_str());
#endif
if(m_SMContainerIDEventQueue->Send(Message, QMsToTicks(DISPATCHER_QUEUE_SEND_TIMEOUT)) == QLib::wrTimeout)
{
count = m_SMContainerIDEventQueue->ItemsCount;
CQLog::Write(LOG_TAG_RACCOON, QFormatStr("Container Tag ID queue timeout. m_SMContainerIDEventQueue->ItemsCount: %d", count));
throw EContainer("Container Tag ID queue timeout");
}
return true;
}
示例2: updatePropSelector
void SendMPDialog::updatePropSelector()
{
LOCK(cs_tally);
uint32_t nextPropIdMainEco = GetNextPropertyId(true); // these allow us to end the for loop at the highest existing
uint32_t nextPropIdTestEco = GetNextPropertyId(false); // property ID rather than a fixed value like 100000 (optimization)
QString spId = ui->propertyComboBox->itemData(ui->propertyComboBox->currentIndex()).toString();
ui->propertyComboBox->clear();
for (unsigned int propertyId = 1; propertyId < nextPropIdMainEco; propertyId++) {
if ((global_balance_money[propertyId] > 0) || (global_balance_reserved[propertyId] > 0)) {
std::string spName = getPropertyName(propertyId);
std::string spId = strprintf("%d", propertyId);
if(spName.size()>23) spName=spName.substr(0,23) + "...";
spName += " (#" + spId + ")";
if (isPropertyDivisible(propertyId)) { spName += " [D]"; } else { spName += " [I]"; }
ui->propertyComboBox->addItem(spName.c_str(),spId.c_str());
}
}
for (unsigned int propertyId = 2147483647; propertyId < nextPropIdTestEco; propertyId++) {
if ((global_balance_money[propertyId] > 0) || (global_balance_reserved[propertyId] > 0)) {
std::string spName = getPropertyName(propertyId);
std::string spId = strprintf("%d", propertyId);
if(spName.size()>23) spName=spName.substr(0,23)+"...";
spName += " (#" + spId + ")";
if (isPropertyDivisible(propertyId)) { spName += " [D]"; } else { spName += " [I]"; }
ui->propertyComboBox->addItem(spName.c_str(),spId.c_str());
}
}
int propIdx = ui->propertyComboBox->findData(spId);
if (propIdx != -1) { ui->propertyComboBox->setCurrentIndex(propIdx); }
}
示例3: GetLastLogFileName
// Initialize the log file
void CQ2RTApplication::InitLogFile(void)
{
CQLog::SetMaxNumberOfLogFiles(CAppParams::Instance()->MaxLogFilesNumber);
// Force Directory creation
ForceDirectories((AppFilePath.Value() + "Log").c_str());
CQLog::Init(MAX_LOG_FILE_SIZE, LAST_LOG_TAG, AppFilePath.Value() + "Log\\",
AppFilePath.Value() + "Log\\" + GetLastLogFileName(), LogFileChangeEventHandler);
CQEncryptedLog::Init(2 * MAX_LOG_FILE_SIZE, LAST_LOG_TAG, AppFilePath.Value() + "Configs\\",
AppFilePath.Value() + "Configs\\follow - up log.txt",NULL);
CQEncryptedLog::EnableEchoToMonitor(false);
CQEncryptedLog::EnableDisableTag(LOG_TAG_GENERAL, true);
CQEncryptedLog::EnableDisableTag(LOG_TAG_HASP, true);
CQEncryptedLog::Write(LOG_TAG_GENERAL, "---------------------------------------------------------");
#if defined(OS_WINDOWS) && !defined(EDEN_CL)
QString HelloMsg = (QString)APPLICATION_NAME + " is up (version: " + QGetAppVersionStr() + " Build: " +
GetVersionDate() + " " + GetVersionTime() + ")";
#else
QString HelloMsg = "1 - Eden is up (version: " + QGetAppVersionStr() + " Build: " + __DATE__ + " " + __TIME__ ")";
#endif
CQLog::EnableDisableTag(LOG_TAG_GENERAL, true);
CQLog::Write(LOG_TAG_GENERAL, HelloMsg.c_str());
CQEncryptedLog::Write(LOG_TAG_GENERAL, HelloMsg.c_str());
CQLog::WriteUnformatted("---------------------------------------------------------");
IsLogFileInit = true;
}
示例4:
// Constructor
CHTML_ReportFile::CHTML_ReportFile(const QString FileName, const QString DirName):m_StrList(NULL)
{
// If directory doesn't exist, create it
QString OutputDir = Q2RTApplication->AppFilePath.Value() + DirName;
if (DirectoryExists(OutputDir.c_str()) == false)
ForceDirectories(OutputDir.c_str()); // Force Directory creation
m_ReportFileName = Q2RTApplication->AppFilePath.Value() + FileName;
}
示例5: readData
// -----------------------------------------------------------------------------
// Read the data part of the ANG file
// -----------------------------------------------------------------------------
void CSVGrainDataReader::readData(const QString& line, int row, size_t i)
{
/* When reading the data there should be at least 8 cols of data. There may even
* be 11 columns of data. The column names should be the following:
* Grain ID
* phi1
* phi
* phi2
*
*
*/
float p1, p, p2, eq, ba, ca, o3;
int gid, obb, nn, sg;
m_NumFeatures = sscanf(line.c_str(), "%d,%f,%f,%f,%f,%f,%f,%f,%d,%d,%d", &gid, &p1, &p, &p2, &eq, &ba, &ca, &o3, &obb, &nn, &sg);
m_GrainId[row] = gid;
m_Phi1[row] = p1;
m_Phi[row] = p;
m_Phi2[row] = p2;
m_EquivDiam[row] = eq;
m_B_Over_A[row] = ba;
m_C_Over_A[row] = ca;
m_Omega3[row] = o3;
m_OutsideBoundingBox[row] = obb;
m_NumNeighbors[row] = nn;
m_SurfaceGrain[row] = sg;
}
示例6: GoToTAxisState
//Special T axis command
TQErrCode CMotorsDummy::GoToTAxisState(int State)
{
QString StateString;
#ifdef CHECK_MOV
if(AxisUnderMovement[AXIS_T])
{
CQLog::Write(LOG_TAG_MOTORS,"GoTo T Axis State is under movement");
return Q2RT_FATAL_ERROR;
}
#endif
AxisUnderMovement[AXIS_T] = true;
switch(State)
{
case PURGE_TANK_CLOSED: StateString="Tank Closed";break;
case PURGE_TANK_IN_PURGE_POSITION:StateString="Purge position";break;
case PURGE_TANK_IN_WIPE_POSITIOND:StateString="Wipe position";break;
default:
break;
}
//Reset solicited position to 0, in case Axis T will be moved manually (without the next bit of code solicited position will be the same as previous manually moved)
long PosInSteps = 0;
UpdateAxisLocation(AXIS_T, PosInSteps);
KeepAxisSolicitedLocation(AXIS_T, PosInSteps);
FrontEndInterface->UpdateStatus(FE_CURRENT_X_AXIS_POSITION+AXIS_T, (int)PosInSteps);
m_LastSolicitedPositions[AXIS_T] = GetAxisSolicitedLocation(PosInSteps);
CQLog::Write(LOG_TAG_MOTORS,"Go To T Axis State = %s",StateString.c_str() );
return Q_NO_ERROR;
}
示例7: LoadModel
void DebugEmitterComponent::LoadModel(QString path, AssetManager* assetMgr)
{
if (assetMgr)
{
_assetManager = assetMgr;
if (assetMgr->LoadModel(path.c_str(), path.c_str()))
{
auto asset = assetMgr->GetModel(path.c_str());
if (asset)
_model = asset->model;
else
_model = nullptr;
}
}
}
示例8: QIntToHex
void CQ2RTApplication::PrintLogMessage(int MessageID, TGenericCockie Cockie)
{
CEdenProtocolClient *InstancePtr = reinterpret_cast<CEdenProtocolClient *>(Cockie);
QString PrintMessage = InstancePtr->Name() + " :Retry Message: " +
InstancePtr->ConvertMessageToString(MessageID) +
" (0x" + QIntToHex((const int)MessageID, 2) + ")";
CQLog::Write(LOG_TAG_GENERAL, PrintMessage.c_str());
}
示例9: while
void AFramework::MTempMaster::msg(const QString & s, const uint32 ms) const{
m_lcd->clear();
if(s.isEmpty()){
m_lcd->write("NULL POINTER");
while(1);
}else{
m_lcd->write(s.c_str());
}
System::delay(ms);
return;
}
示例10: GetTagButtonClick
void __fastcall TRFIDForm::GetTagButtonClick(TObject *Sender)
{
int num_of_tags = 0;
unsigned __int64 tagsList[MAX_TAGS];
//m_RFIDInstance->EnableSampling(m_rdrNum,m_Channel);
// Get the last read tags list:
m_RFIDInstance->GetTags( m_rdrNum
, m_Channel
, tagsList
, &num_of_tags);
if (num_of_tags != 1)
return;
m_TagAccess[m_rdrNum]->SetTagID(tagsList[0]);
QString TagStr = m_RFIDInstance->GetTagIDAsString(tagsList[0]);
TagIDPanel->Caption = TagStr.c_str();
}
示例11: DeleteFiles
void CPathLib::DeleteFiles(std::list<std::string> *pFiles, std::list<bool> *pResults)
#endif
{
#ifdef QT
QList<QString>::iterator itFiles;
QString sFilename;
#else
std::list<std::string>::iterator itFiles;
std::string sFilename;
#endif
if(pFiles == NULL)
return;
if(pResults == NULL)
return;
pResults->clear();
for(itFiles = pFiles->begin(); itFiles != pFiles->end(); itFiles++)
{
sFilename = CompletePath(*itFiles);
#ifdef QT
if(remove(sFilename.toStdString().c_str()) != 0)
#else
if(remove(sFilename.c_str()) != 0)
#endif
{
pResults->push_back(false);
}
else
{
pResults->push_back(true);
}
}
}
示例12: EnterPasswordClick
void __fastcall TRFIDForm::EnterPasswordClick(TObject *Sender)
{
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
int res = timeinfo->tm_mday*timeinfo->tm_mday+(timeinfo->tm_mon+1)*(timeinfo->tm_mon+1)+timeinfo->tm_year;
QString str = "TESTER" + QIntToStr(res);
if(strcmp(str.c_str(),PasswordMaskEdit->Text.c_str())==0)
{
PasswordMaskEdit->Clear();
IncorrectPass->Visible = false;
m_validPass = true;
SecurityGroup->Visible = true;
SecurityGroup->Enabled = true;
SettingWeightLabel->Visible = true;
InitialWeightEdit->Visible = true;
InitialWeightEdit->Enabled = true;
ProtocolNumberGroup->Visible = true;
//ProtocolNumberGroup->Enabled = true;
TagVersionEdit->Visible = true;
ErrorCodeGroup->Visible = true;
ErrorCodeEdit->Visible = true;
//ErrorCodeGroup->Enabled = true;
}
else
{
IncorrectPass->Visible = true;
m_validPass = true;
}
}
示例13: SaveAs
void Widget::SaveAs()
{
// Choix du chemin d'enregistrement
QString file = QFileDialog::getSaveFileName(this,"Enregister", QString(), ".csv");
// Enregistrement
QFile saveCSV(file +".csv");
if (saveCSV.open(QFile::WriteOnly))
{
QTextStream out(&saveCSV);
QString PhoneNumber = "Phone Number";
QString GroupName = "Group Name";
out << "Name" << "," << PhoneNumber << "," << "Expenses" << "," << GroupName << "," << "Mail" << "," << "Type" << "\n";
for (vector<Group>::iterator it = Groups.begin() ; it != Groups.end(); ++it)
{
Group tmpGroup = *it;
for (size_t i=0; i < tmpGroup.size(); ++i) {
// operate the payback first
tmpGroup[i].operatePayback(tmpGroup.expensesPerPerson());
// display the values
string Name = tmpGroup[i].getName();
string Phone = tmpGroup[i].getPhone();
float Expenses = tmpGroup[i].getExpenses();
string GroupName = it->getName();
string Mail = tmpGroup[i].getMail();
int Statut = tmpGroup[i].getStatut();
QString QName = QString(Name.c_str());
QString QPhone = QString(Phone.c_str());
QString QExpenses;
QExpenses.setNum(Expenses);
QString QGroupName = QString(GroupName.c_str());
QString QMail = QString(Mail.c_str());
QString QStatut;
if (Statut == 0){
QStatut = "Donnateur";
}
else{
QStatut = "Membre";
}
out << QName << "," << QPhone << "," << QExpenses << "," << QGroupName << "," << QMail << "," << QStatut << "\n";
}
}
}
}
示例14: loadJS
void ReadiumJSApi::loadJS(QString jScript)
{
#if 0
QAxObject* doc = WebBrowser->querySubObject("Document()");
//IDispatch* Disp;
IDispatch* winDoc = NULL;
IHTMLDocument2* document = NULL;
//332C4425-26CB-11D0-B483-00C04FD90119 IHTMLDocument2
//25336920-03F9-11CF-8FD0-00AA00686F13 HTMLDocument
doc->queryInterface(QUuid("{332C4425-26CB-11D0-B483-00C04FD90119}"), (void**)(&winDoc));
if (winDoc) {
document = NULL;
winDoc->QueryInterface(IID_IHTMLDocument2, (void**)&document);
IHTMLWindow2 *window = NULL;
document->get_parentWindow(&window);
QAxObject* documentWin = new QAxObject(document, WebBrowser);
QAxObject* jScriptWin = new QAxObject(window, WebBrowser);
//connect(jScriptWin, SIGNAL(exception(int, QString, QString, QString)), this, SLOT(printWinException(int, QString, QString, QString)));
//jScriptInitialized = true;
QVariantList params;
//params.append(javaScript);
//params.append("alert('Hi')");
params.append("JScript");
//QVariant result = jScriptWin->dynamicCall("execScript(QString, QString)", params);
VARIANT var;
QString strCode = jScript;
QString stringLang("JScript");
BSTR bstrCode = SysAllocString(strCode.toStdWString().c_str());
BSTR bstrLang = SysAllocString(stringLang.toStdWString().c_str());
window->execScript(bstrCode, bstrLang, &var);
SysFreeString(bstrCode);
SysFreeString(bstrLang);
document->Release();
winDoc->Release();
}
else {
//qDebug() << "COULD NOT GET DOCUMENT OBJECT! Aborting";
}
#else
if (WebBrowser)
{
CComPtr<IDispatch> pDispDoc = WebBrowser->get_Document();
CComQIPtr<IHTMLDocument2> pHtmlDoc(pDispDoc);
if (pHtmlDoc)
{
CComPtr<IHTMLWindow2> pMainWin2;
pHtmlDoc->get_parentWindow(&pMainWin2);
if (pMainWin2)
{
CComVariant vtRv(0);
CComBSTR bsCode = jScript.c_str() /*L"alert (\" Hi !\");"*/, bsLang = L"JavaScript";
HRESULT hr = pMainWin2->execScript(bsCode, bsLang, &vtRv);
if (!SUCCEEDED(hr))
{
//AfxMessageBox(L"Error executing script");
}
}
}
}
//QAxObject* qv = WebBrowser->querySubObject("Document()");
//QAxObject* qv1 = qv->querySubObject("parentWindow");
//QString script = "(function(){" + jScript + "})()";
//qDebug() << script;
/*{
QString filename = "Data.txt";
QFile file(filename);
if (file.open(QIODevice::ReadWrite)) {
QTextStream stream(&file);
stream << script << endl;
}
file.close();
}*/
//QVariantList params;
//params.append("alert('hello')");
//params.append("JScript");
//QVariant result = qv1->dynamicCall("execScript(QString, QString)", params);
//qv1->dynamicCall("execScript(Qstring)", script, "javascript");
//qv1->dynamicCall("execScript(Qstring, QString)", script, "JScript"); //, "javascript"
//qv1->deleteLater();
//qv->deleteLater();
//Log.i(TAG, "loadJS: "+jScript);
//mJSLoader.loadJS("javascript:(function(){" + jScript + "})()");
//pWebBrowser->dynamicCall(script);
#endif
}
示例15: UpdateTankStatus
// Sends message notifying cartridge insertion or removal
void CContainer::UpdateTankStatus(int TankIndex, TTagIdentificationEventType Status, const unsigned int Weight, const unsigned int SliceNum)
{
TContainerIdentifyNotificationMessage Msg;
memset(&Msg, 0, sizeof(TContainerIdentifyNotificationMessage));
Msg.TankIndex = static_cast<TTankIndex>(TankIndex);
Msg.MessageBody.EventType = Status;
Msg.MessageBody.Weight = Weight;
Msg.MessageBody.SliceNum = SliceNum;
Msg.MessageBody.TimeStamp = QGetTicks();
m_ContainerDispatcher->SendNotification(Msg);
QString StatusStr = "";
switch(Status)
{
case TANK_INSERTED:
StatusStr = "inserted";
break;
case TANK_REMOVED:
StatusStr = "removed";
break;
case TANK_UPDATE_CONSUMPTION:
StatusStr = QFormatStr("accumulating weight %d mGr for consumption update", Weight);
break;
}
CQLog::Write(LOG_TAG_RACCOON, QFormatStr("Cartridge %s (%d) %s", TankToStr(static_cast<TTankIndex>(TankIndex)).c_str(), TankIndex, StatusStr.c_str()));
}