本文整理汇总了C++中QLatin1String函数的典型用法代码示例。如果您正苦于以下问题:C++ QLatin1String函数的具体用法?C++ QLatin1String怎么用?C++ QLatin1String使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QLatin1String函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gameData
void MainWindow::updateWindowTitle()
{
// setWindowTitle() requires "[*]" (see docs)
const TabData& gameData(m_tabs.at(m_tabBar->currentIndex()));
setWindowTitle(genericTitle(gameData) + QLatin1String("[*]"));
}
示例2: QLatin1String
void QDeclarativeTester::save()
{
QString filename = m_script + QLatin1String(".qml");
QFileInfo filenameInfo(filename);
QDir saveDir = filenameInfo.absoluteDir();
saveDir.mkpath(QLatin1String("."));
QFile file(filename);
file.open(QIODevice::WriteOnly);
QTextStream ts(&file);
ts << "import Qt.VisualTest 4.7\n\n";
ts << "VisualTest {\n";
int imgCount = 0;
QList<KeyEvent> keyevents = m_savedKeyEvents;
QList<MouseEvent> mouseevents = m_savedMouseEvents;
for (int ii = 0; ii < m_savedFrameEvents.count(); ++ii) {
const FrameEvent &fe = m_savedFrameEvents.at(ii);
ts << " Frame {\n";
ts << " msec: " << fe.msec << "\n";
if (!fe.hash.isEmpty()) {
ts << " hash: \"" << fe.hash.toHex() << "\"\n";
} else if (!fe.image.isNull()) {
QString filename = filenameInfo.baseName() + QLatin1String(".") + QString::number(imgCount) + QLatin1String(".png");
fe.image.save(m_script + QLatin1String(".") + QString::number(imgCount) + QLatin1String(".png"));
imgCount++;
ts << " image: \"" << filename << "\"\n";
}
ts << " }\n";
while (!mouseevents.isEmpty() &&
mouseevents.first().msec == fe.msec) {
MouseEvent me = mouseevents.takeFirst();
ts << " Mouse {\n";
ts << " type: " << me.type << "\n";
ts << " button: " << me.button << "\n";
ts << " buttons: " << me.buttons << "\n";
ts << " x: " << me.pos.x() << "; y: " << me.pos.y() << "\n";
ts << " modifiers: " << me.modifiers << "\n";
if (me.destination == ViewPort)
ts << " sendToViewport: true\n";
ts << " }\n";
}
while (!keyevents.isEmpty() &&
keyevents.first().msec == fe.msec) {
KeyEvent ke = keyevents.takeFirst();
ts << " Key {\n";
ts << " type: " << ke.type << "\n";
ts << " key: " << ke.key << "\n";
ts << " modifiers: " << ke.modifiers << "\n";
ts << " text: \"" << ke.text.toUtf8().toHex() << "\"\n";
ts << " autorep: " << (ke.autorep?"true":"false") << "\n";
ts << " count: " << ke.count << "\n";
if (ke.destination == ViewPort)
ts << " sendToViewport: true\n";
ts << " }\n";
}
}
ts << "}\n";
file.close();
}
示例3: Q_ASSERT
/*!
* Parses a APIGateway GetDocumentationVersions response element from \a xml.
*/
void GetDocumentationVersionsResponsePrivate::parseGetDocumentationVersionsResponse(QXmlStreamReader &xml)
{
Q_ASSERT(xml.name() == QLatin1String("GetDocumentationVersionsResponse"));
Q_UNUSED(xml) ///< @todo
}
示例4: openDisplayImpl
// Default Implementation
bool WindowManager::openDisplayImpl(QString *errorMessage)
{
*errorMessage = QLatin1String("Not implemented.");
return false;
}
示例5: sendCloseEventImpl
bool WindowManager::sendCloseEventImpl(const QString &, Q_PID, QString *errorMessage)
{
*errorMessage = QLatin1String("Not implemented.");
return false;
}
示例6: QVariant
/*!
\fn Ebackup::generar_config()
Genera un una copia de los valores de configuracion del programa y los prepara para la compresion.
*/
bool Ebackup::generar_config()
{
preferencias *p = preferencias::getInstancia();
// Obtengo todas las claves
QStringList claves = p->allKeys();
PBProgreso->setRange( 0, ( claves.size() * 2 ) + 2 );
PBProgreso->setValue( 0 );
// Genero los datos concatenando las variables
// Inicio de preferencias
// Cabecera de los datos
datos->append("|->preferencias->");
// bucle que recorre cada valor
QStringList::const_iterator iterador;
for( iterador = claves.constBegin(); iterador != claves.constEnd(); ++iterador )
{
if( !_continuar )
{ return false; }
datos->append( (*iterador).toLocal8Bit().constData() );
PBProgreso->setValue( PBProgreso->value() + 1 );
datos->append( "=" );
// Separador de valores
QVariant v = p->value( (*iterador), QVariant() );
QString result;
switch( v.type() )
{
///////////////////////////////////////////////////////////////////////////
// Copiado desde la clase qsettings de qt
case QVariant::Invalid:
{
result = QLatin1String("@Invalid()");
break;
}
case QVariant::ByteArray:
{
QByteArray a = v.toByteArray();
result = QLatin1String("@ByteArray(");
result += QString::fromLatin1(a.constData(), a.size());
result += QLatin1Char(')');
break;
}
case QVariant::String:
case QVariant::LongLong:
case QVariant::ULongLong:
case QVariant::Int:
case QVariant::UInt:
case QVariant::Bool:
case QVariant::Double:
case QVariant::KeySequence: {
result = v.toString();
if (result.startsWith(QLatin1Char('@')))
result.prepend(QLatin1Char('@'));
break;
}
case QVariant::Rect: {
QRect r = qvariant_cast<QRect>(v);
result += QLatin1String("@Rect(");
result += QString::number(r.x());
result += QLatin1Char(' ');
result += QString::number(r.y());
result += QLatin1Char(' ');
result += QString::number(r.width());
result += QLatin1Char(' ');
result += QString::number(r.height());
result += QLatin1Char(')');
break;
}
case QVariant::Size: {
QSize s = qvariant_cast<QSize>(v);
result += QLatin1String("@Size(");
result += QString::number(s.width());
result += QLatin1Char(' ');
result += QString::number(s.height());
result += QLatin1Char(')');
break;
}
case QVariant::Point: {
QPoint p = qvariant_cast<QPoint>(v);
result += QLatin1String("@Point(");
result += QString::number(p.x());
result += QLatin1Char(' ');
result += QString::number(p.y());
result += QLatin1Char(')');
break;
}
default: {
QByteArray a;
{
QDataStream s(&a, QIODevice::WriteOnly);
s.setVersion(QDataStream::Qt_4_0);
s << v;
}
result = QLatin1String("@Variant(");
result += QString::fromLatin1(a.constData(), a.size());
//.........这里部分代码省略.........
示例7: Q_ASSERT
/*!
* Parses a AppSync DeleteType response element from \a xml.
*/
void DeleteTypeResponsePrivate::parseDeleteTypeResponse(QXmlStreamReader &xml)
{
Q_ASSERT(xml.name() == QLatin1String("DeleteTypeResponse"));
Q_UNUSED(xml) ///< @todo
}
示例8: main
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
int res = 0;
QString appIni;
QHash<QString, QString> args = convertArgs(QCoreApplication::arguments());
if (!args.value("-f").isEmpty()) {
appIni = args.value("-f");
devIni = QFileInfo(appIni).dir().path() + QDir::separator() + "development.ini";
} else {
QString dir = QLatin1String("..") + QDir::separator() + QLatin1String("..") + QDir::separator() + "config" + QDir::separator();
appIni = dir + "application.ini";
devIni = dir + "development.ini";
}
if (!QFile::exists(appIni)) {
usage();
return 1;
}
QSettings appSetting(appIni, QSettings::IniFormat);
QSettings devSetting(devIni, QSettings::IniFormat);
// Default codec
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QString codecName = appSetting.value("InternalEncoding").toString();
if (!codecName.isEmpty()) {
QTextCodec *c = QTextCodec::codecForName(codecName.toLatin1().constData());
if (c) {
codec = c;
}
}
QTextCodec::setCodecForLocale(codec);
defaultTrimMode = devSetting.value("Erb.DefaultTrimMode", "1").toInt();
printf("Erb.DefaultTrimMode: %d\n", defaultTrimMode);
QDir viewDir(".");
if (!args.value("-v").isEmpty()) {
viewDir.setPath(args.value("-v"));
}
if (!viewDir.exists()) {
usage();
return 1;
}
QDir outputDir(DEFAULT_OUTPUT_DIR);
if (!args.value("-d").isEmpty()) {
outputDir.setPath(args.value("-d"));
}
if (outputDir.exists()) {
if (outputDir.path() != ".") {
printf(" exists %s\n", qPrintable(outputDir.path()));
}
} else {
if (outputDir.mkpath(".")) {
printf(" created %s\n", qPrintable(outputDir.path()));
} else {
usage();
return 1;
}
}
bool createProFile = (args.contains("-p") || !args.contains("-P"));
ViewConverter conv(viewDir, outputDir, createProFile);
QString templateSystem = devSetting.value("TemplateSystem").toString();
if (templateSystem.isEmpty()) {
templateSystem = appSetting.value("TemplateSystem", "Erb").toString();
}
res = conv.convertView(templateSystem);
return res;
}
示例9: saveToXMI
/**
* Saves the widget to the "boxwidget" XMI element.
* Note: For loading from XMI, the inherited parent method is used.
*/
void BoxWidget::saveToXMI(QDomDocument& qDoc, QDomElement& qElement)
{
QDomElement boxElement = qDoc.createElement(QLatin1String("boxwidget"));
UMLWidget::saveToXMI(qDoc, boxElement);
qElement.appendChild(boxElement);
}
示例10: tableColumns
bool SyncJournalDb::updateMetadataTableStructure()
{
QStringList columns = tableColumns("metadata");
bool re = true;
// check if the file_id column is there and create it if not
if( !checkConnect() ) {
return false;
}
if( columns.indexOf(QLatin1String("fileid")) == -1 ) {
SqlQuery query(_db);
query.prepare("ALTER TABLE metadata ADD COLUMN fileid VARCHAR(128);");
if( !query.exec() ) {
sqlFail("updateMetadataTableStructure: Add column fileid", query);
re = false;
}
query.prepare("CREATE INDEX metadata_file_id ON metadata(fileid);");
if( ! query.exec() ) {
sqlFail("updateMetadataTableStructure: create index fileid", query);
re = false;
}
commitInternal("update database structure: add fileid col");
}
if( columns.indexOf(QLatin1String("remotePerm")) == -1 ) {
SqlQuery query(_db);
query.prepare("ALTER TABLE metadata ADD COLUMN remotePerm VARCHAR(128);");
if( !query.exec()) {
sqlFail("updateMetadataTableStructure: add column remotePerm", query);
re = false;
}
commitInternal("update database structure (remotePerm)");
}
if( columns.indexOf(QLatin1String("filesize")) == -1 )
{
SqlQuery query(_db);
query.prepare("ALTER TABLE metadata ADD COLUMN filesize BIGINT;");
if( !query.exec()) {
sqlFail("updateDatabaseStructure: add column filesize", query);
re = false;
}
commitInternal("update database structure: add filesize col");
}
if( 1 ) {
SqlQuery query(_db);
query.prepare("CREATE INDEX IF NOT EXISTS metadata_inode ON metadata(inode);");
if( !query.exec()) {
sqlFail("updateMetadataTableStructure: create index inode", query);
re = false;
}
commitInternal("update database structure: add inode index");
}
if( 1 ) {
SqlQuery query(_db);
query.prepare("CREATE INDEX IF NOT EXISTS metadata_path ON metadata(path);");
if( !query.exec()) {
sqlFail("updateMetadataTableStructure: create index path", query);
re = false;
}
commitInternal("update database structure: add path index");
}
if( columns.indexOf(QLatin1String("ignoredChildrenRemote")) == -1 ) {
SqlQuery query(_db);
query.prepare("ALTER TABLE metadata ADD COLUMN ignoredChildrenRemote INT;");
if( !query.exec()) {
sqlFail("updateMetadataTableStructure: add ignoredChildrenRemote column", query);
re = false;
}
commitInternal("update database structure: add ignoredChildrenRemote col");
}
return re;
}
示例11: QStringList
QStringList QM3uPlaylistPlugin::keys() const
{
return QStringList() << QLatin1String("m3u");
}
示例12: qDebug
//.........这里部分代码省略.........
createQuery.bindValue(3, MIRALL_VERSION_PATCH);
createQuery.bindValue(4, MIRALL_VERSION_BUILD);
createQuery.bindValue(5, major);
createQuery.bindValue(6, minor);
createQuery.bindValue(7, patch);
if (!createQuery.exec()) {
return sqlFail("Update version", createQuery);
}
}
}
commitInternal("checkConnect");
bool rc = updateDatabaseStructure();
if( !rc ) {
qDebug() << "WARN: Failed to update the database structure!";
}
/*
* If we are upgrading from a client version older than 1.5,
* we cannot read from the database because we need to fetch the files id and etags.
*
* If 1.8.0 caused missing data in the local tree, so we also don't read from DB
* to get back the files that were gone.
* In 1.8.1 we had a fix to re-get the data, but this one here is better
*/
if (forceRemoteDiscovery) {
forceRemoteDiscoveryNextSyncLocked();
}
_getFileRecordQuery.reset(new SqlQuery(_db));
_getFileRecordQuery->prepare("SELECT path, inode, uid, gid, mode, modtime, type, md5, fileid, remotePerm, filesize, ignoredChildrenRemote FROM "
"metadata WHERE phash=?1" );
_setFileRecordQuery.reset(new SqlQuery(_db) );
_setFileRecordQuery->prepare("INSERT OR REPLACE INTO metadata "
"(phash, pathlen, path, inode, uid, gid, mode, modtime, type, md5, fileid, remotePerm, filesize, ignoredChildrenRemote) "
"VALUES (?1 , ?2, ?3 , ?4 , ?5 , ?6 , ?7, ?8 , ?9 , ?10, ?11, ?12, ?13, ?14);" );
_getDownloadInfoQuery.reset(new SqlQuery(_db) );
_getDownloadInfoQuery->prepare( "SELECT tmpfile, etag, errorcount FROM "
"downloadinfo WHERE path=?1" );
_setDownloadInfoQuery.reset(new SqlQuery(_db) );
_setDownloadInfoQuery->prepare( "INSERT OR REPLACE INTO downloadinfo "
"(path, tmpfile, etag, errorcount) "
"VALUES ( ?1 , ?2, ?3, ?4 )" );
_deleteDownloadInfoQuery.reset(new SqlQuery(_db) );
_deleteDownloadInfoQuery->prepare( "DELETE FROM downloadinfo WHERE path=?1" );
_getUploadInfoQuery.reset(new SqlQuery(_db));
_getUploadInfoQuery->prepare( "SELECT chunk, transferid, errorcount, size, modtime FROM "
"uploadinfo WHERE path=?1" );
_setUploadInfoQuery.reset(new SqlQuery(_db));
_setUploadInfoQuery->prepare( "INSERT OR REPLACE INTO uploadinfo "
"(path, chunk, transferid, errorcount, size, modtime) "
"VALUES ( ?1 , ?2, ?3 , ?4 , ?5, ?6 )");
_deleteUploadInfoQuery.reset(new SqlQuery(_db));
_deleteUploadInfoQuery->prepare("DELETE FROM uploadinfo WHERE path=?1" );
_deleteFileRecordPhash.reset(new SqlQuery(_db));
_deleteFileRecordPhash->prepare("DELETE FROM metadata WHERE phash=?1");
_deleteFileRecordRecursively.reset(new SqlQuery(_db));
_deleteFileRecordRecursively->prepare("DELETE FROM metadata WHERE path LIKE(?||'/%')");
QString sql( "SELECT lastTryEtag, lastTryModtime, retrycount, errorstring, lastTryTime, ignoreDuration "
"FROM blacklist WHERE path=?1");
if( Utility::fsCasePreserving() ) {
// if the file system is case preserving we have to check the blacklist
// case insensitively
sql += QLatin1String(" COLLATE NOCASE");
}
_getErrorBlacklistQuery.reset(new SqlQuery(_db));
_getErrorBlacklistQuery->prepare(sql);
_setErrorBlacklistQuery.reset(new SqlQuery(_db));
_setErrorBlacklistQuery->prepare("INSERT OR REPLACE INTO blacklist "
"(path, lastTryEtag, lastTryModtime, retrycount, errorstring, lastTryTime, ignoreDuration) "
"VALUES ( ?1, ?2, ?3, ?4, ?5, ?6, ?7)");
_getSelectiveSyncListQuery.reset(new SqlQuery(_db));
_getSelectiveSyncListQuery->prepare("SELECT path FROM selectivesync WHERE type=?1");
// don't start a new transaction now
commitInternal(QString("checkConnect End"), false);
// Hide 'em all!
FileSystem::setFileHidden(databaseFilePath(), true);
FileSystem::setFileHidden(databaseFilePath() + "-wal", true);
FileSystem::setFileHidden(databaseFilePath() + "-shm", true);
FileSystem::setFileHidden(databaseFilePath() + "-journal", true);
return rc;
}
示例13: QProxyStyle
FlexStyle::FlexStyle(QStyle* style) : QProxyStyle(style), impl(new FlexStyleImpl)
{
setObjectName(QLatin1String("FlexStyle"));
}
示例14: QLatin1String
QString Control::version() {
return QLatin1String(ABOUT_VERSION);
}
示例15: clearInvalidLines
//.........这里部分代码省略.........
// If this column has been empty so far then initiallize it
// for possible types
if ( isEmpty[i] )
{
isEmpty[i] = false;
couldBeInt[i] = true;
couldBeLongLong[i] = true;
couldBeDouble[i] = true;
}
if ( ! mDetectTypes )
{
continue;
}
// Now test for still valid possible types for the field
// Types are possible until first record which cannot be parsed
if ( couldBeInt[i] )
{
value.toInt( &couldBeInt[i] );
}
if ( couldBeLongLong[i] && ! couldBeInt[i] )
{
value.toLongLong( &couldBeLongLong[i] );
}
if ( couldBeDouble[i] && ! couldBeLongLong[i] )
{
if ( ! mDecimalPoint.isEmpty() )
{
value.replace( mDecimalPoint, QLatin1String( "." ) );
}
value.toDouble( &couldBeDouble[i] );
}
}
}
// Now create the attribute fields. Field types are integer by preference,
// failing that double, failing that text.
QStringList fieldNames = mFile->fieldNames();
mFieldCount = fieldNames.size();
attributeColumns.clear();
attributeFields.clear();
QString csvtMessage;
QStringList csvtTypes = readCsvtFieldTypes( mFile->fileName(), &csvtMessage );
for ( int i = 0; i < fieldNames.size(); i++ )
{
// Skip over WKT field ... don't want to display in attribute table
if ( i == mWktFieldIndex )
continue;
// Add the field index lookup for the column
attributeColumns.append( i );
QVariant::Type fieldType = QVariant::String;
QString typeName = QStringLiteral( "text" );
if ( i < csvtTypes.size() )
{
typeName = csvtTypes[i];
}
else if ( mDetectTypes && i < couldBeInt.size() )