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


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

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

示例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]
}
开发者ID:lollinus,项目名称:qt-5.3-examples,代码行数:31,代码来源:pingpong.cpp

示例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);
}
开发者ID:gvaf,项目名称:Estimo,代码行数:12,代码来源:patterntable.cpp

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

}
开发者ID:fnavarrov,项目名称:SGeMS,代码行数:29,代码来源:histogram_gui.cpp

示例5: addAttributePt

void KoXmlWriter::addAttributePt(const char* attrName, double value)
{
    QByteArray str;
    str.setNum(value, 'f', 11);
    str += "pt";
    addAttribute(attrName, str.data());
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:7,代码来源:KoXmlWriter.cpp

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

}
开发者ID:lollinus,项目名称:qt-5.3-examples,代码行数:28,代码来源:pingpong.cpp

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

示例8: addAttributePercent

void KoGenStyle::addAttributePercent(const QString &attrName, int value)
{
    QByteArray str;
    str.setNum(value);
    str += '%';
    addAttribute(attrName, str.data());
}
开发者ID:ChrisJong,项目名称:krita,代码行数:7,代码来源:KoGenStyle.cpp

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

示例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;
}
开发者ID:kglowins,项目名称:DREAM3D,代码行数:11,代码来源:QFilterParametersWriter.cpp

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

示例12: setValue

void Gpio::setValue(int value)
{
	if (isOpen()) {
		QByteArray ba;
		ba.setNum(value);

		m_gpio->write(ba);
	}
}
开发者ID:buelowp,项目名称:startrac,代码行数:9,代码来源:Gpio.cpp

示例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);
}
开发者ID:DoUML,项目名称:douml,代码行数:19,代码来源:UmlClass.cpp

示例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());
}
开发者ID:lollinus,项目名称:qt-5.3-examples,代码行数:12,代码来源:pingpong.cpp

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


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