本文整理汇总了C++中QByteArray::setNum方法的典型用法代码示例。如果您正苦于以下问题:C++ QByteArray::setNum方法的具体用法?C++ QByteArray::setNum怎么用?C++ QByteArray::setNum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QByteArray
的用法示例。
在下文中一共展示了QByteArray::setNum方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupConnections
void ChainLink::setupConnections(const KoFilter *sender, const KoFilter *receiver) const
{
const QMetaObject * const parent = sender->metaObject();
const QMetaObject * const child = receiver->metaObject();
if (!parent || !child)
return;
int senderMethodCount = parent->methodCount();
for (int i = 0; i < senderMethodCount; ++i) {
QMetaMethod signal = parent->method(i);
if (signal.methodType() != QMetaMethod::Signal)
continue;
// ### untested (QMetaMethod::signature())
if (strncmp(signal.signature(), SIGNAL_PREFIX, SIGNAL_PREFIX_LEN) == 0) {
int receiverMethodCount = child->methodCount();
for (int j = 0; j < receiverMethodCount; ++j) {
QMetaMethod slot = child->method(j);
if (slot.methodType() != QMetaMethod::Slot)
continue;
if (strncmp(slot.signature(), SLOT_PREFIX, SLOT_PREFIX_LEN) == 0) {
if (strcmp(signal.signature() + SIGNAL_PREFIX_LEN, slot.signature() + SLOT_PREFIX_LEN) == 0) {
QByteArray signalString;
signalString.setNum(QSIGNAL_CODE);
signalString += signal.signature();
QByteArray slotString;
slotString.setNum(QSLOT_CODE);
slotString += slot.signature();
QObject::connect(sender, signalString, receiver, slotString);
}
}
}
}
}
}
示例2: update
void PingPong::update()
{
QByteArray size;
// Server is only updating the coordinates
//! [Updating coordinates]
if (m_role == 1) {
checkBoundaries();
m_ballPreviousX = m_ballX;
m_ballPreviousY = m_ballY;
m_ballY = m_direction*(m_ballX+interval) - m_direction*m_ballX + m_ballY;
m_ballX = m_ballX + interval;
size.setNum(m_ballX);
size.append(' ');
QByteArray size1;
size1.setNum(m_ballY);
size.append(size1);
size.append(' ');
size1.setNum(m_leftBlockY);
size.append(size1);
size.append(" \n");
socket->write(size.constData());
Q_EMIT ballChanged();
}
else if (m_role == 2) {
size.setNum(m_rightBlockY);
size.append(" \n");
socket->write(size.constData());
}
//! [Updating coordinates]
}
示例3: qHash
/// Provides a hash function for the point objects
uint qHash(const PatternTable::Point &p)
{
QByteArray x;
QByteArray y;
x.setNum(p.x);
y.setNum(p.y);
x.append(y);
return qHash(x);
}
示例4: build_stats
void Histogram_gui::build_stats()
{
_stats.clear();
QByteArray val;
val.setNum( histogram_->data_count() );
_stats.push_back(Pair("Data count: ",val.constData()));
val.setNum( histogram_->mean() );
_stats.push_back(Pair("Mean: ",val.constData()));
val.setNum( histogram_->var() );
_stats.push_back(Pair("Variance: ",val.constData()));
val.setNum( histogram_->max() );
_stats.push_back(Pair("Maximum: ",val.constData()));
val.setNum( histogram_->percentile(0.75) );
_stats.push_back(Pair("Upper quartile: ",val.constData()));
val.setNum( histogram_->percentile(0.5) );
_stats.push_back(Pair("Median: ",val.constData()));
val.setNum( histogram_->percentile(0.25) );
_stats.push_back(Pair("lower quartile: ",val.constData()));
val.setNum( histogram_->min() );
_stats.push_back(Pair("Minimum: ",val.constData()));
}
示例5: addAttributePt
void KoXmlWriter::addAttributePt(const char* attrName, double value)
{
QByteArray str;
str.setNum(value, 'f', 11);
str += "pt";
addAttribute(attrName, str.data());
}
示例6: clientConnected
void PingPong::clientConnected()
{
//! [Initiating server socket]
if (!m_serverInfo->hasPendingConnections()) {
setMessage("FAIL: expected pending server connection");
return;
}
socket = m_serverInfo->nextPendingConnection();
if (!socket)
return;
socket->setParent(this);
connect(socket, SIGNAL(readyRead()), this, SLOT(readSocket()));
connect(socket, SIGNAL(disconnected()), this, SLOT(clientDisconnected()));
connect(socket, SIGNAL(error(QBluetoothSocket::SocketError)),
this, SLOT(socketError(QBluetoothSocket::SocketError)));
//! [Initiating server socket]
setMessage(QStringLiteral("Client connected."));
QByteArray size;
size.setNum(m_boardWidth);
size.append(' ');
QByteArray size1;
size1.setNum(m_boardHeight);
size.append(size1);
size.append(" \n");
socket->write(size.constData());
}
示例7: mouseMoveEvent
/*
* Used for starting drags of tabs
*/
void PsiTabBar::mouseMoveEvent(QMouseEvent *event) {
if (!dragsEnabled_) {
return;
}
if (!(event->buttons() & Qt::LeftButton)) {
return;
}
if ((event->pos() - dragStartPosition_).manhattanLength()
< QApplication::startDragDistance()) {
return;
}
if (dragTab_ != -1) {
QDrag *drag = new QDrag(this);
QMimeData *mimeData = new QMimeData;
QByteArray data;
QPixmap icon;
data.setNum(dragTab_);
mimeData->setData("psiTabDrag", data);
drag->setMimeData(mimeData);
drag->setPixmap(icon);
Qt::DropAction dropAction = drag->start(Qt::MoveAction);
Q_UNUSED(dropAction);
}
event->accept();
}
示例8: addAttributePercent
void KoGenStyle::addAttributePercent(const QString &attrName, int value)
{
QByteArray str;
str.setNum(value);
str += '%';
addAttribute(attrName, str.data());
}
示例9: mouseMoveEvent
void Cluster::mouseMoveEvent(QMouseEvent *event)
{
if (!(event->buttons() & Qt::LeftButton)) {
QWidget::mouseMoveEvent(event);
return;
}
if ((event->pos() - _drag_start_pos).manhattanLength()
< QApplication::startDragDistance()) {
QWidget::mouseMoveEvent(event);
return;
}
QMimeData *data = new QMimeData;
QByteArray mimedata;
// the index of cluster within the cluster box
ClusterBox *cbox = dynamic_cast<ClusterBox*>(this->parentWidget());
int idx = cbox->clusterIndex(this);
mimedata.setNum(idx);
data->setData("Cluster", mimedata);
QDrag *drag = new QDrag(this);
drag->setMimeData(data);
switch (drag->exec()) {
case Qt::MoveAction:
break;
default:
break;
}
}
示例10: writeValue
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int QFilterParametersWriter::writeValue(const QString name, double value)
{
int err = 0;
QByteArray buf;
buf = buf.setNum(value, 'g', 8);
m_Prefs->setValue(name, QString(buf));
return err;
}
示例11: SetProgress
void NesisSplash::SetProgress(unsigned int uiProgress)
{
QByteArray str;
str.setNum(uiProgress);
str.prepend("show ");
// qDebug() << "proc " << str;
m_fileSplash->write(str);
m_fileSplash->flush();
}
示例12: setValue
void Gpio::setValue(int value)
{
if (isOpen()) {
QByteArray ba;
ba.setNum(value);
m_gpio->write(ba);
}
}
示例13: html
void UmlClass::html()
{
QByteArray s;
UmlCom::message(name());
if (stereotype() == "stereotype")
start_file("stereotype" + s.setNum((unsigned) getIdentifier()), "Stereotype " + name(), TRUE);
else if (stereotype() == "metaclass")
start_file("metaclass" + s.setNum((unsigned) getIdentifier()), "Metaclass " + name(), TRUE);
else
start_file("class" + s.setNum((unsigned) getIdentifier()), "Class " + name(), TRUE);
define();
gen_html("", 0, 0);
end_file();
unload(FALSE, FALSE);
}
示例14: serverConnected
void PingPong::serverConnected()
{
setMessage("Server Connected");
QByteArray size;
size.setNum(m_boardWidth);
size.append(' ');
QByteArray size1;
size1.setNum(m_boardHeight);
size.append(size1);
size.append(" \n");
socket->write(size.constData());
}
示例15: checkArray
JavaScriptArrayType checkArray(KJS::ExecState *exec, KJS::JSValue *val)
{
KJS::JSObject *obj = val->toObject(exec);
if (toQString(obj->className()) == "Array") {
if (!obj->hasProperty(exec, KJS::Identifier("length"))) {
return Map;
}
KJS::JSValue *jslen = obj->get(exec, KJS::Identifier("length"));
const int len = jslen->toNumber(exec);
if (len > 0) {
QByteArray buff;
buff.setNum(len - 1);
if (!obj->hasProperty(exec, KJS::Identifier(buff.data()))) {
return Map;
}
}
return List;
} else {
return None;
}
}