本文整理汇总了C++中qint32函数的典型用法代码示例。如果您正苦于以下问题:C++ qint32函数的具体用法?C++ qint32怎么用?C++ qint32使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qint32函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clean
void BrowserApplication::saveSession()
{
if (quiting)
return;
QSettings settings;
settings.beginGroup(QLatin1String("MainWindow"));
settings.setValue(QLatin1String("restoring"), false);
settings.endGroup();
QWebSettings *globalSettings = QWebSettings::globalSettings();
if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
return;
clean();
settings.beginGroup(QLatin1String("sessions"));
int version = 2;
QByteArray data;
QBuffer buffer(&data);
QDataStream stream(&buffer);
buffer.open(QIODevice::WriteOnly);
stream << qint32(BrowserApplicationMagic);
stream << qint32(version);
stream << qint32(m_mainWindows.count());
for (int i = 0; i < m_mainWindows.count(); ++i)
stream << m_mainWindows.at(i)->saveState();
settings.setValue(QLatin1String("lastSession"), data);
settings.endGroup();
}
示例2: in
void MyServer::sendFriendGroup(const QVector<groupInfo>& groups,socketClients* client)
{
int size = groups.count();
QTcpSocket* socket = client->getSocket();
QByteArray data;
QDataStream in(&data,QIODevice::WriteOnly);
in.setVersion(QDataStream::Qt_5_0);
in<<qint32(0)<<qint8(respondType::friendGroup);
QVector<int> friendsID;
for (int i=0;i<size;i++) {
in<<groups[i].name;
// 将每一个分组下的所有好友信息封装在一起,再发送出去
if (groups[i].total<=0) continue;
model.getFriendsID(friendsID, groups[i].id);
for (int j=0;j<friendsID.count();j++) {
userInfo* info = model.getFriendsInfo(friendsID[j]);
if ( hx.contains(info->account) ) {
makeFriendInfo(in,info,clients.at( hx[ info->account ] )->getUserState() );
}
else {
makeFriendInfo(in,info,userStateType::offline );
}
delete info;
}
}
in.device()->seek(0);
in<<qint32(data.size()-sizeof(qint32));
socket->write(data);
}
示例3: QBrush
void QNodeViewCanvas::drawBackground(QPainter* painter, const QRectF& rect)
{
// GW-TODO: Expose this to QStyle
painter->fillRect(rect, QBrush(QColor(50, 50, 50)));
const qint32 gridInterval = 50;
painter->setWorldMatrixEnabled(true);
// GW-TODO: Expose this to QStyle
QPen linePen(QColor(80, 80, 80), 1, Qt::DotLine, Qt::FlatCap, Qt::RoundJoin);
linePen.setCosmetic(true); // Performance optimization
painter->setPen(linePen);
const qreal left = qint32(rect.left()) - (qint32(rect.left()) % gridInterval);
const qreal top = qint32(rect.top()) - (qint32(rect.top()) % gridInterval);
QVarLengthArray<QLineF, 100> linesX;
for (qreal x = left; x < rect.right(); x += gridInterval)
linesX.append(QLineF(x, rect.top(), x, rect.bottom()));
QVarLengthArray<QLineF, 100> linesY;
for (qreal y = top; y < rect.bottom(); y += gridInterval)
linesY.append(QLineF(rect.left(), y, rect.right(), y));
painter->drawLines(linesX.data(), linesX.size());
painter->drawLines(linesY.data(), linesY.size());
}
示例4: qint32
QDataStream &operator<<(QDataStream &stream, const Stitch &stitch)
{
stream << qint32(stitch.version);
stream << qint32(stitch.type);
stream << qint32(stitch.colorIndex);
return stream;
}
示例5: writeDraftPositions
void writeDraftPositions(const PeerId &peer, const MessageCursor &cur) {
if (!_working()) return;
if (cur.position == 0 && cur.anchor == 0 && cur.scroll == 0) {
DraftsMap::iterator i = _draftsPositionsMap.find(peer);
if (i != _draftsPositionsMap.cend()) {
clearKey(i.value());
_draftsPositionsMap.erase(i);
_mapChanged = true;
_writeMap();
}
} else {
DraftsMap::const_iterator i = _draftsPositionsMap.constFind(peer);
if (i == _draftsPositionsMap.cend()) {
i = _draftsPositionsMap.insert(peer, genKey());
_mapChanged = true;
_writeMap(WriteMapFast);
}
QString to = _basePath + toFilePart(i.value());
EncryptedDescriptor data(sizeof(quint64) + sizeof(qint32) * 3);
data.stream << quint64(peer) << qint32(cur.position) << qint32(cur.anchor) << qint32(cur.scroll);
FileWriteDescriptor file(i.value());
file.writeEncrypted(data);
}
}
示例6: DcOptions
QByteArray DcOptions::serialize() const {
if (_immutable) {
// Don't write the overriden options to our settings.
return DcOptions().serialize();
}
QReadLocker lock(&_mutex);
auto size = sizeof(qint32);
for (auto &item : _data) {
size += sizeof(qint32) + sizeof(qint32) + sizeof(qint32); // id + flags + port
size += sizeof(qint32) + item.second.ip.size();
}
auto result = QByteArray();
result.reserve(size);
{
QBuffer buffer(&result);
if (!buffer.open(QIODevice::WriteOnly)) {
LOG(("MTP Error: Can't open data for DcOptions::serialize()"));
return result;
}
QDataStream stream(&buffer);
stream.setVersion(QDataStream::Qt_5_1);
stream << qint32(_data.size());
for (auto &item : _data) {
stream << qint32(item.second.id) << qint32(item.second.flags) << qint32(item.second.port);
stream << qint32(item.second.ip.size());
stream.writeRawData(item.second.ip.data(), item.second.ip.size());
}
}
return result;
}
示例7: qint32
QDataStream& operator<<(QDataStream& s, const CommandlineOptions& a) {
s << qint32(a.player_action_) << qint32(a.url_list_action_) << a.set_volume_
<< a.volume_modifier_ << a.seek_to_ << a.seek_by_ << a.play_track_at_
<< a.show_osd_ << a.urls_ << a.log_levels_ << a.toggle_pretty_osd_;
return s;
}
示例8: qint32
void BattleCommunicator::spectatingChat(int player, int battle, const QString &chat)
{
if (!contains(battle)) {
return;
}
relay->notify(SpectatingBattleChat, qint32(battle), qint32(player), chat);
}
示例9: out
void QCacheItem::writeHeader(QFile *device) const
{
QDataStream out(device);
out << qint32(CacheMagic);
out << qint32(CurrentCacheVersion);
out << metaData;
bool compressed = canCompress();
out << compressed;
}
示例10: in
QByteArray *sql::sendDescriptor(int descrip)
{
QByteArray *data=new QByteArray;
QDataStream in(data,QIODevice::WriteOnly);
in.setVersion(QDataStream::Qt_5_0);
in<<qint32(0)<<qint8(respondType::descriptor)<<qint32(descrip);
in.device()->seek(0);
in<<qint32(data->size() - sizeof(qint32));
return data;
}
示例11: qFatal
void BattleCommunicator::removeSpectator(int idOfBattle, int id)
{
if (!contains(idOfBattle)) {
qFatal("Critical bug needing to be solved: BattleCommunicator::removeSpectator, player %d and non-existent battle %d", id, idOfBattle);
} else {
mybattles[idOfBattle]->spectators.remove(id);
relay->notify(SpectateBattle, qint32(idOfBattle), false, qint32(id));
}
}
示例12: stream
QByteArray NetworkCookieJar::saveState () const
{
int version = 1;
QByteArray data;
QDataStream stream(&data, QIODevice::WriteOnly);
stream << qint32(NetworkCookieJarMagic);
stream << qint32(version);
stream << d->tree;
return data;
}
示例13: stream
QByteArray QRecentFilesMenu::saveState() const
{
int version = 0;
QByteArray data;
QDataStream stream(&data, QIODevice::WriteOnly);
stream << qint32(RecentFilesMenuMagic);
stream << qint32(version);
stream << m_files;
return data;
}
示例14: sendOut
void DouyuTcpSocket::messageWrite(QString &content)
{
const char *content_ptr = content.toStdString().c_str();
QDataStream sendOut(&outBlock,QIODevice::WriteOnly);
qint32 length = 4 + 4 + content.length() + 1;// 2个uint32字段长度+内容长度+'\0'
sendOut<<qint32(hexReverse_qint32(length))<<qint32(hexReverse_qint32(length))<<qint32(_Douyu_CTS_Num);
outBlock.append(content_ptr);
outBlock.append('\0');
tcpDanmuSoc.write(outBlock);
outBlock.resize(0);
delete content_ptr;
}
示例15: qint32
QDataStream&operator<<(QDataStream& out, const Slab& slab)
{
out << qint32(slab.typeID());
out << slab.name();
out << qint32(slab.width());
out << qint32(slab.height());
out << slab.colour();
out << slab.isCollided();
out << qint32(slab.zValue());
return out;
}