本文整理汇总了C++中QByteArray::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ QByteArray::isNull方法的具体用法?C++ QByteArray::isNull怎么用?C++ QByteArray::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QByteArray
的用法示例。
在下文中一共展示了QByteArray::isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testSetOrientationTag
//we add the case to test dump function by creating medatedata object with file name from other team.
void ut_metadata::testSetOrientationTag()
{
QVERIFY(QuillMetadata::canRead("/usr/share/libquillmetadata-tests/images/exif.jpg"));
metadata->setEntry(QuillMetadata::Tag_Orientation, QVariant(short(7)));
QByteArray result = metadata->dump(QuillMetadata::ExifFormat);
QVERIFY(!result.isNull());
}
示例2: exec
QByteArray QWget::exec(QUrl url, QByteArray postData)
{
QNetworkAccessManager * manager = network_manager();
manager->setProxy(_proxy);
connect(manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(onFinished(QNetworkReply*)));
QNetworkRequest * nr = new QNetworkRequest(url);
//nr->setRawHeader("User-Agent","Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1");
nr->setRawHeader("User-Agent","Opera/9.0");
qDebug() << url;
finished = false;
if(postData.isNull())
manager->get(*nr);
else
manager->post(*nr,postData);
while(!finished)
{
QCoreApplication::instance()->processEvents();
#ifdef WIN32
Sleep(50);
#else
usleep(50000);
#endif
}
delete nr;
QCoreApplication::instance()->processEvents();
//qDebug() << "Ans: " << ans;
// delete nr;
return ans;
return QByteArray();
}
示例3: serialize
void Serializer::serialize( const QVariant& v, QIODevice* io, bool* ok )
{
Q_ASSERT( io );
if (!io->isOpen()) {
if (!io->open(QIODevice::WriteOnly)) {
if ( ok != 0 )
*ok = false;
qCritical ("Error opening device");
return;
}
}
if (!io->isWritable()) {
if (ok != 0)
*ok = false;
qCritical ("Device is not readable");
io->close();
return;
}
const QByteArray str = serialize( v );
if ( !str.isNull() ) {
QDataStream stream( io );
stream << str;
} else {
if ( ok )
*ok = false;
}
}
示例4: loadSettings
void EditorWindow::loadSettings()
{
QSettings settings;
/* Main Window location */
settings.beginGroup("EditorWindow");
QSize size = settings.value("size").toSize();
QPoint pos = settings.value("position").toPoint();
QByteArray state = settings.value("state").toByteArray();
/* Recent docs/projects */
recentDocs = settings.value("recentDocs", QStringList()).toStringList();
recentProjects = settings.value("recentProjects",
QStringList()).toStringList();
settings.endGroup();
if(!(size.isNull() || pos.isNull() || state.isNull()))
{
resize(size);
move(pos);
restoreState(state);
}
}
示例5: ReadSettings
void EditTOC::ReadSettings()
{
SettingsStore settings;
settings.beginGroup(SETTINGS_GROUP);
// The size of the window and it's full screen status
QByteArray geometry = settings.value("geometry").toByteArray();
if (!geometry.isNull()) {
restoreGeometry(geometry);
}
// Column widths
int size = settings.beginReadArray("column_data");
for (int column = 0; column < size && column < ui.TOCTree->header()->count(); column++) {
settings.setArrayIndex(column);
int column_width = settings.value("width").toInt();
if (column_width) {
ui.TOCTree->setColumnWidth(column, column_width);
}
}
settings.endArray();
settings.endGroup();
}
示例6: xml
void
PhotosEngine::resultFlickr( const KUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e )
{
if( !m_flickrUrls.contains( url ) )
return;
DEBUG_BLOCK
m_flickrUrls.remove( url );
if( e.code != QNetworkReply::NoError )
{
setData( "photos", "message", i18n( "Unable to retrieve from Flickr.com: %1", e.description ) );
debug() << "Unable to retrieve Flickr information:" << e.description;
return;
}
if( data.isNull() )
{
debug() << "Got bad xml!";
return;
}
removeAllData( "photos" );
QXmlStreamReader xml( data );
PhotosInfo::List photosInfo = photosListFromXml( xml );
debug() << "got" << photosInfo.size() << "photo info";
setData( "photos", "artist", m_artist );
setData( "photos", "data", qVariantFromValue( photosInfo ) );
}
示例7: key
QByteArray
StarDictDictionaryManager::poNextWord(QByteArray searchWord, int* iCurrent)
{
// the input can be:
// (word,iCurrent),read word,write iNext to iCurrent,and return next word. used by TopWin::NextCallback();
// (NULL,iCurrent),read iCurrent,write iNext to iCurrent,and return next word. used by AppCore::ListWords();
QByteArray currentWord = NULL;
QVector<Dictionary *>::size_type iCurrentLib = 0;
const char *word;
for (QVector<Dictionary *>::size_type iLib = 0; iLib < d->dictionaryList.size(); ++iLib)
{
if (!searchWord.isEmpty())
iCurrent[iLib] = d->dictionaryList.at(iLib)->lookup(searchWord);
if (iCurrent[iLib] == invalidIndex)
continue;
if (iCurrent[iLib] >= articleCount(iLib) || iCurrent[iLib] < 0)
continue;
if (currentWord.isNull())
{
currentWord = key(iCurrent[iLib], iLib);
iCurrentLib = iLib;
}
else
{
word = key(iCurrent[iLib], iLib);
if (stardictStringCompare(currentWord, word) > 0 )
{
currentWord = word;
iCurrentLib = iLib;
}
}
}
if (!currentWord.isEmpty())
{
iCurrent[iCurrentLib]++;
for (QVector<Dictionary *>::size_type iLib = 0; iLib < d->dictionaryList.size(); ++iLib)
{
if (iLib == iCurrentLib)
continue;
if (iCurrent[iLib] == invalidIndex)
continue;
if ( iCurrent[iLib] >= articleCount(iLib) || iCurrent[iLib] < 0)
continue;
if (strcmp(currentWord, key(iCurrent[iLib], iLib)) == 0 )
iCurrent[iLib]++;
}
currentWord = poCurrentWord(iCurrent);
}
return currentWord;
}
示例8: getSizeWithDU
qlonglong ddMainWindow::getSizeWithDU(const QString &folder)
{
qlonglong folderSize = 0;
// -------------использем утилиту du для получения размера--------------------
QProcess* adb = new QProcess(this);
QString cmd = "adb";
QStringList argAdb;
argAdb << "shell" << "du" <<"-Lcs" << folder;
adb->start(cmd, argAdb);
if (!adb->waitForFinished())
return 0;
QByteArray res = adb->readLine();
while (!res.isNull())
{
QString strLine = res;
if (strLine.contains("total"))
{
QStringList list = strLine.split("\t");
folderSize = list.at(0).toLongLong();
break;
}
res = adb->readLine();
}
return folderSize;
}
示例9: systemEnvironment
void tst_QProcessEnvironment::systemEnvironment()
{
static const char envname[] = "THIS_ENVIRONMENT_VARIABLE_HOPEFULLY_DOESNT_EXIST";
QByteArray path = qgetenv("PATH");
QByteArray nonexistant = qgetenv(envname);
QProcessEnvironment system = QProcessEnvironment::systemEnvironment();
QVERIFY(nonexistant.isNull());
#ifdef Q_WS_WINCE
// Windows CE has no environment
QVERIFY(path.isEmpty());
QVERIFY(!system.contains("PATH"));
QVERIFY(system.isEmpty());
#else
// all other system have environments
if (path.isEmpty())
QFAIL("Could not find the PATH environment variable -- please correct the test environment");
QVERIFY(system.contains("PATH"));
QCOMPARE(system.value("PATH"), QString::fromLocal8Bit(path));
QVERIFY(!system.contains(envname));
# ifdef Q_OS_WIN
// check case-insensitive too
QVERIFY(system.contains("path"));
QCOMPARE(system.value("path"), QString::fromLocal8Bit(path));
QVERIFY(!system.contains(QString(envname).toLower()));
# endif
#endif
}
示例10: hash
/* calculate request-digest/response-digest as per HTTP Digest spec */
static QByteArray digestMd5Response(
const QByteArray &alg,
const QByteArray &userName,
const QByteArray &realm,
const QByteArray &password,
const QByteArray &nonce, /* nonce from server */
const QByteArray &nonceCount, /* 8 hex digits */
const QByteArray &cNonce, /* client nonce */
const QByteArray &qop, /* qop-value: "", "auth", "auth-int" */
const QByteArray &method, /* method from the request */
const QByteArray &digestUri, /* requested URL */
const QByteArray &hEntity /* H(entity body) if qop="auth-int" */
)
{
QCryptographicHash hash(QCryptographicHash::Md5);
hash.addData(userName);
hash.addData(":", 1);
hash.addData(realm);
hash.addData(":", 1);
hash.addData(password);
QByteArray ha1 = hash.result();
if (alg.toLower() == "md5-sess") {
hash.reset();
hash.addData(ha1);
hash.addData(":", 1);
hash.addData(nonce);
hash.addData(":", 1);
hash.addData(cNonce);
ha1 = hash.result();
};
ha1 = ha1.toHex();
// calculate H(A2)
hash.reset();
hash.addData(method);
hash.addData(":", 1);
hash.addData(digestUri);
if (qop.toLower() == "auth-int") {
hash.addData(":", 1);
hash.addData(hEntity);
}
QByteArray ha2hex = hash.result().toHex();
// calculate response
hash.reset();
hash.addData(ha1);
hash.addData(":", 1);
hash.addData(nonce);
hash.addData(":", 1);
if (!qop.isNull()) {
hash.addData(nonceCount);
hash.addData(":", 1);
hash.addData(cNonce);
hash.addData(":", 1);
hash.addData(qop);
hash.addData(":", 1);
}
hash.addData(ha2hex);
return hash.result().toHex();
}
示例11: addRawHeader
/*!
Sets the raw header \a key to be of value \a value.
If \a key was previously set, it is added multiply.
*/
void TInternetMessageHeader::addRawHeader(const QByteArray &key, const QByteArray &value)
{
if (key.isEmpty() || value.isNull())
return;
headerPairList << RawHeaderPair(key, value);
}
示例12: Skip
bool ZeroCopyInputStreamQIODevice::Skip(int count)
{
if (this->pos != this->buffer + this->nbLastRead) // There is still some data into the buffer. See 'BackUp(..)'.
{
if (this->pos + count > this->buffer + this->nbLastRead)
{
count -= (this->buffer + this->nbLastRead) - this->pos;
this->pos = this->buffer + this->nbLastRead;
}
else
{
this->pos += count;
count = 0;
}
}
if (this->device->bytesAvailable() == 0)
return false;
if (count == 0)
return true;
QByteArray data = this->device->read(count);
if (data.isNull())
return false;
this->bytesRead += data.size();
return this->device->bytesAvailable() > 0;
}
示例13: SIGNAL
ByteArrayReply::ByteArrayReply(const QNetworkRequest &request,
const QByteArray &ba, const QString& mimeType,
QObject *parent) :
QNetworkReply(parent),
origLen(ba.size()),
data(ba)
{
setRequest(request);
setOpenMode(QIODevice::ReadOnly);
if (ba.isNull()) {
setError(QNetworkReply::ContentNotFoundError, "Not found");
QTimer::singleShot(0, this, SIGNAL(metaDataChanged()));
QTimer::singleShot(0, this, SLOT(signalError()));
QTimer::singleShot(0, this, SIGNAL(finished()));
} else {
if (mimeType.isEmpty()) {
setHeader(QNetworkRequest::ContentTypeHeader, "application/octet-stream");
} else {
setHeader(QNetworkRequest::ContentTypeHeader, mimeType);
}
setHeader(QNetworkRequest::ContentLengthHeader, QByteArray::number(origLen));
QTimer::singleShot(0, this, SIGNAL(metaDataChanged()));
QTimer::singleShot(0, this, SIGNAL(readyRead()));
}
}
示例14: setHttpStatusCode
void QCustomNetworkReply::setHttpStatusCode( int code, const QByteArray &statusText )
{
setAttribute( QNetworkRequest::HttpStatusCodeAttribute, code );
if ( statusText.isNull() )
return;
setAttribute( QNetworkRequest::HttpReasonPhraseAttribute, statusText );
}
示例15: contentChecksumType
QByteArray contentChecksumType()
{
static QByteArray type = qgetenv("OWNCLOUD_CONTENT_CHECKSUM_TYPE");
if (!type.isNull()) { // can set to "" to disable checksumming
return type;
}
return "SHA1";
}