本文整理汇总了C++中QStringList::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringList::clear方法的具体用法?C++ QStringList::clear怎么用?C++ QStringList::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringList
的用法示例。
在下文中一共展示了QStringList::clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDataMetadata
int MainWindow::getDataMetadata( const int i_CodecInput, const int i_OutputFormat, const QString &s_MetadataIn, QStringList &sl_DataMetadataList, structURL URL[], const int i_NumOfFiles )
{
int n = 0;
int j = 0;
int i_line = 0;
int stopProgress = 0;
int i_DatePos = -1;
int i_TimePos = -1;
int i_DateTimePos = -1;
int i_ElevationPos = -1;
int i_EventLabelPos = -1;
int i_CampaignLabelPos = -1;
int i_AreaNamePos = -1;
int i_GearNamePos = -1;
int i_LatitudePos = -1;
int i_LongitudePos = -1;
QStringList sl_Input;
QString s_Metadata = "";
QString s_EventLabel = "";
QString s_Header = "";
QString s_LatLon = "";
bool b_containsPosition = false;
sl_DataMetadataList.clear();
//-----------------------------------------------------------------------------------------------------------------------
b_containsPosition = getDataMetadataPosition( s_MetadataIn, i_DatePos, i_TimePos, i_DateTimePos, i_ElevationPos, i_EventLabelPos, i_CampaignLabelPos, i_AreaNamePos, i_GearNamePos, i_LatitudePos, i_LongitudePos );
//-----------------------------------------------------------------------------------------------------------------------
if ( ( n = readFile( s_MetadataIn.section( "\t", _FILENAMEPOS, _FILENAMEPOS ), sl_Input, i_CodecInput ) ) < 1 )
return( n );
//-----------------------------------------------------------------------------------------------------------------------
switch ( i_OutputFormat )
{
case _FORMAT_KMLFILE:
initProgress( i_NumOfFiles, s_MetadataIn.section( "\t", _FILENAMEPOS, _FILENAMEPOS ), tr( "Creating Google Earth import file" ), n );
break;
case _FORMAT_SHAPE_METADATA:
case _FORMAT_SHAPE_DATA:
initProgress( i_NumOfFiles, s_MetadataIn.section( "\t", _FILENAMEPOS, _FILENAMEPOS ), tr( "Creating shapefile" ), n );
break;
default:
initProgress( i_NumOfFiles, s_MetadataIn.section( "\t", _FILENAMEPOS, _FILENAMEPOS ), tr( "Creating file" ), n );
break;
}
//-----------------------------------------------------------------------------------------------------------------------
i_line = s_MetadataIn.section( "\t", _NUMOFHEADERLINESPOS, _NUMOFHEADERLINESPOS ).toInt()-1;
if ( sl_Input.at( i_line ) == "*/" )
++i_line;
for ( int i=0; i<NumOfSections( sl_Input.at( i_line ) ); ++i )
{
s_Header = sl_Input.at( i_line ).section( "\t", i, i );
if ( ( s_Header.startsWith( "url", Qt::CaseInsensitive ) == true ) || ( s_Header.startsWith( "uri", Qt::CaseInsensitive ) == true ) || ( s_Header.startsWith( "persistent identifier", Qt::CaseInsensitive ) == true ) )
{
if ( ++j <= _MAX_NUM_OF_URLS )
{
URL[j].position = i;
if ( s_Header.contains( "@" ) == true )
URL[j].TitleURL = s_Header.section( "@", 1, 1 );
else
URL[j].TitleURL = s_Header;
}
}
}
stopProgress = incProgress( i_NumOfFiles, i_line );
//-----------------------------------------------------------------------------------------------------------------------
++i_line;
parseData( i_line, sl_Input.at( i_line ), s_MetadataIn, i_AreaNamePos, i_CampaignLabelPos, i_EventLabelPos, i_GearNamePos, i_DatePos, i_TimePos, i_DateTimePos, i_LatitudePos, i_LongitudePos, i_ElevationPos, URL, s_Metadata );
addToMetadataList( s_Metadata, s_EventLabel, s_LatLon, sl_DataMetadataList );
stopProgress = incProgress( i_NumOfFiles, i_line );
if ( b_containsPosition == true )
{
while ( ( ++i_line < n ) && ( stopProgress != _APPBREAK_ ) )
{
parseData( i_line, sl_Input.at( i_line ), s_MetadataIn, i_AreaNamePos, i_CampaignLabelPos, i_EventLabelPos, i_GearNamePos, i_DatePos, i_TimePos, i_DateTimePos, i_LatitudePos, i_LongitudePos, i_ElevationPos, URL, s_Metadata );
addToMetadataList( s_Metadata, s_EventLabel, s_LatLon, sl_DataMetadataList );
stopProgress = incProgress( i_NumOfFiles, i_line );
//.........这里部分代码省略.........
示例2: KDialog
AboutPlugins::AboutPlugins( Config *_config, QWidget* parent, Qt::WFlags f )
: KDialog( parent, f ),
config( _config ),
currentPlugin( 0 )
{
setCaption( i18n("About plugins") );
setWindowIcon( KIcon("preferences-plugin") );
setButtons( KDialog::Close );
setButtonFocus( KDialog::Close );
QWidget *widget = new QWidget( this );
setMainWidget( widget );
QHBoxLayout *box = new QHBoxLayout( widget );
QVBoxLayout *pluginListBox = new QVBoxLayout( widget );
box->addLayout( pluginListBox );
QLabel *installedPlugins = new QLabel( i18n("Installed plugins:"), this );
pluginListBox->addWidget( installedPlugins );
QListWidget *pluginsList = new QListWidget( this );
pluginListBox->addWidget( pluginsList );
connect( pluginsList, SIGNAL(currentTextChanged(const QString&)), this, SLOT(currentPluginChanged(const QString&)) );
QStringList pluginNames;
QList<CodecPlugin*> codecPlugins = config->pluginLoader()->getAllCodecPlugins();
for( int i=0; i<codecPlugins.count(); i++ )
{
pluginNames += codecPlugins.at(i)->name();
}
pluginNames.sort();
pluginsList->addItems( pluginNames );
pluginNames.clear();
QList<FilterPlugin*> filterPlugins = config->pluginLoader()->getAllFilterPlugins();
for( int i=0; i<filterPlugins.count(); i++ )
{
pluginNames += filterPlugins.at(i)->name();
}
pluginNames.sort();
pluginsList->addItems( pluginNames );
pluginNames.clear();
QList<ReplayGainPlugin*> replaygainPlugins = config->pluginLoader()->getAllReplayGainPlugins();
for( int i=0; i<replaygainPlugins.count(); i++ )
{
pluginNames += replaygainPlugins.at(i)->name();
}
pluginNames.sort();
pluginsList->addItems( pluginNames );
pluginNames.clear();
QList<RipperPlugin*> ripperPlugins = config->pluginLoader()->getAllRipperPlugins();
for( int i=0; i<ripperPlugins.count(); i++ )
{
pluginNames += ripperPlugins.at(i)->name();
}
pluginNames.sort();
pluginsList->addItems( pluginNames );
pluginsList->setFixedWidth( 180 );
box->addSpacing( 10 );
QVBoxLayout *pluginInfoBox = new QVBoxLayout( widget );
box->addLayout( pluginInfoBox );
aboutPluginLabel = new QLabel( this );
aboutPluginLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
aboutPluginLabel->setWordWrap( true );
aboutPluginLabel->setTextFormat( Qt::RichText );
pluginInfoBox->addWidget( aboutPluginLabel );
connect( aboutPluginLabel, SIGNAL(linkActivated(const QString&)), this, SLOT(showProblemInfo(const QString&)) );
pluginInfoBox->addStretch();
QHBoxLayout *configurePluginBox = new QHBoxLayout( widget );
pluginInfoBox->addLayout( configurePluginBox );
configurePlugin = new KPushButton( KIcon("configure"), "", widget );
configurePlugin->hide();
configurePluginBox->addWidget( configurePlugin );
configurePluginBox->addStretch();
connect( configurePlugin, SIGNAL(clicked()), this, SLOT(configurePluginClicked()) );
pluginsList->setCurrentRow(0);
QListWidgetItem *currentItem = pluginsList->currentItem();
if( currentItem )
{
currentPluginChanged( currentItem->text() );
}
setInitialSize( QSize(500,300) );
KSharedConfig::Ptr conf = KGlobal::config();
KConfigGroup group = conf->group( "AboutPlugins" );
restoreDialogSize( group );
}
示例3: QString
NewX509::NewX509(QWidget *parent)
:QDialog(parent)
{
int i;
eku_nid = *MainWindow::eku_nid;
dn_nid = *MainWindow::dn_nid;
aia_nid = *MainWindow::aia_nid;
attr_nid << NID_pkcs9_unstructuredName << NID_pkcs9_challengePassword;
QStringList keys;
setupUi(this);
/* temporary storage for creating temporary X509V3_CTX */
ctx_cert = NULL;
for (i=0; i < dn_nid.count(); i++)
keys << QString(OBJ_nid2ln(dn_nid[i]));
extDNlist->setKeys(keys);
extDNlist->setInfoLabel(extDNinfo);
connect(extDNlist->itemDelegateForColumn(1),
SIGNAL(setupLineEdit(const QString &, QLineEdit *)),
this, SLOT(setupExtDNwidget(const QString &, QLineEdit *)));
setWindowTitle(XCA_TITLE);
for (i=0; i<tabWidget->count(); i++) {
tabnames << tabWidget->tabText(i);
}
nsImg->setPixmap(*MainWindow::nsImg);
serialNr->setValidator(new QRegExpValidator(QRegExp("[0-9a-fA-F]*"), this));
QStringList strings;
// are there any useable private keys ?
newKeyDone("");
// any PKCS#10 requests to be used ?
strings = MainWindow::reqs->getDesc();
if (strings.isEmpty()) {
fromReqCB->setDisabled(true);
fromReqCB->setChecked(false);
}
else {
reqList->insertItems(0, strings);
}
on_fromReqCB_clicked();
// How about signing certificates ?
strings = MainWindow::certs->getSignerDesc();
if (strings.isEmpty()) {
foreignSignRB->setDisabled(true);
} else {
certList->insertItems(0, strings);
}
#ifdef WG_QA_SERIAL
selfQASignRB = new QRadioButton(signerBox);
setTabOrder(serialNr, selfQASignRB);
setTabOrder(selfQASignRB, foreignSignRB);
selfQASignRB->setText(tr(
"Create a &self signed certificate with a MD5-hashed QA serial"));
QBoxLayout *l = (QBoxLayout *)signerBox->layout();
l->insertWidget(1, selfQASignRB);
#endif
// set dates to now and now + 1 year
validNumber->setText("1");
validRange->setCurrentIndex(2);
on_applyTime_clicked();
// settings for the templates ....
strings.clear();
strings = MainWindow::temps->getDescPredefs();
tempList->insertItems(0, strings);
// setup Extended keyusage
for (i=0; i < eku_nid.count(); i++)
ekeyUsage->addItem(OBJ_nid2ln(eku_nid[i]));
// setup Authority Info Access
for (i=0; i < aia_nid.count(); i++)
aiaOid->addItem(OBJ_nid2ln(aia_nid[i]));
// init the X509 v3 context
X509V3_set_ctx(&ext_ctx, NULL , NULL, NULL, NULL, 0);
X509V3_set_ctx_nodb(&ext_ctx);
QList<QLabel *> nameLabel;
nameLabel << LcountryName << LstateOrProvinceName << LlocalityName <<
LorganisationName << LorganisationalUnitName << LcommonName <<
LemailAddress;
for(int i=0; i<nameLabel.count(); i++) {
nameLabel[i]->setText(OBJ_nid2ln(name_nid[i]));
QString tt = nameLabel[i]->toolTip();
nameLabel[i]->setToolTip(QString("[%1] %2").
arg(OBJ_nid2sn(name_nid[i])).arg(tt));
name_ptr[i] = (QLineEdit *)nameLabel[i]->buddy();
setupLineEditByNid(name_nid[i], name_ptr[i]);
}
// Setup Request Attributes
//.........这里部分代码省略.........
示例4: parseFile
void Recognizer::parseFile(const QString & infileName, const QString & outfileName)
{
QFile inFile(infileName);
if (!inFile.open(QIODevice::ReadOnly | QIODevice::Text))
return;
QFile outFile(outfileName);
if (!outfileName.isEmpty() && !outFile.open(QIODevice::WriteOnly | QIODevice::Text))
return;
// use textstream instead of direct file reading for prevent
// problems with different RETURN symbol on different platforms
// textstream always returns trimmed string
QTextStream in(&inFile);
QTextStream out(&outFile);
QStringList lineList;
QString line;
do {
line = in.readLine();
lineList.append(line);
// 4 lines read so starting to process them
if (lineList.count() == 4) {
QString accountNumber = decodeValue(lineList);
ErrorCode code = checkSum(accountNumber);
// correct errors if possible
QStringList possibleVariants;
if (code == ILL || code == ERR) {
code = errorCorrection(lineList, &possibleVariants);
}
QString formattedString;
// was value corrected or or it's iginal
if (possibleVariants.size() == 1)
formattedString.append(possibleVariants[0]);
else
formattedString.append(accountNumber);
// status
if (code == AMB) {
formattedString += " " + errorToString(code) + " [\'" + possibleVariants.join("\',\'") + "\']";
} else
formattedString += " " + errorToString(code);
if (outfileName.isEmpty())
std::cout << formattedString.toStdString() << std::endl;
else
out << formattedString << "\n";
lineList.clear();
possibleVariants.clear();
}
} while(!line.isNull());
inFile.close();
if (outFile.isOpen())
outFile.close();
}
示例5: main
int main( int argc, char **argv )
{
QString defaultContext = "@default";
MetaTranslator fetchedTor;
QByteArray codecForTr;
QByteArray codecForSource;
QStringList tsFileNames;
QStringList uiFileNames;
bool verbose = false;
bool noObsolete = false;
bool metSomething = false;
int numFiles = 0;
bool standardSyntax = true;
bool metTsFlag = false;
int i;
for ( i = 1; i < argc; i++ ) {
if ( qstrcmp(argv[i], "-ts") == 0 )
standardSyntax = false;
}
for ( i = 1; i < argc; i++ ) {
if ( qstrcmp(argv[i], "-help") == 0 ) {
printUsage();
return 0;
} else if ( qstrcmp(argv[i], "-noobsolete") == 0 ) {
noObsolete = true;
continue;
} else if ( qstrcmp(argv[i], "-verbose") == 0 ) {
verbose = true;
continue;
} else if ( qstrcmp(argv[i], "-version") == 0 ) {
fprintf( stderr, "pylupdate4 version %s\n", QT_VERSION_STR );
return 0;
} else if ( qstrcmp(argv[i], "-ts") == 0 ) {
metTsFlag = true;
continue;
}
numFiles++;
QString fullText;
if ( !metTsFlag ) {
QFile f( argv[i] );
if ( !f.open(QIODevice::ReadOnly) ) {
#if defined(_MSC_VER) && _MSC_VER >= 1400
char buf[100];
strerror_s(buf, sizeof(buf), errno);
fprintf( stderr, "pylupdate4 error: Cannot open file '%s': %s\n",
argv[i], buf );
#else
fprintf( stderr, "pylupdate4 error: Cannot open file '%s': %s\n",
argv[i], strerror(errno) );
#endif
return 1;
}
QTextStream t( &f );
fullText = t.readAll();
f.close();
}
QString oldDir = QDir::currentPath();
QDir::setCurrent( QFileInfo(argv[i]).path() );
if ( standardSyntax ) {
fetchedTor = MetaTranslator();
codecForTr.clear();
codecForSource.clear();
tsFileNames.clear();
uiFileNames.clear();
QMap<QString, QString> tagMap = proFileTagMap( fullText );
QMap<QString, QString>::Iterator it;
for ( it = tagMap.begin(); it != tagMap.end(); ++it ) {
QStringList toks = it.value().split(' ');
QStringList::Iterator t;
for ( t = toks.begin(); t != toks.end(); ++t ) {
if ( it.key() == "SOURCES" ) {
fetchtr_py( (*t).toAscii(), &fetchedTor, defaultContext.toAscii(), true, codecForSource );
metSomething = true;
} else if ( it.key() == "TRANSLATIONS" ) {
tsFileNames.append( *t );
metSomething = true;
} else if ( it.key() == "CODEC" ||
it.key() == "DEFAULTCODEC" ||
it.key() == "CODECFORTR" ) {
codecForTr = (*t).toLatin1();
fetchedTor.setCodecForTr(codecForTr);
} else if ( it.key() == "CODECFORSRC" ) {
codecForSource = (*t).toLatin1();
} else if ( it.key() == "FORMS" ) {
fetchtr_ui( (*t).toAscii(), &fetchedTor, defaultContext.toAscii(), true);
}
}
//.........这里部分代码省略.........
示例6: parseQuoted
QgsDelimitedTextFile::Status QgsDelimitedTextFile::parseQuoted( QStringList &fields )
{
fields.clear();
// Find the first non-blank line to read
QString buffer;
Status status = nextLine( buffer, true );
if ( status != RecordOk ) return status;
mRecordLineNumber = mLineNumber;
QString field; // String in which to accumulate next field
bool escaped = false; // Next char is escaped
bool quoted = false; // In quotes
QChar quoteChar = 0; // Actual quote character used to open quotes
bool started = false; // Non-blank chars in field or quotes started
bool ended = false; // Quoted field ended
int cp = 0; // Pointer to the next character in the buffer
int cpmax = buffer.size(); // End of string
while ( true )
{
QChar c = buffer[cp];
cp++;
// If end of line then if escaped or buffered then try to get more...
if ( cp > cpmax )
{
if ( quoted || escaped )
{
status = nextLine( buffer, false );
if ( status != RecordOk ) return status;
field.append( '\n' );
cp = 0;
cpmax = buffer.size();
escaped = false;
continue;
}
break;
}
// If escaped, then just append the character
if ( escaped )
{
field.append( c );
escaped = false;
continue;
}
// Determine if this is a special character - test each class in turn
// Note that delimiters are not valid as quotes or escape character
//
// Somewhat convoluted logic around quote and escape chars is
// to enforce logic for escape characters that are also quote characters.
// These escapes can only escape themselves and only in quotes using them
// as delimiters!
bool isQuote = false;
bool isEscape = false;
bool isDelim = mDelimChars.contains( c );
if ( ! isDelim )
{
bool isQuoteChar = mQuoteChar.contains( c );
isQuote = quoted ? c == quoteChar : isQuoteChar;
isEscape = mEscapeChar.contains( c );
if ( isQuoteChar && isEscape ) isEscape = isQuote;
}
// Start or end of quote ...
if ( isQuote )
{
// quote char in quoted field
if ( quoted )
{
// if is also escape and next character is quote, then
// escape the quote..
if ( isEscape && buffer[cp] == quoteChar )
{
field.append( quoteChar );
cp++;
}
// Otherwise end of quoted field
else
{
quoted = false;
ended = true;
}
}
// quote char at start of field .. start of quoted fields
else if ( ! started )
{
field.clear();
quoteChar = c;
quoted = true;
started = true;
}
// Cannot have a quote embedded in a field
else
{
fields.clear();
return RecordInvalid;
//.........这里部分代码省略.........
示例7: encode
//.........这里部分代码省略.........
bool ok = false;
int progress = regExp.cap(1).toInt(&ok);
if(ok && (duration > 0))
{
int newProgress = qRound((static_cast<double>(progress) / static_cast<double>(duration)) * 100.0);
if(newProgress > prevProgress)
{
emit statusUpdated(newProgress);
prevProgress = qMin(newProgress + 2, 99);
}
}
}
else if(!text.isEmpty())
{
emit messageLogged(text);
}
}
}
process.waitForFinished();
if(process.state() != QProcess::NotRunning)
{
process.kill();
process.waitForFinished(-1);
}
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
{
return false;
}
emit messageLogged("\n-------------------------------\n");
args.clear();
args << QDir::toNativeSeparators(outputFile);
if(!metaInfo.title().isEmpty()) args << QString("-meta:title=%1").arg(cleanTag(metaInfo.title()));
if(!metaInfo.artist().isEmpty()) args << QString("-meta:artist=%1").arg(cleanTag(metaInfo.artist()));
if(!metaInfo.album().isEmpty()) args << QString("-meta:album=%1").arg(cleanTag(metaInfo.album()));
if(!metaInfo.genre().isEmpty()) args << QString("-meta:genre=%1").arg(cleanTag(metaInfo.genre()));
if(!metaInfo.comment().isEmpty()) args << QString("-meta:comment=%1").arg(cleanTag(metaInfo.comment()));
if(metaInfo.year()) args << QString("-meta:year=%1").arg(QString::number(metaInfo.year()));
if(metaInfo.position()) args << QString("-meta:track=%1").arg(QString::number(metaInfo.position()));
if(!metaInfo.cover().isEmpty()) args << QString("-add-cover:%1:%2").arg("front", metaInfo.cover());
if(!startProcess(process, m_binary_tag, args))
{
return false;
}
bTimeout = false;
while(process.state() != QProcess::NotRunning)
{
if(*abortFlag)
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
if(!process.bytesAvailable() && process.state() == QProcess::Running)
{
process.kill();
qWarning("NeroAacTag process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
bTimeout = true;
break;
}
while(process.bytesAvailable() > 0)
{
QByteArray line = process.readLine();
QString text = QString::fromUtf8(line.constData()).simplified();
if(!text.isEmpty())
{
emit messageLogged(text);
}
}
}
process.waitForFinished();
if(process.state() != QProcess::NotRunning)
{
process.kill();
process.waitForFinished(-1);
}
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
{
return false;
}
return true;
}
示例8: javaStyleIterator
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
//! [0]
QStringList fonts;
fonts << "Arial" << "Helvetica" << "Times" << "Courier";
//! [0]
//! [1]
for (int i = 0; i < fonts.size(); ++i)
cout << fonts.at(i).toLocal8Bit().constData() << endl;
//! [1]
//! [2]
QStringListIterator javaStyleIterator(fonts);
while (javaStyleIterator.hasNext())
cout << javaStyleIterator.next().toLocal8Bit().constData() << endl;
//! [2]
//! [3]
QStringList::const_iterator constIterator;
for (constIterator = fonts.constBegin(); constIterator != fonts.constEnd();
++constIterator)
cout << (*constIterator).toLocal8Bit().constData() << endl;
//! [3]
//! [4]
QString str = fonts.join(",");
// str == "Arial,Helvetica,Times,Courier"
//! [4]
//! [5] //! [6]
QStringList list;
//! [5]
list = str.split(",");
// list: ["Arial", "Helvetica", "Times", "Courier"]
//! [6]
//! [7]
QStringList monospacedFonts = fonts.filter(QRegExp("Courier|Fixed"));
//! [7]
//! [8]
QStringList files;
files << "$QTDIR/src/moc/moc.y"
<< "$QTDIR/src/moc/moc.l"
<< "$QTDIR/include/qconfig.h";
files.replaceInStrings("$QTDIR", "/usr/lib/qt");
// files: [ "/usr/lib/qt/src/moc/moc.y", ...]
//! [8]
QString str1, str2, str3;
//! [9]
QStringList longerList = (QStringList() << str1 << str2 << str3);
//! [9]
list.clear();
//! [10]
list << "Bill Murray" << "John Doe" << "Bill Clinton";
//! [11]
QStringList result;
//! [11]
result = list.filter("Bill");
// result: ["Bill Murray", "Bill Clinton"]
//! [10]
result.clear();
//! [12]
foreach (const QString &str, list) {
if (str.contains("Bill"))
result += str;
}
//! [12]
list.clear();
//! [13]
list << "alpha" << "beta" << "gamma" << "epsilon";
list.replaceInStrings("a", "o");
// list == ["olpho", "beto", "gommo", "epsilon"]
//! [13]
list.clear();
//! [14]
list << "alpha" << "beta" << "gamma" << "epsilon";
list.replaceInStrings(QRegExp("^a"), "o");
// list == ["olpha", "beta", "gamma", "epsilon"]
//! [14]
list.clear();
//! [15]
list << "Bill Clinton" << "Murray, Bill";
list.replaceInStrings(QRegExp("^(.*), (.*)$"), "\\2 \\1");
// list == ["Bill Clinton", "Bill Murray"]
//! [15]
}
示例9: main
int main( int argc, char** argv )
{
QString defaultContext = "@default";
MetaTranslator fetchedTor;
QCString codec;
QStringList tsFileNames;
bool verbose = FALSE;
bool noObsolete = FALSE;
bool metSomething = FALSE;
int numFiles = 0;
bool standardSyntax = TRUE;
bool metTsFlag = FALSE;
int i;
for ( i = 1; i < argc; i++ )
{
if ( qstrcmp( argv[i], "-ts" ) == 0 )
standardSyntax = FALSE;
}
for ( i = 1; i < argc; i++ )
{
if ( qstrcmp( argv[i], "-help" ) == 0 )
{
printUsage();
return 0;
}
else if ( qstrcmp( argv[i], "-noobsolete" ) == 0 )
{
noObsolete = TRUE;
continue;
}
else if ( qstrcmp( argv[i], "-verbose" ) == 0 )
{
verbose = TRUE;
continue;
}
else if ( qstrcmp( argv[i], "-version" ) == 0 )
{
fprintf( stderr, "lupdate version %s\n", QT_VERSION_STR );
return 0;
}
else if ( qstrcmp( argv[i], "-ts" ) == 0 )
{
metTsFlag = TRUE;
continue;
}
numFiles++;
QString fullText;
if ( !metTsFlag )
{
QFile f( argv[i] );
if ( !f.open( IO_ReadOnly ) )
{
fprintf( stderr, "lupdate error: Cannot open file '%s': %s\n", argv[i], strerror( errno ) );
return 1;
}
QTextStream t( &f );
fullText = t.read();
f.close();
}
QString oldDir = QDir::currentDirPath();
QDir::setCurrent( QFileInfo( argv[i] ).dirPath() );
if ( standardSyntax )
{
fetchedTor = MetaTranslator();
codec.truncate( 0 );
tsFileNames.clear();
QMap<QString, QString> tagMap = proFileTagMap( fullText );
QMap<QString, QString>::Iterator it;
for ( it = tagMap.begin(); it != tagMap.end(); ++it )
{
QStringList toks = QStringList::split( ' ', it.data() );
QStringList::Iterator t;
for ( t = toks.begin(); t != toks.end(); ++t )
{
if ( it.key() == "HEADERS" || it.key() == "SOURCES" )
{
fetchtr_cpp( *t, &fetchedTor, defaultContext, TRUE );
metSomething = TRUE;
}
else if ( it.key() == "INTERFACES" || it.key() == "FORMS" )
{
fetchtr_ui( *t, &fetchedTor, defaultContext, TRUE );
fetchtr_cpp( *t + ".h", &fetchedTor, defaultContext, FALSE );
metSomething = TRUE;
}
else if ( it.key() == "TRANSLATIONS" )
{
//.........这里部分代码省略.........
示例10: getIndexHistory
void DbPlugin::getIndexHistory (BarData *barData, QDateTime &startDate)
{
QString s = "List";
QString s2;
getData(s, s2);
QStringList l = QStringList::split(":", s2, FALSE);
if (! l.count())
return;
QDict<Bar> lookup;
lookup.setAutoDelete(TRUE);
int loop;
int count = 0;
for (loop = 0; loop < (int) l.count(); loop = loop + 2)
{
float weight = l[loop + 1].toFloat();
if (weight == 0)
weight = 1;
loadIndexData(l[loop], lookup, startDate, weight, barRange, barLength);
count++;
}
l.clear();
QDictIterator<Bar> it(lookup);
for (; it.current(); ++it)
{
Bar *r = it.current();
if (r->getOI() == count)
{
r->setOpen(r->getOpen() / count);
r->setHigh(r->getHigh() / count);
r->setLow(r->getLow() / count);
r->setClose(r->getClose() / count);
if (r->getOpen() > r->getHigh())
r->setHigh(r->getOpen());
if (r->getOpen() < r->getLow())
r->setLow(r->getOpen());
if (r->getClose() > r->getHigh())
r->setHigh(r->getClose());
if (r->getClose() < r->getLow())
r->setLow(r->getClose());
r->getDateTimeString(FALSE, s);
l.append(s);
}
else
lookup.remove(it.currentKey());
}
l.sort();
for (loop = l.count() - 1; loop > -1; loop--)
{
Bar *r = lookup.find(l[loop]);
if (r)
{
QDateTime dt;
r->getDate(dt);
Bar tr;
tr.setDate(dt);
tr.setOpen(r->getOpen());
tr.setHigh(r->getHigh());
tr.setLow(r->getLow());
tr.setClose(r->getClose());
barData->prepend(tr);
}
}
}
示例11: sesStart
KateConfigDialog::KateConfigDialog(KateMainWindow *parent, Kate::View *view)
: KDialogBase(KDialogBase::TreeList, i18n("Configure"), KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel | KDialogBase::Help,
KDialogBase::Ok, parent, "configdialog")
{
KConfig *config = KateApp::self()->config();
KWin::setIcons(winId(), KateApp::self()->icon(), KateApp::self()->miniIcon());
actionButton(KDialogBase::Apply)->setEnabled(false);
mainWindow = parent;
setMinimumSize(600, 400);
v = view;
pluginPages.setAutoDelete(false);
editorPages.setAutoDelete(false);
QStringList path;
setShowIconsInTreeList(true);
path.clear();
path << i18n("Application");
setFolderIcon(path, SmallIcon("kate", KIcon::SizeSmall));
path.clear();
// BEGIN General page
path << i18n("Application") << i18n("General");
QFrame *frGeneral = addPage(path, i18n("General Options"), BarIcon("gohome", KIcon::SizeSmall));
QVBoxLayout *lo = new QVBoxLayout(frGeneral);
lo->setSpacing(KDialog::spacingHint());
config->setGroup("General");
// GROUP with the one below: "Appearance"
QButtonGroup *bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("&Appearance"), frGeneral);
lo->addWidget(bgStartup);
// show full path in title
config->setGroup("General");
cb_fullPath = new QCheckBox(i18n("&Show full path in title"), bgStartup);
cb_fullPath->setChecked(mainWindow->viewManager()->getShowFullPath());
QWhatsThis::add(cb_fullPath, i18n("If this option is checked, the full document path will be shown in the window caption."));
connect(cb_fullPath, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
// GROUP with the one below: "Behavior"
bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("&Behavior"), frGeneral);
lo->addWidget(bgStartup);
// sync the konsole ?
cb_syncKonsole = new QCheckBox(bgStartup);
cb_syncKonsole->setText(i18n("Sync &terminal emulator with active document"));
cb_syncKonsole->setChecked(parent->syncKonsole);
QWhatsThis::add(cb_syncKonsole, i18n("If this is checked, the built in Konsole will <code>cd</code> to the directory "
"of the active document when started and whenever the active document changes, "
"if the document is a local file."));
connect(cb_syncKonsole, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
// modified files notification
cb_modNotifications = new QCheckBox(i18n("Wa&rn about files modified by foreign processes"), bgStartup);
cb_modNotifications->setChecked(parent->modNotification);
QWhatsThis::add(cb_modNotifications, i18n("If enabled, when Kate receives focus you will be asked what to do with "
"files that have been modified on the hard disk. If not enabled, you will "
"be asked what to do with a file that has been modified on the hard disk only "
"when that file gains focus inside Kate."));
connect(cb_modNotifications, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
// GROUP with the one below: "Meta-informations"
bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("Meta-Information"), frGeneral);
lo->addWidget(bgStartup);
// save meta infos
cb_saveMetaInfos = new QCheckBox(bgStartup);
cb_saveMetaInfos->setText(i18n("Keep &meta-information past sessions"));
cb_saveMetaInfos->setChecked(KateDocManager::self()->getSaveMetaInfos());
QWhatsThis::add(cb_saveMetaInfos, i18n("Check this if you want document configuration like for example "
"bookmarks to be saved past editor sessions. The configuration will be "
"restored if the document has not changed when reopened."));
connect(cb_saveMetaInfos, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
// meta infos days
QHBox *hbDmf = new QHBox(bgStartup);
hbDmf->setEnabled(KateDocManager::self()->getSaveMetaInfos());
QLabel *lDmf = new QLabel(i18n("&Delete unused meta-information after:"), hbDmf);
sb_daysMetaInfos = new QSpinBox(0, 180, 1, hbDmf);
sb_daysMetaInfos->setSpecialValueText(i18n("(never)"));
sb_daysMetaInfos->setSuffix(i18n(" day(s)"));
sb_daysMetaInfos->setValue(KateDocManager::self()->getDaysMetaInfos());
lDmf->setBuddy(sb_daysMetaInfos);
connect(cb_saveMetaInfos, SIGNAL(toggled(bool)), hbDmf, SLOT(setEnabled(bool)));
connect(sb_daysMetaInfos, SIGNAL(valueChanged(int)), this, SLOT(slotChanged()));
lo->addStretch(1); // :-] works correct without autoadd
// END General page
path.clear();
//.........这里部分代码省略.........
示例12: f
//.........这里部分代码省略.........
<< "industrial2of5" << "matrix2of5" << "code39" << "code39ext" << "interleaved2of5"
<< "japanpost" << "msi" << "planet" << "plessey" << "postnet" << "rationalizedCodabar" << "royalmail";
foreach (const QString& enc, includecheckintextAvail)
resincludecheckintextAvail[enc]=true;
QStringList parseAvail;
parseAvail << "azteccode" << "azteccodecompact" << "codablockf" << "hibccodablockf" << "code128" << "hibccode128" << "code16k" << "code39ext" << "code49"
<< "code93ext" << "codeone" << "datamatrix" << "hibcdatamatrix" << "maxicode" << "micropdf417" << "hibcmicropdf417" << "pdf417" << "hibcpdf417"
<< "pdf417compact" << "posicode" << "qrcode" << "hibcqrcode" << "microqrcode" << "telepen" << "hanxin";
foreach (const QString& enc, parseAvail)
resparseAvail[enc]=true;
QStringList parsefncAvail;
parsefncAvail << "codablockf" << "code128" << "code16k" << "code49" << "code93" << "codeone"
<< "datamatrix" << "posicode" << "qrcode" << "microqrcode";
foreach (const QString& enc, parsefncAvail)
resparsefncAvail[enc]=true;
// Building up the bcFamilyCombo grouping the formats for readablity
ui.bcFamilyCombo->addItem(tr("Select a barcode family")); // to prevent 1st gs call
ui.bcFamilyCombo->insertSeparator(999);
// Building up the bcCombo grouping the formats for readablity
ui.bcCombo->addItem(tr("Select a barcode format")); // to prevent 1st gs call
ui.bcCombo->insertSeparator(999);
QString familyName;
QStringList bcNames;
bcNames << "EAN-13" << "EAN-8" << "UPC-A" << "UPC-E" << "ISBN" << "ISMN" << "ISSN";
familyName = tr("Point of Sale");
familyList.append(familyName);
familyItems.insert(familyName, bcNames);
bcNames.clear();
bcNames << "GS1-14" << "GS1 Data Matrix" << "GS1 QR Code" << "GS1-128" << "ITF-14" << "SSCC-18";
familyName = tr("Supply Chain");
familyList.append(familyName);
familyItems.insert(familyName, bcNames);
bcNames.clear();
bcNames << "QR Code" << "Micro QR Code" << "Data Matrix" << "Aztec Code" << "Compact Aztec Code"
<< "Aztec Runes" << "PDF417" << "Compact PDF417" << "MicroPDF417" << "Han Xin Code";
familyName = tr("Two-dimensional symbols");
familyList.append(familyName);
familyItems.insert(familyName, bcNames);
bcNames.clear();
bcNames << "Code 128" << "Code 39" << "Code 39 Extended" << "Code 93" << "Code 93 Extended"
<< "Interleaved 2 of 5 (ITF)";
familyName = tr("One-dimensional symbols");
familyList.append(familyName);
familyItems.insert(familyName, bcNames);
bcNames.clear();
bcNames << "GS1 DataBar Omnidirectional" << "GS1 DataBar Stacked Omnidirectional"
<< "GS1 DataBar Expanded" << "GS1 DataBar Expanded Stacked" << "GS1 DataBar Truncated"
<< "GS1 DataBar Stacked" << "GS1 DataBar Limited";
familyName = tr("GS1 DataBar family");
familyList.append(familyName);
familyItems.insert(familyName, bcNames);
bcNames.clear();
bcNames << "AusPost 4 State Customer Code" << "Deutsche Post Identcode" << "Deutsche Post Leitcode"
<< "Japan Post 4 State Customer Code" << "Royal Dutch TPG Post KIX"
<< "Royal Mail 4 State Customer Code" << "USPS Intelligent Mail" << "USPS PLANET" << "USPS POSTNET";
familyName = tr("Postal symbols");
示例13: QTabWidget
SummaryView::SummaryView(SummaryViewPrivate* d, QWidget* parent)
:QWidget(parent)
, d_ptr(d)
{
setWindowIcon(QIcon(":/Icons/Logo.png"));
if(QMetaType::type("Waterfall")==QMetaType::UnknownType)
qRegisterMetaType<Waterfall>("Waterfall");
setWindowTitle("Stress Scenario");
setMinimumSize(1024,768);
QStringList HeadersStrings;
d->MainWidget=new QTabWidget(this);
d->StructureTable = new QTableWidget(this);
HeadersStrings
<< "Bond"
<< "Pro rata Group"
<< "Currency"
<< "Original Amount"
<< "Current Amount"
<< "Bond Factor"
<< "Implied CE"
<< "Reference Rate"
<< "Coupon"
<< "Price"
<< "IRR"
<< "WAL"
<< "DM"
<< "Loss"
;
d->StructureTable->setRowCount(0);
d->StructureTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
d->StructureTable->setColumnCount(HeadersStrings.size());
d->StructureTable->setHorizontalHeaderLabels(HeadersStrings);
d->StructureTable->verticalHeader()->setVisible(false);
d->StructureTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
d->StructureTable->setSelectionBehavior(QAbstractItemView::SelectRows);
d->StructureTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
d->StructureTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
d->MainWidget->addTab(d->StructureTable, "Structure");
d->WatStructView = new WaterfallViewer(this);
d->MainWidget->addTab(d->WatStructView, "Waterfall Structure");
d->MtgTable = new QTableWidget(this);
d->MtgTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
d->MtgTable->setColumnCount(8);
d->MtgTable->setRowCount(0);
HeadersStrings.clear();
HeadersStrings
<< "Date"
<< "Outstanding"
<< "Interest"
<< "Principal"
<< "Prepayments"
<< "Accrued Interest"
<< "Loss on Principal"
<< "Loss on Interests";
d->MtgTable->setHorizontalHeaderLabels(HeadersStrings);
d->MtgTable->verticalHeader()->setVisible(false);
d->MtgTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
d->MtgTable->setSelectionBehavior(QAbstractItemView::SelectRows);
d->MtgTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
d->MainWidget->addTab(d->MtgTable, "Mortgages Results");
QWidget* TranchesWidget=new QWidget(this);
QHBoxLayout* TranchesLay=new QHBoxLayout(TranchesWidget);
d->TranchesArea = new QStackedWidget(TranchesWidget);
d->TranchesList = new QListWidget(TranchesWidget);
d->TranchesList->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
connect(d->TranchesList, &QListWidget::currentRowChanged, d->TranchesArea, &QStackedWidget::setCurrentIndex);
TranchesLay->addWidget(d->TranchesList);
TranchesLay->addWidget(d->TranchesArea);
d->MainWidget->addTab(TranchesWidget, "Tranches Results");
QWidget* CallTranchesWidget=new QWidget(this);
QHBoxLayout* CallTranchesLay=new QHBoxLayout(CallTranchesWidget);
d->CallTranchesArea = new QStackedWidget(CallTranchesWidget);
d->CallTranchesList = new QListWidget(CallTranchesWidget);
d->CallTranchesList->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
connect(d->CallTranchesList, &QListWidget::currentRowChanged, d->CallTranchesArea, &QStackedWidget::setCurrentIndex);
CallTranchesLay->addWidget(d->CallTranchesList);
CallTranchesLay->addWidget(d->CallTranchesArea);
d->MainWidget->addTab(CallTranchesWidget, "Call Tranches Results");
d->ExpensesTable = new QTableWidget(this);
d->ExpensesTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
//ExpensesTable->setColumnCount(6);
d->ExpensesTable->setRowCount(0);
HeadersStrings.clear();
/*HeadersStrings
<< "Date"
<< "Senior Expenses"
<< "Senior Fees"
<< "Junior Fees"
<< "Annualized Excess Spread"
<< "WA Cost of Funding";
ExpensesTable->setHorizontalHeaderLabels(HeadersStrings);*/
d->ExpensesTable->verticalHeader()->setVisible(false);
d->ExpensesTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
d->ExpensesTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
//.........这里部分代码省略.........
示例14: setupConstants
//.........这里部分代码省略.........
while (lua_next(L, -2) != 0)
{
extensions.append(QString(lua_tostring(L, -1)));
lua_pop(L, 1);
}
// get language name
lua_getglobal (L, LANGUAGE_FIELD);
langName = QString(lua_tostring(L, -1));
lua_pop(L, 1);
// get grammars
lua_getglobal (L, MAIN_GRAMMAR_FIELD);
mainGrammar = QString(lua_tostring(L, -1));
lua_pop(L, 1);
if (mainGrammar.isEmpty())
throw "No main grammar specified in script \"" + scriptName + "\"";
lua_getglobal (L, SUB_GRAMMARS_FIELD);
lua_pushnil(L);
while (lua_next(L, -2) != 0)
{
subGrammars[QString(lua_tostring(L, -2))] = QString(lua_tostring(L, -1));
lua_pop(L, 1);
}
// get paired tokens (e.g BEGIN/END, {/}, </>)
lua_getglobal (L, PAIRED_TOKENS_FIELD);
lua_pushnil(L);
while (lua_next(L, -2) != 0)
{
pairedTokens.append(QString(lua_tostring(L, -1)));
lua_pop(L, 1);
}
// get selectable tokens (can be selected and moved)
lua_getglobal (L, SELECTABLE_TOKENS_FIELD);
lua_pushnil(L);
while (lua_next(L, -2) != 0)
{
selectableTokens.append(QString(lua_tostring(L, -1)));
lua_pop(L, 1);
}
// get multi-text tokens (can contain more lines of text)
lua_getglobal (L, MULTI_TEXT_TOKENS_FIELD);
lua_pushnil(L);
while (lua_next(L, -2) != 0)
{
multiTextTokens.append(QString(lua_tostring(L, -1)));
lua_pop(L, 1);
}
// get floating tokens
lua_getglobal (L, FLOATING_TOKENS_FIELD);
lua_pushnil(L);
while (lua_next(L, -2) != 0)
{
floatingTokens.append(QString(lua_tostring(L, -1)));
lua_pop(L, 1);
}
// get multiline comment support
lua_getglobal (L, MULTILINE_SUPPORT_FIELD);
multilineSupport = QString(lua_tostring(L, -1));
lua_pop(L, 1);
QStringList tokens;
// get line tokens
lua_getglobal (L, LINE_COMMENT_TOKENS_FIELD);
lua_pushnil(L);
while (lua_next(L, -2) != 0)
{
tokens.append(QString(lua_tostring(L, -1)));
lua_pop(L, 1);
}
commentTokens["line"] = tokens;
tokens.clear();
// get multiline tokens
lua_getglobal (L, MULTILINE_COMMENT_TOKENS_FIELD);
lua_pushnil(L);
while (lua_next(L, -2) != 0)
{
tokens.append(QString(lua_tostring(L, -1)));
lua_pop(L, 1);
}
commentTokens["multiline"] = tokens;
}
示例15: configFile
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setWindowIcon(QIcon(":/icon/train"));
//------------------------------* Drag and Drop *--------------------------------------
this->setAcceptDrops(true);
ui->tabWidget->setAcceptDrops(false);
//----------------------------------* config *-----------------------------------------
visitorMode = false;
if(visitorMode == true)
this->setWindowTitle(QString::fromLocal8Bit("车票管理系统(访客模式)"));
else
this->setWindowTitle(QString::fromLocal8Bit("车票管理系统(管理员模式)"));
this->configInfo << "admin"
<< "admin"
<< "C:\\Users\\Magnolias\\Desktop\\trainExport.txt"
<< "C:\\Users\\Magnolias\\Desktop\\ticketExport.txt"
<< "C:\\Users\\Magnolias\\Desktop\\train.txt"
<< "C:\\Users\\Magnolias\\Desktop\\ticket.txt"
<< "true"
<< "false";
QFile configFile("train.conf");
if(configFile.exists())
{
bool flag = true;
if (!configFile.open(QIODevice::ReadOnly | QIODevice::Text))
{
flag = false;
}
if(flag == true)
{
this->configInfo.clear();
QTextStream in(&configFile);
while(!in.atEnd())
this->configInfo << in.readLine();
configFile.close();
}
}
if(this->configInfo.at(6) == "true")
trainRoutes.setAutoExport(true);
else
trainRoutes.setAutoExport(false);
if(this->configInfo.at(7) == "true")
trainRoutes.setAutoImport(true);
else
trainRoutes.setAutoImport(false);
trainRoutes.setTrainExportPath (this->configInfo.at(2));
trainRoutes.setTicketExportPath(this->configInfo.at(3));
trainRoutes.setTrainImportPath (this->configInfo.at(4));
trainRoutes.setTicketImportPath(this->configInfo.at(5));
//--------------------------------* signal-slots *----------------------------------------
connect(ui->importButton, &QPushButton::clicked, this, &MainWindow::importDialog);
connect(ui->exportButton, &QPushButton::clicked, this, &MainWindow::exportDialog);
connect(ui->refreshButton, &QPushButton::clicked, this, &MainWindow::refreshTable);
connect(ui->removeButton, &QPushButton::clicked, this, &MainWindow::deleteRoute);
connect(ui->sellButton, &QPushButton::clicked, this, &MainWindow::sellTicketDialog);
connect(ui->refundButton, &QPushButton::clicked, this, &MainWindow::refundTicketDialog);
connect(ui->addButton, &QPushButton::clicked, this, &MainWindow::addTrainDialog);
connect(ui->modifyButton, &QPushButton::clicked, this, &MainWindow::modifyTrainDialog);
connect(ui->queryButton, &QPushButton::clicked, this, &MainWindow::queryDialog);
connect(ui->routeQueryButton,&QPushButton::clicked, this, &MainWindow::openRouteQueryDialog);
//-----------------------------------* menu *--------------------------------------------
QMenu *fileMenu = ui->menuBar->addMenu(QString::fromLocal8Bit("文件"));
QMenu *configMenu = ui->menuBar->addMenu(QString::fromLocal8Bit("选项"));
QMenu *helpMenu = ui->menuBar->addMenu(QString::fromLocal8Bit("帮助"));
QAction *configAction = new QAction(QIcon(":/icon/config.png"), QString::fromLocal8Bit("首选项"), this);
connect(configAction, &QAction::triggered, this, &MainWindow::configDialog);
configMenu->addAction(configAction);
QAction *exportAction = new QAction(QIcon(":/icon/export.png"), QString::fromLocal8Bit("导出车次"), this);
connect(exportAction, &QAction::triggered, this, &MainWindow::saveToFile);
fileMenu->addAction(exportAction);
QAction *ticketsExportAction = new QAction(QIcon(":/icon/export.png"), QString::fromLocal8Bit("导出票价"), this);
connect(ticketsExportAction, &QAction::triggered, this, &MainWindow::ticketsSaveToFile);
fileMenu->addAction(ticketsExportAction);
QAction *importAction = new QAction(QIcon(":/icon/import.png"), QString::fromLocal8Bit("导入"), this);
connect(importAction, &QAction::triggered, this, &MainWindow::importDialog);
fileMenu->addAction(importAction);
QAction *onlineImportAction = new QAction(QIcon(":/icon/import.png"), QString::fromLocal8Bit("从网络导入"), this);
connect(onlineImportAction, &QAction::triggered, this, &MainWindow::onlineLoadingDialog);
fileMenu->addAction(onlineImportAction);
QAction *emptyAction = new QAction(QIcon(":/icon/refresh.png"), QString::fromLocal8Bit("清空"), this);
connect(emptyAction, &QAction::triggered, this, &MainWindow::removeAll);
fileMenu->addAction(emptyAction);
QAction *helpAction = new QAction(QIcon(":/icon/help.png"), QString::fromLocal8Bit("用户手册"), this);
connect(helpAction, &QAction::triggered, this, &MainWindow::helpDialog);
//.........这里部分代码省略.........