本文整理汇总了C++中Tag::getLabel方法的典型用法代码示例。如果您正苦于以下问题:C++ Tag::getLabel方法的具体用法?C++ Tag::getLabel怎么用?C++ Tag::getLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::getLabel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getJson
QByteArray WriteTagRequestJSON::getJson() const
{
QJson::Serializer serializer;
QVariantMap request;
Tag mark = m_tags.at(0);
Channel channel = m_channels.at(0);
request.insert("auth_token", m_token);
request.insert("channel", channel.getName());
request.insert("title", mark.getLabel().isEmpty()? "New mark":mark.getLabel());
request.insert("link", mark.getUrl());
request.insert("description", mark.getDescription());
request.insert("latitude", mark.getLatitude());
request.insert("altitude", mark.getAltitude());
request.insert("longitude", mark.getLongitude());
request.insert("time", mark.getTime().toString("dd MM yyyy HH:mm:ss.zzz"));
return serializer.serialize(request);
}
示例2: getJson
QByteArray LoadTagsResponseJSON::getJson() const
{
QJson::Serializer serializer;
serializer.setDoublePrecision(DOUBLE_PRECISION_RESPONSE);
QVariantMap obj, rss, jchannel;
QVariantList jchannels;
QVariantList jtags;
QVariantMap channel;
obj["errno"]= m_errno;
if (m_errno == SUCCESS){
for(int j=0; j<m_tags.size(); j++)
{
Tag tag = m_tags.at(j);
QVariantMap jtag;
jtag["title"] = tag.getLabel();
jtag["link"] = tag.getUrl();
jtag["description"] = tag.getDescription();
jtag["latitude"] = tag.getLatitude();
jtag["altitude"] = tag.getAltitude();
jtag["longitude"] = tag.getLongitude();
jtag["user"] = tag.getUser().getLogin();
jtag["pubDate"] = tag.getTime().toString("dd MM yyyy HH:mm:ss.zzz");
jtags.append(jtag);
}
channel["items"] = jtags;
// channel["name"] = m_channels.at(i).getName();
jchannels.append(channel);
jchannel["items"] = jchannels;
rss["channels"] = jchannel;
obj["rss"] = rss;
}
return serializer.serialize(obj);
}
示例3: add_mark
void MapScene::add_mark(QPointF pos, Tag mark,Channel channel)
{
QPointF posForPicture = QPointF(pos.x()-12.0, pos.y()-12.0);
//QPointF posForText = QPointF(pos.x()-24.0, pos.y()+24.0);
QGraphicsPixmapItem * pi = 0;
QString channel_name = channel.getName();
if(channel_name == "Fuel prices")
{
pi = addPixmap(QPixmap(":/img/fuel.png"));
}
else if(channel_name == "Public announcements")
{
pi = addPixmap(QPixmap(":/img/public.png"));
}
else if(channel_name == "ObsTestChannel")
{
pi = addPixmap(QPixmap(":/img/test.png"));
//painter.drawText(posForText, "Test text");
}
else if(channel_name.startsWith("bus_"))
{
pi = addPixmap(QPixmap(":/img/bus.png"));
//painter.drawText(posForText, channel_name.split('_').at(1));
}
else if(channel_name.startsWith("tram_"))
{
pi = addPixmap(QPixmap(":/img/tram.png"));
//painter.drawText(posForText, channel_name.split('_').at(1));
}
else if(channel_name.startsWith("troll_"))
{
pi = addPixmap(QPixmap(":/img/trolleybus.png"));
//painter.drawText(posForText, channel_name.split('_').at(1));
}
else if(channel_name.startsWith("user_"))
{
pi = addPixmap(QPixmap(":/img/user.png"));
}
else
{
QPixmap pixmap(50,50);
pixmap.fill(Qt::transparent);
QPoint center(pixmap.width()/2, pixmap.height()/4);
QPoint posForText = QPoint(0, pixmap.height()/2+8);
QPainter painter;
painter.begin(&pixmap);
QFont font=painter.font();
font.setPointSize(7);
painter.setFont(font);
painter.setBrush(Qt::blue);
painter.drawEllipse(center, pixmap.width()/4, pixmap.height()/4);
painter.setBrush(Qt::black);
painter.drawEllipse(center, pixmap.width()/10, pixmap.height()/10);
int mins_ago=(mark.getTime().toUTC().secsTo(QDateTime::currentDateTime()))/60;
qDebug() << "Text for mark: " << mark.getLabel()+", "+ QString::number(mins_ago)+" min. ago" ;
painter.drawText(posForText,QString::number(mins_ago)+" min ago");
painter.end();
pi = this->addPixmap(pixmap);
}
pi->setX(posForPicture.x());
pi->setY(posForPicture.y());
m_marks.push_back(pi);
}