本文整理汇总了C++中QStringList::replace方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringList::replace方法的具体用法?C++ QStringList::replace怎么用?C++ QStringList::replace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringList
的用法示例。
在下文中一共展示了QStringList::replace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runApplication
void WindowsPlatformIntegration::runApplication(const QString &command, const QUrl &url) const
{
if (command.isEmpty())
{
QDesktopServices::openUrl(url);
return;
}
const int indexOfExecutable = command.indexOf(QLatin1String(".exe"), 0, Qt::CaseInsensitive);
if (indexOfExecutable == -1)
{
Console::addMessage(tr("Failed to run command \"%1\", file is not executable").arg(command), OtherMessageCategory, ErrorMessageLevel);
return;
}
const QString application = command.left(indexOfExecutable + 4);
QStringList arguments = command.mid(indexOfExecutable + 5).split(QLatin1Char(' '), QString::SkipEmptyParts);
const int indexOfPlaceholder = arguments.indexOf(QLatin1String("%1"));
if (url.isValid())
{
if (indexOfPlaceholder > -1)
{
arguments.replace(indexOfPlaceholder, arguments.at(indexOfPlaceholder).arg(url.isLocalFile() ? QDir::toNativeSeparators(url.toLocalFile()) : url.url()));
}
else
{
arguments.append(url.isLocalFile() ? QDir::toNativeSeparators(url.toLocalFile()) : url.url());
}
}
else if (indexOfPlaceholder > -1)
{
arguments.removeAt(indexOfPlaceholder);
}
if (!QProcess::startDetached(application, arguments))
{
Console::addMessage(tr("Failed to run command \"%1\" (arguments: \"%2\")").arg(command).arg(arguments.join(QLatin1Char(' '))), OtherMessageCategory, ErrorMessageLevel);
}
}
示例2: start
void NCSLocalApplicationBridge::start(QString applicationPath,NCSCommandArguments arguments)
{
QVector<NCSCommandFileArgument> fileArgs = arguments.fileArguments();
QStringList argLiterals = arguments.literals();
for (int i = 0; i <fileArgs.size();i++)
{
int literalIndex = argLiterals.indexOf(fileArgs[i].literal);
if (literalIndex != -1)
{
if (fileArgs[i].filename != "")
{
if (!QFileInfo(fileArgs[i].filename).isAbsolute())
fileArgs[i].filename == QDir::currentPath() + "/" + fileArgs[i].filename;
argLiterals.replace(literalIndex, fileArgs[i].filename);
}
}
}
m_runProcessName = applicationPath;
m_process->start(applicationPath,argLiterals);
}
示例3: prepareGeneralSettings
/* prepareGeneralSettings()
* Called : By selectFunction()
* Performs : Sets up the General Settings Tab
*/
void Settings::prepareGeneralSettings()
{
flag[5]=true;
//once flag is set we need not have the signals as
//the settings are saved only at ok
disconnect(printersCombo,SIGNAL(currentIndexChanged( const QString &)),this,
SLOT(setPrinterFlag( const QString&)));
databaseRB->setChecked(settings->value("general/mode",true).toBool());
manualRB->setChecked(!settings->value("general/mode",false).toBool());
QList<QPrinterInfo> plist;
QPrinterInfo pinfo;
plist=pinfo.availablePrinters();
QStringList printers;
for(int i=0;i<plist.size();i++)
printers<<plist[i].printerName();
int index=printers.indexOf( settings->value("general/printer","Unavailable").toString());
QString temp,dprinter=pinfo.defaultPrinter().printerName();
temp=dprinter;
//highlighting default printer
temp+="(Default)";
printers.replace(printers.indexOf(dprinter),temp);
//inserting all the printers
printersCombo->insertItems(0,printers);
//checking whether the current printer is there in the list newly generated
//if not there show a msg saying "No printer assigned"
if(index==-1)
{
printersCombo->insertItem(0,"No Printer Assigned");
QMessageBox::information(this,"DocmaQ Settings","No Printer Assingned.Select a printer from the Available Printers ");
}
else
printersCombo->setCurrentIndex(index);
connect(printersCombo,SIGNAL(currentIndexChanged( const QString &)),this,SLOT(setPrinterFlag( const QString&)),Qt::UniqueConnection);
}
示例4: formattedField
QString Entry::formattedField(Tellico::Data::FieldPtr field_, FieldFormat::Request request_) const {
if(!field_) {
return QString();
}
// don't format the value unless it's requested to do so
if(request_ == FieldFormat::AsIsFormat) {
return field(field_);
}
const FieldFormat::Type flag = field_->formatType();
if(field_->hasFlag(Field::Derived)) {
DerivedValue dv(field_);
// format sub fields and whole string
return FieldFormat::format(dv.value(EntryPtr(const_cast<Entry*>(this)), true), flag, request_);
}
// if auto format is not set or FormatNone, then just return the value
if(flag == FieldFormat::FormatNone) {
return m_coll->prepareText(field(field_));
}
if(!m_formattedFields.contains(field_->name())) {
QString formattedValue;
if(field_->type() == Field::Table) {
QStringList rows;
// we only format the first column
foreach(const QString& row, FieldFormat::splitTable(field(field_->name()))) {
QStringList columns = FieldFormat::splitRow(row);
QStringList newValues;
foreach(const QString& value, FieldFormat::splitValue(columns.at(0))) {
newValues << FieldFormat::format(value, field_->formatType(), FieldFormat::DefaultFormat);
}
if(!columns.isEmpty()) {
columns.replace(0, newValues.join(FieldFormat::delimiterString()));
}
rows << columns.join(FieldFormat::columnDelimiterString());
}
formattedValue = rows.join(FieldFormat::rowDelimiterString());
} else {
示例5: initVerName
bool AbstractVersion::initVerName(QString VerName)
{
verNumber = new int;
verType = new VersionType;
QStringList tempVerNameList;
tempVerNameList = VerName.split("_");
if (tempVerNameList.length() > 1 && tempVerNameList.at(0) == "pre" && QString(tempVerNameList.at(1)).remove(5,QString(tempVerNameList.at(1)).length()) == "alpha")
{
tempVerNameList.pop_front();
if (QString(tempVerNameList.at(0)).remove(0,5).length() > 0)
{
tempVerNameList.replace(0,QString(tempVerNameList.at(0)).remove(0,5));
}
else
{
tempVerNameList.pop_front();
}
tempVerNameList.push_front("pre-alpha");
}
if(tempVerNameList.length() <= 1)
{
tempVerNameList = VerName.split(" ");
if (tempVerNameList.length() <= 1)
{
return false;
}
}
bool *okToInt = new bool;
*verType = stringToVersionType(tempVerNameList.at(0));
*verNumber = QString(tempVerNameList.at(1)).toInt(okToInt);
if (*okToInt == true)
{
return true;
}
return false;
}
示例6: readProperties
void Workspace::readProperties( const KConfigGroup& cfg )
{
QStringList selectedSheets = cfg.readPathEntry( "SelectedSheets", QStringList() );
if ( selectedSheets.isEmpty() ) {
/* If SelectedSheets config entry is not there, then it's
* probably the first time the user has started KSysGuard. We
* then "restore" a special default configuration. */
selectedSheets << "ProcessTable.sgrd";
selectedSheets << "SystemLoad2.sgrd";
} else if(selectedSheets[0] != "ProcessTable.sgrd") {
//We need to make sure that this is really is the process table on the first tab. No GUI way of changing this, but should make sure anyway.
//Plus this migrates users from the kde3 setup
selectedSheets.removeAll("ProcessTable.sgrd");
selectedSheets.prepend( "ProcessTable.sgrd");
}
int oldSystemLoad = selectedSheets.indexOf("SystemLoad.sgrd");
if(oldSystemLoad != -1) {
selectedSheets.replace(oldSystemLoad, "SystemLoad2.sgrd");
}
KStandardDirs* kstd = KGlobal::dirs();
QString filename;
for ( QStringList::Iterator it = selectedSheets.begin(); it != selectedSheets.end(); ++it ) {
filename = kstd->findResource( "data", "ksysguard/" + *it);
if(!filename.isEmpty()) {
restoreWorkSheet( filename, false);
}
}
int idx = cfg.readEntry( "currentSheet", 0 );
if (idx < 0 || idx > count() - 1) {
idx = 0;
}
setCurrentIndex(idx);
}
示例7: removeWhiteSpaceCharacters
QString MainWindow::removeWhiteSpaceCharacters()
{
QString materialSource = this->ui->textEdit->text();
// Split the source into separate lines
QStringList materialSplited = materialSource.split(QRegExp("\n"), QString::SkipEmptyParts);
for (int lineNumber = 0; lineNumber < materialSplited.size(); ++lineNumber)
{
QString line = materialSplited.at(lineNumber);
// Remove whitespace characters from the current line
QString trimmedLine = line.trimmed();
if (trimmedLine.isEmpty() == true) {
// This replaces the line with whitespace characters
// with an empty line
materialSplited.replace(lineNumber, trimmedLine);
}
}
return materialSplited.join("\n");
}
示例8: value
QString KBBThemeManager::value(const KBBScalableGraphicWidget::itemType itemType, const QString &styleElement)
{
const QString id = elementId(itemType);
QString style;
QString v;
QDomNode node = m_root.firstChild();
while(!node.isNull()) {
if (node.toElement().attribute(QLatin1Literal("id")) == id)
style = node.toElement().attribute(QLatin1Literal("style"));
node = node.nextSibling();
}
QStringList styleList = style.split(QLatin1Char(';'));
for (int i = 0; i < styleList.size(); i++) {
styleList.replace(i, styleList.at(i).trimmed());
if (styleList.at(i).startsWith(styleElement + QLatin1Char(':'))) {
QString s = styleList.at(i);
v = s.right(s.length()-styleElement.length()-1);
}
}
return v;
}
示例9: parseNotifyMessage
QString NotifyPluginConfiguration::parseNotifyMessage()
{
// tips:
// check of *.wav files exist needed for playing phonon queues;
// if phonon player don't find next file in queue, it buzz
QString str,str1;
str1= getSayOrder();
str = QString("%L1 ").arg(getSpinBoxValue());
int position = 0xFF;
// generate queue of sound files to play
notifyMessageList.clear();
if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath() + "/" + getCurrentLanguage()+"/"+getSound1()+".wav")))
notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath() + "/" + getCurrentLanguage()+"/"+getSound1()+".wav"));
else
if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath() + "/default/"+getSound1()+".wav")))
notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath() + "/default/"+getSound1()+".wav"));
if(getSound2()!="")
{
if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath() + "/" + getCurrentLanguage()+"/"+getSound2()+".wav")))
notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath() + "/" + getCurrentLanguage()+"/"+getSound2()+".wav"));
else
if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath() + "/default/"+getSound2()+".wav")))
notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath() + "/default/"+getSound2()+".wav"));
}
if(getSound3()!="")
{
if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath()+ "/" + getCurrentLanguage()+"/"+getSound3()+".wav")))
notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath()+ "/" + getCurrentLanguage()+"/"+getSound3()+".wav"));
else
if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath()+"/default/"+getSound3()+".wav")))
notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath()+"/default/"+getSound3()+".wav"));
}
switch(str1.at(0).toAscii())
{
case 'N'://NEVER:
str = getSound1()+" "+getSound2()+" "+getSound3();
position = 0xFF;
break;
case 'B'://BEFORE:
str = QString("%L1 ").arg(getSpinBoxValue())+getSound1()+" "+getSound2()+" "+getSound3();
position = 0;
break;
case 'A'://AFTER:
switch(str1.at(6).toAscii())
{
case 'f':
str = getSound1()+QString(" %L1 ").arg(getSpinBoxValue())+getSound2()+" "+getSound3();
position = 1;
break;
case 's':
str = getSound1()+" "+getSound2()+QString(" %L1").arg(getSpinBoxValue())+" "+getSound3();
position = 2;
break;
case 't':
str = getSound1()+" "+getSound2()+" "+getSound3()+QString(" %L1").arg(getSpinBoxValue());
position = 3;
break;
}
break;
}
if(position!=0xFF)
{
QStringList numberParts = QString("%1").arg(getSpinBoxValue()).trimmed().split(".");
QStringList numberFiles;
if((numberParts.at(0).size()==1) || (numberParts.at(0).toInt()<20))
{
//if(numberParts.at(0)!="0")
numberFiles.append(numberParts.at(0));
} else {
int i=0;
if(numberParts.at(0).right(2).toInt()<20 && numberParts.at(0).right(2).toInt()!=0) {
if(numberParts.at(0).right(2).toInt()<10)
numberFiles.append(numberParts.at(0).right(1));
else
numberFiles.append(numberParts.at(0).right(2));
i=2;
}
for(;i<numberParts.at(0).size();i++)
{
numberFiles.prepend(numberParts.at(0).at(numberParts.at(0).size()-i-1));
if(numberFiles.first()==QString("0")) {
numberFiles.removeFirst();
continue;
}
if(i==1)
numberFiles.replace(0,numberFiles.first()+'0');
if(i==2)
numberFiles.insert(1,"100");
if(i==3)
numberFiles.insert(1,"1000");
}
//.........这里部分代码省略.........
示例10: fmtAxisRecord
QString TutorModel::fmtAxisRecord(LPTutorRecordStr pRecord)
{
qint16 *p = (qint16 *)pRecord->record.pData;
QStringList list = pRecord->strList;
if(p[0] < 5 && p[0] >=0)
{
list.replace(0, (pRecord->record.nStep==0 ? tr("Home * "):QString("%1 * ").arg(pRecord->record.nStep)) );
list.replace(1, m_strListAxist.at(list.at(1).toInt()));//!!!!!!
list.replace(2, QString::number(p[1]/100.0, 'f', 2)+" ");
list.replace(3, m_strListAxist.at(list.at(3).toInt()));
list.replace(4, QString::number(p[2])+" ");
list.replace(5, m_strListAxist.at(list.at(5).toInt()));
list.replace(6, m_strListAxist.at(list.at(6).toInt()));
list.replace(7, QString::number(p[5])+" ");
list.replace(8, m_strListAxist.at(list.at(8).toInt()));
list.replace(9, QString::number(p[6]/100.0, 'f', 2)+" ");
list.replace(10, m_strListAxist.at(list.at(10).toInt()));
list.replace(11, QString::number(p[3]/100.0, 'f', 2));
if( (p[4] & 0x0101) == 0)//去除减速位置和速度显示;
{
for(int i = 0; i < 5; i++)
list.removeAt(5);
}
else if( (p[4] & 0x0100) == 0)//提前结束位置不使能;
{
list.removeAt(5);
}
else if( (p[4] & 0x0001) == 0)//提前减速不使能;
{
list.removeAt(6);
list.removeAt(6);
}
return list.join("");
}
else if(p[0] == 5)//C轴;
{
list.replace(0, (pRecord->record.nStep==0 ? tr("Home * "):QString("%1 * ").arg(pRecord->record.nStep)));
list.replace(1, m_strListAxist.at(list.at(1).toInt()));
list.replace(2, m_strListAxist.at(list.at(2).toInt()));
list.replace(3, m_strListAxist.at(list.at(3).toInt()));
list.replace(4, QString::number(p[2]/100.0, 'f', 2));
return list.join("");
}
}
示例11: runMetodoRoundRobin
void widgetDataView::runMetodoRoundRobin(int nDatos)
{
int vector[nDatos][2];
for(int i=0; i<nDatos; i++){
vector[i][0]= ui->tblData->item(i,2)->text().toInt();
vector[i][1]= 0;
}
int mayor = 0;
for(int i=0; i<nDatos; i++){
if(mayor < vector[i][0]){
mayor = vector[i][0];
}
}
int nuevasColumnas;
nuevasColumnas = (mayor / this->qRoundRobin);
if((mayor % this->qRoundRobin) > 0 ){
nuevasColumnas++;
}
QStringList lista;
lista<<"Id proceso"<<"Llegada"<<"Duracion"<<"T. Retorno";
ui->tblData->setColumnCount(lista.count()+nuevasColumnas);
for(int i=0; i<nuevasColumnas; i++){
ui->tblData->setColumnWidth(4+i,ui->tblData->rowHeight(0));
lista<<QString("C").append(QString().setNum(i+1));
}
ui->tblData->setHorizontalHeaderLabels(lista);
QColor cColor;
cColor.setNamedColor("green");
int matriz[nDatos][nuevasColumnas];
int suma = 0;
QStringList l;
for(int i=0; i<mayor; i++){
for(int j=0; j<nDatos; j++){
matriz[j][i]=0;
if(vector[j][0]>0){
if(vector[j][0] < this->qRoundRobin){
matriz[j][i] = vector[j][0];
vector[j][0] = 0;
}
else{
matriz[j][i] = matriz[j][i] + this->qRoundRobin;
vector[j][0] = vector[j][0] - this->qRoundRobin;
}
}
suma = suma + matriz[j][i];
if(matriz[j][i]>0){
vector[j][1] = suma;
if(i<1){
l<<QString().setNum(suma);
}
else{
l.replace(j,QString().setNum(suma));
}
//qDebug()<<matriz[j][i]<<" "<<vector[j][1]<<" "<<suma<<" "<<j;
QTableWidgetItem* tCiclo = new QTableWidgetItem();
tCiclo->setText(QString().setNum(matriz[j][i]));
tCiclo->setBackgroundColor(cColor);
ui->tblData->setItem(j,i+4,tCiclo);
}
}
//qDebug()<<endl;
}
float tPromedio = 0;
for(int i=0; i<nDatos; i++){
//qDebug()<<"\t"<<vector[i][1]<<"\t"<<l.value(i);
QTableWidgetItem* tRespuesta = new QTableWidgetItem();
tRespuesta->setText(l.value(i));
ui->tblData->setItem(i,3,tRespuesta);
tPromedio = tPromedio + (l.value(i).toFloat());
}
tPromedio = tPromedio / (l.count());
ui->lblOut->setText("Metodo Round Robin Expulsivo, C[i] = Iteracion i\nTiempo promedio: "+QString().setNum(tPromedio));
ui->lblOut->setVisible(true);
//qDebug()<<endl;
}
示例12: msg
//.........这里部分代码省略.........
thisWidget.hide() ;
return msg.ShowUIOK( tr( "ERROR!" ),tr( "Mount Point Path Field Is Empty" ) ) ;
}
m_ui->tableWidget->setEnabled( false ) ;
auto _option = []( const QString& e )->QString{
if( e.isEmpty() ){
return "N/A" ;
}else{
return e ;
}
} ;
auto autoMount = [ this ](){
if( m_ui->cbAutoMount->isChecked() ){
return "true" ;
}else{
return "false" ;
}
}() ;
auto configPath = m_ui->lineEditConfigFilePath->toPlainText() ;
auto idleTimeOUt = m_ui->lineEditIdleTimeOut->toPlainText() ;
if( m_type == favorites::type::sshfs ){
if( !configPath.isEmpty() ){
if( mOpts.isEmpty() ){
mOpts = "IdentityAgent=" + configPath ;
}else{
mOpts += ",IdentityAgent=" + configPath ;
}
}
if( !idleTimeOUt.isEmpty() ){
if( mOpts.isEmpty() ){
mOpts = "IdentityFile=" + idleTimeOUt ;
}else{
mOpts += ",IdentityFile=" + idleTimeOUt ;
}
}
configPath.clear() ;
idleTimeOUt.clear() ;
}
QStringList e = { dev,
path,
autoMount,
_option( configPath ),
_option( idleTimeOUt ),
_option( mOpts ) } ;
if( edit ){
auto f = this->getEntry( m_editRow ) ;
m_settings.replaceFavorite( f,e ) ;
}else{
dev.replace( "sshfs ","" ) ;
if( utility::platformIsWindows() ){
if( !utility::isDriveLetter( path ) ){
e.replace( 1,path + "/" + utility::split( dev,'/' ).last() ) ;
}
}else{
e.replace( 1,path + "/" + utility::split( dev,'/' ).last() ) ;
}
m_settings.addToFavorite( e ) ;
}
m_ui->lineEditEncryptedFolderPath->clear() ;
m_ui->lineEditMountPath->clear() ;
m_ui->lineEditConfigFilePath->clear() ;
m_ui->lineEditIdleTimeOut->clear() ;
m_ui->lineEditMountOptions->clear() ;
m_ui->cbReverseMode->setChecked( false ) ;
m_ui->cbReadOnlyMode->setChecked( false ) ;
m_ui->cbVolumeNoPassword->setChecked( false ) ;
m_ui->cbAutoMount->setChecked( false ) ;
m_ui->lineEditEncryptedFolderPath->clear() ;
m_ui->lineEditMountPath->clear() ;
this->showUpdatedEntry( e ) ;
m_ui->tableWidget->setEnabled( true ) ;
}
示例13: fieldData
//.........这里部分代码省略.........
}
case FieldTextValue:
{
QStringList list;
for (int i = 0; i < data.sources_size(); i++)
list.append(QHostAddress(data.sources(i).v4()).toString());
return list.join(", ");
}
default:
break;
}
break;
}
case kGroupRecords:
{
switch(attrib)
{
case FieldValue:
{
QVariantList grpRecords = GmpProtocol::fieldData(
index, attrib, streamIndex).toList();
for (int i = 0; i < data.group_records_size(); i++)
{
QVariantMap grpRec = grpRecords.at(i).toMap();
OstProto::Gmp::GroupRecord rec = data.group_records(i);
grpRec["groupRecordAddress"] = QHostAddress(
rec.group_address().v4()).toString();
QStringList sl;
for (int j = 0; j < rec.sources_size(); j++)
sl.append(QHostAddress(rec.sources(j).v4()).toString());
grpRec["groupRecordSourceList"] = sl;
grpRecords.replace(i, grpRec);
}
return grpRecords;
}
case FieldFrameValue:
{
QVariantList list = GmpProtocol::fieldData(
index, attrib, streamIndex).toList();
QByteArray fv;
for (int i = 0; i < data.group_records_size(); i++)
{
OstProto::Gmp::GroupRecord rec = data.group_records(i);
QByteArray rv = list.at(i).toByteArray();
rv.insert(4, QByteArray(4+4*rec.sources_size(), char(0)));
qToBigEndian(rec.group_address().v4(),
(uchar*)(rv.data()+4));
for (int j = 0; j < rec.sources_size(); j++)
{
qToBigEndian(rec.sources(j).v4(),
(uchar*)(rv.data()+8+4*j));
}
fv.append(rv);
}
return fv;
}
case FieldTextValue:
{
QStringList list = GmpProtocol::fieldData(
index, attrib, streamIndex).toStringList();
for (int i = 0; i < data.group_records_size(); i++)
{
OstProto::Gmp::GroupRecord rec = data.group_records(i);
QString recStr = list.at(i);
QString str;
str.append(QString("Group: %1").arg(
QHostAddress(rec.group_address().v4()).toString()));
str.append("; Sources: ");
QStringList sl;
for (int j = 0; j < rec.sources_size(); j++)
sl.append(QHostAddress(rec.sources(j).v4()).toString());
str.append(sl.join(", "));
recStr.replace("XXX", str);
list.replace(i, recStr);
}
return list.join("\n").insert(0, "\n");
}
default:
break;
}
break;
}
default:
break;
}
return GmpProtocol::fieldData(index, attrib, streamIndex);
}
示例14: processTableData
void processTableData(QDomNode tableNode, QDomNode recordNode, QString tableName, QString fieldsStatement, QString recordId) {
QString valuesStatement;
QDomNode childTableNodeData;
QString variableName;
QDomNode variableNode;
QString variableValue;
int fieldCounter = 0;
valuesStatement = "";
//Pass through the fields in the table so as to extract their value from the record node
childTableNodeData = tableNode.firstChild();
while (!childTableNodeData.isNull()) {
fieldCounter = fieldCounter + 1;
if (childTableNodeData.toElement().tagName() == "field") {
variableName = childTableNodeData.toElement().attribute("mysqlcode", "None");
variableNode = recordNode.toElement().elementsByTagName(variableName).item(0);
if(variableNode.toElement().text() == "") {
if (fieldCounter == nodeDepth) {
//Handles generation of primary key Id and adds to the recordKeys list
variableValue = recordId;
if (recordKeys.size() < nodeDepth) {
recordKeys.append(variableValue);
}
else {
recordKeys.replace(nodeDepth - 1, variableValue);
}
}
else if (fieldCounter < nodeDepth) {
//Referenced key get it from the recordKeys list
variableValue = recordKeys.at(fieldCounter - 1);
}
else {
//Current field is not among the primary key fields
variableValue = "";
}
}
else {
//Check if the main table (vManifestMainTable) and the key field (vManifestMainVariable) then add the key field in keys list
if (tableName == vManifestMainTable and variableName == vManifestMainVariable) {
if (recordKeys.size() < nodeDepth) {
recordKeys.append(variableValue);
}
else {
recordKeys.replace(nodeDepth - 1, variableNode.toElement().text());
}
}
variableValue = variableNode.toElement().text();
}
valuesStatement = valuesStatement + "'" + variableValue + "', ";
}
//Get the next child table node for the data
childTableNodeData = childTableNodeData.nextSibling();
}
createSQLStatement(tableName, fieldsStatement, valuesStatement);
}
示例15: setLanguage
void UTableRecycleBin::setLanguage(QString pathToTheFileLanguage)
{
emit languageIsChange(pathToTheFileLanguage);
QSettings langFile(pathToTheFileLanguage,
QSettings::IniFormat);
langFile.setIniCodec(QTextCodec::codecForName(textCodec.toUtf8()));
langFile.beginGroup("TABLERECYCLEBIN");
setWindowTitle(langFile.value("Title").toString());
actionDeleteItem->setText(langFile.value("Delete").toString());
actionRestoreItem->setText(langFile.value("Restore").toString());
QStringList lst;
for(int i = 0; i < countColumns; i++)
lst.append("");
lst.replace(indexColumnTitle,
langFile.value("ColumnTitle").toString());
lst.replace(indexColumnVisible,
langFile.value("ColumnVisible").toString());
lst.replace(indexColumnDateOfCreating,
langFile.value("ColumnDateOfCreating").toString());
lst.replace(indexColumnCountTextSymbols,
langFile.value("ColumnCountTextSymbols").toString());
lst.replace(indexColumnCountTextLines,
langFile.value("ColumnCountTextLines").toString());
lst.replace(indexColumnDateLastChange,
langFile.value("ColumnDateLastChange").toString());
lst.replace(indexColumnLock,
langFile.value("ColumnLock").toString());
lst.replace(indexColumnDateOfLastRemoval,
langFile.value("ColumnDateOfLastRemoval").toString());
lst.replace(indexColumnDateOfLastRestore,
langFile.value("ColumnDateOfLastRestore").toString());
langFile.endGroup();
actionVisibleNote->setText(lst.at(indexColumnVisible));
actionDateCreateNote->setText(lst.at(indexColumnDateOfCreating));
actionCountTextSymbols->setText(lst.at(indexColumnCountTextSymbols));
actionCountTextLine->setText(lst.at(indexColumnCountTextLines));
actionDateLastChange->setText(lst.at(indexColumnDateLastChange));
actionLock->setText(lst.at(indexColumnLock));
actionDateOfLastRemoval->setText(lst.at(indexColumnDateOfLastRemoval));
actionDateOfLastRestore->setText(lst.at(indexColumnDateOfLastRestore));
setColumnCount(countColumns);
setHorizontalHeaderLabels(lst);
QSettings ini(absolutePathToTheConfigurationProgram(),
QSettings::IniFormat);
ini.setIniCodec(QTextCodec::codecForName(textCodec.toUtf8()));
int magicNumber = 9934343245;
// если записи нет
if(ini.value("TableRecycleBin/WidthColumnTitle", magicNumber).toInt()
== magicNumber)
// ширина колонок подбираетс¤ по текст в них
resizeColumnsToContents();
else
// установить пользовательскую ширину столбцов
loadWidthColumns();
}