本文整理汇总了C++中QVariantList::takeAt方法的典型用法代码示例。如果您正苦于以下问题:C++ QVariantList::takeAt方法的具体用法?C++ QVariantList::takeAt怎么用?C++ QVariantList::takeAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVariantList
的用法示例。
在下文中一共展示了QVariantList::takeAt方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: postEvent
EventData Communicator::postEvent(const QString &subject, const QString &event,
const Security &security, const QDateTime &dt,
const EventProperties &props,
const QString &journal)
{
QVariantList params = authParams();
if (params.size() == 0)
EventData();
// Modify params by adding the item id.
QMap<QString, QVariant> param = params.takeAt(0).toMap();
// Make sure we use utf-8 encoded strings in response.
param["ver"] = 1;
param["subject"] = subject;
param["event"] = event;
param["year"] = dt.date().year();
param["mon"] = dt.date().month();
param["day"] = dt.date().day();
param["hour"] = dt.time().hour();
param["min"] = dt.time().minute();
param["usejournal"] = journal;
param["props"] = props.data();
param["security"] = security.selectedMajorLJName();
if (security.type() == Security::UseMask) {
param["allowmask"] = security.mask();
}
params.push_back(param);
request("LJ.XMLRPC.postevent", params);
std::auto_ptr<QBuffer> buffer(m_responses.take(m_currentRequestId));
QByteArray buf = buffer->buffer();
return EventData(buf);
}
示例2: fixId
// see the creation of the containment
QVariantList PlasmaContainment::fixId( QVariantList args )
{ // first two are from plasma (2nd is id), 3rd is our wanted id
assert( args.count() >= 3 );
unsigned int id = args.takeAt( 2 ).toInt();
args[ 1 ] = id;
return args;
}
示例3: getDayCount
QVariantList Communicator::getDayCount()
{
QVariantList result;
QVariantList params = authParams();
if (params.size() == 0)
return result;
QMap<QString, QVariant> param = params.takeAt(0).toMap();
param["ver"] = 1;
params.push_back(param);
request("LJ.XMLRPC.getdaycounts", params);
std::auto_ptr<QBuffer> buffer(m_responses.take(m_currentRequestId));
QByteArray buf = buffer->buffer();
xmlrpc::Response response;
QVariant responceData = response.parse(buf);
if (response.isValid()) {
QMap<QString, QVariant> data = responceData.toMap();
result = data["daycounts"].toList();
}
return result;
}
示例4: getDayEvents
Events Communicator::getDayEvents(const QString &dateStr)
{
QVariantList params = authParams();
if (params.size() == 0)
return Events();
QDate date = QDate::fromString(dateStr, "yyyy-MM-dd");
if (!date.isValid())
return Events();
// Modify params by adding the item id.
QMap<QString, QVariant> param = params.takeAt(0).toMap();
// Make sure we use utf-8 encoded strings in response.
param["ver"] = 1;
param["prefersubject"] = 0;
param["selecttype"] = "day";
param["year"] = date.year();
param["month"] = date.month();
param["day"] = date.day();
params.push_back(param);
request("LJ.XMLRPC.getevents", params);
std::auto_ptr<QBuffer> buffer(m_responses.take(m_currentRequestId));
QByteArray buf = buffer->buffer();
Events events(buf);
return events;
}
示例5: getEvents
Events Communicator::getEvents(int howmany, const QString &beforedate)
{
QVariantList params = authParams();
if (params.size() == 0)
return Events();
// Modify params by adding the item id.
QMap<QString, QVariant> param = params.takeAt(0).toMap();
// Make sure we use utf-8 encoded strings in response.
param["ver"] = 1;
param["prefersubject"] = 0;
param["selecttype"] = "lastn";
param["howmany"] = howmany;
if (!beforedate.isEmpty()) {
param["beforedate"] = beforedate;
}
params.push_back(param);
request("LJ.XMLRPC.getevents", params);
std::auto_ptr<QBuffer> buffer(m_responses.take(m_currentRequestId));
QByteArray buf = buffer->buffer();
Events events(buf);
return events;
}
示例6: authParams
QMap<QString, QVariant> Communicator::getComments(int postid)
{
QMap<QString, QVariant> result;
QVariantList params = authParams();
if (params.size() == 0)
return result;
// Modify params by adding the item id.
QMap<QString, QVariant> param = params.takeAt(0).toMap();
param["ditemid"] = postid;
params.push_back(param);
request("LJ.XMLRPC.getcomments", params);
std::auto_ptr<QBuffer> buffer(m_responses.take(m_currentRequestId));
QByteArray buf = buffer->buffer();
xmlrpc::Response response;
QVariant responceData = response.parse(buf);
if (response.isValid()) {
result = responceData.toMap();
}
return result;
}
示例7: postQuestion
void CountryByFlag::postQuestion( QObject *gameObject )
{
/**
* Find a random placemark
*/
Q_ASSERT_X( d->m_countryNames, "CountryByFlag::postQuestion",
"CountryByFlagPrivate::m_countryNames is NULL" );
QVector<GeoDataPlacemark*> countryPlacemarks = d->m_countryNames->placemarkList();
uint randomSeed = uint(QTime::currentTime().msec());
qsrand( randomSeed );
bool found = false;
GeoDataPlacemark *placemark = 0;
QVariantList answerOptions;
QString flagPath;
while ( !found ) {
int randomIndex = qrand()%countryPlacemarks.size();
placemark = countryPlacemarks[randomIndex];
if ( !d->m_continentsAndOceans.contains(placemark->name(), Qt::CaseSensitive) ) {
flagPath = MarbleDirs::path( QString("flags/flag_%1.svg").arg(placemark->countryCode().toLower()) );
QImage flag = QFile::exists( flagPath ) ? QImage( flagPath ) : QImage();
if ( !flag.isNull() ) {
flagPath = QString("%1flag_%2.svg").arg("../../../data/flags/").arg(placemark->countryCode().toLower());
found = true;
}
}
}
answerOptions << placemark->name()
<< countryPlacemarks[qrand()%countryPlacemarks.size()]->name()
<< countryPlacemarks[qrand()%countryPlacemarks.size()]->name()
<< countryPlacemarks[qrand()%countryPlacemarks.size()]->name();
// Randomize the options in the list answerOptions
for ( int i = 0; i < answerOptions.size(); ++i ) {
QVariant option = answerOptions.takeAt( qrand()%answerOptions.size() );
answerOptions.append( option );
}
if ( gameObject ) {
QMetaObject::invokeMethod( gameObject, "countryByFlagQuestion",
Q_ARG(QVariant, QVariant::fromValue(answerOptions)),
Q_ARG(QVariant, QVariant::fromValue(flagPath)),
Q_ARG(QVariant, QVariant::fromValue(placemark->name())) );
}
}
示例8: syncitems
SyncItems Communicator::syncitems(const QString &lastsync)
{
QVariantList params = authParams();
if (params.size() == 0)
return SyncItems();
if (!lastsync.isEmpty()) {
// Modify params by adding the lastsync time.
QMap<QString, QVariant> param = params.takeAt(0).toMap();
param["lastsync"] = lastsync;
params.push_back(param);
}
request("LJ.XMLRPC.syncitems", params);
std::auto_ptr<QBuffer> buffer(m_responses.take(m_currentRequestId));
QByteArray buf = buffer->buffer();
SyncItems items(buf);
return items;
}
示例9: login
UserInfo Communicator::login()
{
QVariantList params = authParams();
if (params.size() == 0)
return UserInfo();
QMap<QString, QVariant> param = params.takeAt(0).toMap();
param["getpickwurls"] = "1";
param["getpickws"] = "1";
param["getmoods"] = "1";
params.push_back(param);
// Send request to login.
request("LJ.XMLRPC.login", params);
std::auto_ptr<QBuffer> buffer(m_responses.take(m_currentRequestId));
QByteArray buf = buffer->buffer();
UserInfo userInfo(buf);
return userInfo;
}
示例10: getEvent
Events Communicator::getEvent(int itemId)
{
QVariantList params = authParams();
if (params.size() == 0)
return Events();
// Modify params by adding the item id.
QMap<QString, QVariant> param = params.takeAt(0).toMap();
// Make sure we use utf-8 encoded strings in response.
param["ver"] = 1;
param["prefersubject"] = 0;
param["selecttype"] = "one";
param["itemid"] = itemId;
params.push_back(param);
request("LJ.XMLRPC.getevents", params);
std::auto_ptr<QBuffer> buffer(m_responses.take(m_currentRequestId));
QByteArray buf = buffer->buffer();
Events events(buf);
return events;
}
示例11: postQuestion
//.........这里部分代码省略.........
bool found = false;
GeoDataPlacemark *placemark =0;
GeoDataPoint *point = 0;
GeoDataCoordinates coord;
GeoDataLatLonAltBox box;
QVariantList answerOptions;
while ( !found ) {
int randomIndex = qrand()%countryPlacemarks.size();
placemark = countryPlacemarks[randomIndex];
point = dynamic_cast<GeoDataPoint*>( placemark->geometry() );
coord = point->coordinates();
if ( point ) {
/**
* Find the country geometry and fetch corresponding
* GeoDataLatLonAltBox to zoom in to that country so that
* it fills the viewport.
*/
Q_ASSERT_X( d->m_countryBoundaries, "CountryByShape::postQuestion",
"CountryByShapePrivate::m_countryBoundaries is NULL" );
QVector<GeoDataFeature*>::Iterator i = d->m_countryBoundaries->begin();
QVector<GeoDataFeature*>::Iterator const end = d->m_countryBoundaries->end();
for ( ; i != end; ++i ) {
GeoDataPlacemark *country = static_cast<GeoDataPlacemark*>( *i );
GeoDataPolygon *polygon = dynamic_cast<GeoDataPolygon*>( country->geometry() );
GeoDataLinearRing *linearring = dynamic_cast<GeoDataLinearRing*>( country->geometry() );
GeoDataMultiGeometry *multigeom = dynamic_cast<GeoDataMultiGeometry*>( country->geometry() );
if ( polygon &&
polygon->contains( coord ) &&
!d->m_continentsAndOceans.contains(country->name(), Qt::CaseSensitive) )
{
box = polygon->latLonAltBox();
found = true;
break;
}
if ( linearring &&
linearring->contains( coord ) &&
!d->m_continentsAndOceans.contains(country->name(), Qt::CaseSensitive) )
{
box = linearring->latLonAltBox();
found = true;
break;
}
if ( multigeom ) {
QVector<GeoDataGeometry*>::Iterator iter = multigeom->begin();
QVector<GeoDataGeometry*>::Iterator const end = multigeom->end();
for ( ; iter != end; ++iter ) {
GeoDataPolygon *poly = dynamic_cast<GeoDataPolygon*>( *iter );
if ( poly &&
poly->contains( coord ) &&
!d->m_continentsAndOceans.contains(country->name(), Qt::CaseSensitive) )
{
box = poly->latLonAltBox();
found = true;
break;
}
}
}
if ( found ) {
break;
}
}
}
}
d->m_marbleWidget->setHighlightEnabled( true );
emit announceHighlight( coord.longitude(GeoDataCoordinates::Degree),
coord.latitude(GeoDataCoordinates::Degree),
GeoDataCoordinates::Degree );
/**
* Now disable the highlight feature so that
* the user click doesn't disturbe the highlight
* we did to ask question.
*/
d->m_marbleWidget->setHighlightEnabled( false );
d->m_marbleWidget->centerOn( box, true );
answerOptions << placemark->name()
<< countryPlacemarks[qrand()%countryPlacemarks.size()]->name()
<< countryPlacemarks[qrand()%countryPlacemarks.size()]->name()
<< countryPlacemarks[qrand()%countryPlacemarks.size()]->name();
// Randomize options in list answerOptions
for ( int i = 0; i < answerOptions.size(); ++i ) {
QVariant option = answerOptions.takeAt( qrand()%answerOptions.size() );
answerOptions.append( option );
}
if ( gameObject ) {
QMetaObject::invokeMethod( gameObject, "countryByShapeQuestion",
Q_ARG(QVariant, QVariant(answerOptions)),
Q_ARG(QVariant, QVariant(placemark->name())) );
}
}