当前位置: 首页>>代码示例>>C++>>正文


C++ QByteArray::isNull方法代码示例

本文整理汇总了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());
}
开发者ID:martinjones,项目名称:quillmetadata,代码行数:8,代码来源:ut_metadata.cpp

示例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();
}
开发者ID:trousev,项目名称:qwget,代码行数:31,代码来源:qwget.cpp

示例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;
  }
}
开发者ID:3eggs,项目名称:push-notifications-sdk,代码行数:29,代码来源:serializer.cpp

示例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);
    }

}
开发者ID:4nykey,项目名称:rockbox,代码行数:26,代码来源:editorwindow.cpp

示例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();
}
开发者ID:Doug0212,项目名称:Sigil,代码行数:26,代码来源:EditTOC.cpp

示例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 ) );
}
开发者ID:cancamilo,项目名称:amarok,代码行数:28,代码来源:PhotosEngine.cpp

示例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;
}
开发者ID:KDE,项目名称:mula,代码行数:60,代码来源:stardictdictionarymanager.cpp

示例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;


}
开发者ID:vohulg,项目名称:kaltas_src,代码行数:30,代码来源:ddmainwindow.cpp

示例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
}
开发者ID:maxxant,项目名称:qt,代码行数:33,代码来源:tst_qprocessenvironment.cpp

示例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();
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:61,代码来源:qauthenticator.cpp

示例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);
}
开发者ID:tienvx,项目名称:treefrog-framework,代码行数:11,代码来源:tinternetmessageheader.cpp

示例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;
}
开发者ID:Fafou,项目名称:D-LAN,代码行数:28,代码来源:ZeroCopyStreamQIODevice.cpp

示例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()));
	}
}
开发者ID:akatov,项目名称:psi,代码行数:26,代码来源:bytearrayreply.cpp

示例14: setHttpStatusCode

void QCustomNetworkReply::setHttpStatusCode( int code, const QByteArray &statusText )
{
    setAttribute( QNetworkRequest::HttpStatusCodeAttribute, code );
    if ( statusText.isNull() )
        return;

    setAttribute( QNetworkRequest::HttpReasonPhraseAttribute, statusText );
}
开发者ID:smurfy,项目名称:fahrplan,代码行数:8,代码来源:qcustomnetworkreply.cpp

示例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";
}
开发者ID:bbxfork,项目名称:client,代码行数:8,代码来源:checksums.cpp


注:本文中的QByteArray::isNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。