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


C++ QVector::value方法代码示例

本文整理汇总了C++中QVector::value方法的典型用法代码示例。如果您正苦于以下问题:C++ QVector::value方法的具体用法?C++ QVector::value怎么用?C++ QVector::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QVector的用法示例。


在下文中一共展示了QVector::value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Modular_exponentiation

LongInt Algorithm::Modular_exponentiation(LongInt a,LongInt m, LongInt r)
{
    //qDebug()<<"algorithm.cpp: Modular_exponentiation"<<a<<m<<r;
    if(r==0)
    {
        //qDebug()<<"algorithm.cpp: Modular_exponentiation :( 1 )";
        return LongInt(1);
    }
    QVector<LongInt> part;
    part<<1;
    LongInt a_k(1),k(1);

    while(1)
    {
        //qDebug()<<a_k<<a<<m;
        a_k=((a_k*a)%m);
        part<<a_k;
        if(part.last()==1)
        {
            part.removeLast();
            //qDebug()<<"algorithm.cpp: Modular_exponentiation :"<<part.value( ((r % LongInt(part.length()))).toInt());
            return part.value( ((r % LongInt(part.length()))).toInt());
        }
        k+=1;
        if(k>r)
        {
            //qDebug()<<"algorithm.cpp: Modular_exponentiation :"<<part.value( ((r % LongInt(part.length()))).toInt());
            return part.value( ((r % LongInt(part.length()))).toInt());
            return a_k;
        }
    }
}
开发者ID:Mynamesparta,项目名称:Factorization_and_Discrete_Logarithm,代码行数:32,代码来源:algorithm.cpp

示例2: print_poly

void QCanvas::print_poly(QVector<QPointF>& poly)
{
    for(size_t i = 0; i<poly.size(); ++i)
    {
        Add_lines(poly.value(i),poly.value((i+1)%poly.size()),Qt::blue);
    }
}
开发者ID:Pacman29,项目名称:Graf_lab05_06,代码行数:7,代码来源:qcanvas.cpp

示例3: find_max

int find_max(const QVector<int> &X) {
	int ret=X.value(0);
	for (int i=0; i<X.count(); i++) {
		ret=qMax(ret,X.value(i));
	}
	return ret;
}
开发者ID:magland,项目名称:pebble,代码行数:7,代码来源:pebble_helpers.cpp

示例4: addDocToTable

void PrintDialogController::addDocToTable(QVector<SimpleDocumentInfo> vectorDoc)
{
    getView()->getTable()->setRowCount(vectorDoc.size());
    for(int i =0; i<vectorDoc.size();i++)
    {
    getView()->getTable()->setItem(i,0,new QTableWidgetItem(vectorDoc.value(i).getSymbol()));
    getView()->getTable()->item(i,0)->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled|Qt::ItemIsUserCheckable);
    getView()->getTable()->item(i,0)->setCheckState(Qt::Unchecked);
    getView()->getTable()->setItem(i,1,new QTableWidgetItem(QVariant(vectorDoc.value(i).getDocumentDate()).toString()));
    getView()->getTable()->item(i,1)->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    }

}
开发者ID:milczarekIT,项目名称:agila,代码行数:13,代码来源:PrintDialogController.cpp

示例5:

static PyObject *convertFrom_QVector_1900(void *sipCppV, PyObject *)
{
   QVector<uint> *sipCpp = reinterpret_cast<QVector<uint> *>(sipCppV);

#line 159 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/sip/QtCore/qvector.sip"
    // Create the list.
    PyObject *l;

    if ((l = PyList_New(sipCpp->size())) == NULL)
        return NULL;

    // Set the list elements.
    for (int i = 0; i < sipCpp->size(); ++i)
    {
        PyObject *pobj;

        // Convert to a Python long to make sure it doesn't get interpreted as
        // a signed value.
        if ((pobj = PyLong_FromUnsignedLong(sipCpp->value(i))) == NULL)
        {
            Py_DECREF(l);

            return NULL;
        }

        PyList_SET_ITEM(l, i, pobj);
    }

    return l;
#line 122 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/QtCore/sipQtCoreQVector1900.cpp"
}
开发者ID:kunwijik,项目名称:Spectroscopy_paper,代码行数:31,代码来源:sipQtCoreQVector1900.cpp

示例6:

static QAccessibleInterface *relatedInterface(QAccessibleInterface *iface, QAccessible::RelationFlag flag)
{
    typedef QPair<QAccessibleInterface *, QAccessible::Relation> RelationPair;
    QVector<RelationPair> rels = iface->relations(flag);

    return rels.value(0).first;
}
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:7,代码来源:qwindowsmsaaaccessible.cpp

示例7: addTrack

void MapScene::addTrack(const QVector<QPointF>& points,
                        const QVector<float>& metaData, QVariant idTrack)
{
    if (points.isEmpty())
        return;

    QPainterPath route;
    TrackItem* track = new TrackItem;
    track->setId(idTrack);

    // Add each CoordinateItems which constitute the track
    for (int i(0); i < points.count(); i++)
    {
        qreal sx = points[i].x() * this->_amplificationRatio;
        qreal sy = points[i].y() * -this->_amplificationRatio;

        CoordinateItem* ci = new CoordinateItem;
        ci->setPos(sx, sy);
        ci->setAcceptHoverEvents(this->_trackAcceptHoverEvents);
        track->insertCoordinate(ci, metaData.value(i));

        if (i == 0)
            route.moveTo(sx, sy);
        else
            route.lineTo(sx, sy);
    }

    this->_tracks << track;
    this->addItem(track);
    QGraphicsItem* path = this->addPath(route, QPen(Qt::white));
    path->setParentItem(track);
    this->setSceneRect(this->itemsBoundingRect());
}
开发者ID:xaviermawet,项目名称:EcoManagerQwt,代码行数:33,代码来源:MapScene.cpp

示例8:

static PyObject *convertFrom_QVector_1900(void *sipCppV,PyObject *)
{
   QVector<uint> *sipCpp = reinterpret_cast<QVector<uint> *>(sipCppV);

#line 115 "/home/tsheasha/GUC/Bachelors/android-python27/python-build/PyQt-x11-gpl-4.8/sip/QtCore/qvector.sip"
    // Create the list.
    PyObject *l;

    if ((l = PyList_New(sipCpp->size())) == NULL)
        return NULL;

    // Set the list elements.
    for (int i = 0; i < sipCpp->size(); ++i)
    {
        PyObject *pobj;

        // Convert to a Python long to make sure it doesn't get interpreted as
        // a signed value.
        if ((pobj = PyLong_FromUnsignedLong(sipCpp->value(i))) == NULL)
        {
            Py_DECREF(l);

            return NULL;
        }

        PyList_SET_ITEM(l, i, pobj);
    }

    return l;
#line 127 "sipQtCoreQVector1900.cpp"
}
开发者ID:ClydeMojura,项目名称:android-python27,代码行数:31,代码来源:sipQtCoreQVector1900.cpp

示例9: drawCurves

void Plotter::drawCurves(QPainter& painter)
{
    noOfCurves = curveDataMap.count();
    QRect rect = this->printRect();
    double x=0,y=0;
    double width = rect.width() - 1;
    double height = rect.height() - 1;
    double yCount = maxY - minY;
    if(antiAliasing)
        painter.setRenderHints(QPainter::Antialiasing);
    painter.translate(Margin + 1,rect.bottom()-1);
    for(int i=0; i < noOfCurves ; i++)
    {
        QPolygonF polyline;
        QVector<double>* dataPtr = curveDataMap[i] ;
        for(int j = 0 ; j <= noOfPoints ; j++)
        {
            x = (width * j)/noOfPoints;
            y = (height * dataPtr->value(j))/yCount;
            polyline << QPoint(x,-y);
            //qDebug() << y;
        }
        qDebug() << x <<rect.right();
        painter.setPen(colorMap.value(i));
        painter.drawPolyline(polyline);

    }
}
开发者ID:Qt-Widgets,项目名称:uav,代码行数:28,代码来源:Plotter.cpp

示例10:

static PyObject *convertFrom_QVector_1800(void *sipCppV, PyObject *)
{
   QVector<int> *sipCpp = reinterpret_cast<QVector<int> *>(sipCppV);

#line 105 "/home/vikky/Desktop/DVCS/stuff/scrapy/soft/PyQt-x11-gpl-4.11.4/sip/QtCore/qvector.sip"
    // Create the list.
    PyObject *l;

    if ((l = PyList_New(sipCpp->size())) == NULL)
        return NULL;

    // Set the list elements.
    for (int i = 0; i < sipCpp->size(); ++i)
    {
        PyObject *pobj;

        // Convert to a Python long to make sure it doesn't get interpreted as
        // a signed value.
        if ((pobj = SIPLong_FromLong(sipCpp->value(i))) == NULL)
        {
            Py_DECREF(l);

            return NULL;
        }

        PyList_SET_ITEM(l, i, pobj);
    }

    return l;
#line 117 "/home/vikky/Desktop/DVCS/stuff/scrapy/soft/PyQt-x11-gpl-4.11.4/QtCore/sipQtCoreQVector1800.cpp"
}
开发者ID:annelida,项目名称:stuff,代码行数:31,代码来源:sipQtCoreQVector1800.cpp

示例11:

static PyObject *convertFrom_QVector_2400(void *sipCppV, PyObject *)
{
   QVector<qreal> *sipCpp = reinterpret_cast<QVector<qreal> *>(sipCppV);

#line 203 "/home/vikky/Desktop/DVCS/stuff/scrapy/soft/PyQt-x11-gpl-4.11.4/sip/QtCore/qvector.sip"
    // Create the list.
    PyObject *l;

    if ((l = PyList_New(sipCpp->size())) == NULL)
        return NULL;

    // Set the list elements.
    for (int i = 0; i < sipCpp->size(); ++i)
    {
        PyObject *pobj;

        if ((pobj = PyFloat_FromDouble(sipCpp->value(i))) == NULL)
        {
            Py_DECREF(l);

            return NULL;
        }

        PyList_SET_ITEM(l, i, pobj);
    }

    return l;
#line 115 "/home/vikky/Desktop/DVCS/stuff/scrapy/soft/PyQt-x11-gpl-4.11.4/QtCore/sipQtCoreQVector2400.cpp"
}
开发者ID:annelida,项目名称:stuff,代码行数:29,代码来源:sipQtCoreQVector2400.cpp

示例12:

static PyObject *convertFrom_QVector_1900(void *sipCppV, PyObject *)
{
   QVector<GLuint> *sipCpp = reinterpret_cast<QVector<GLuint> *>(sipCppV);

#line 29 "C:\\Users\\marcus\\Downloads\\PyQt-gpl-5.4\\PyQt-gpl-5.4\\sip/QtGui/qpygui_qvector.sip"
    PyObject *l = PyList_New(sipCpp->size());

    if (!l)
        return 0;

    for (int i = 0; i < sipCpp->size(); ++i)
    {
        // Convert to a Python long to make sure it doesn't get interpreted as
        // a signed value.
        PyObject *pobj = PyLong_FromUnsignedLong(sipCpp->value(i));

        if (!pobj)
        {
            Py_DECREF(l);

            return 0;
        }

        PyList_SET_ITEM(l, i, pobj);
    }

    return l;
#line 169 "C:\\Users\\marcus\\Downloads\\PyQt-gpl-5.4\\PyQt-gpl-5.4\\QtGui/sipQtGuiQVector1900.cpp"
}
开发者ID:rff255,项目名称:python-qt5,代码行数:29,代码来源:sipQtGuiQVector1900.cpp

示例13: razor_CH

void QCanvas::razor_CH(QVector<QCanvas::line_t> razor, QVector<QPointF> &poly, bool time_sleep)
{
    for(size_t i = 0; i<razor.size(); ++i)
    {
        QVector<QPointF> tmp;
        for(size_t j = 0; j< poly.size(); ++j)
        {
            QPointF S = poly.value(j);
            QPointF F = poly.value((j+1) % poly.size());
            size_t flag = Intersection(S,F,razor.value(i).S,razor.value(i).F);
            while(flag)
            switch (flag) {
            case 1:
            {
                flag = 0;
                continue;
            }
            case 2:
            {
                QPointF add = LinesCross(S,F,razor.value(i).S,razor.value(i).F);
                if (add == F)
                {
                    flag = 3;
                    continue;
                }
                tmp.push_back(add);
                tmp.push_back(F);
                flag = 0;
                continue;
            }
            case 3:
            {
                tmp.push_back(F);
                flag = 0;
                continue;
            }
            case 4:
            {
                QPointF add = LinesCross(S,F,razor.value(i).S,razor.value(i).F);
                if (add == F)
                {
                    flag = 3;
                    continue;
                }
                tmp.push_back(add);
                flag = 0;
                continue;
            }
            }

        }
        poly.swap(tmp);
    }
}
开发者ID:Pacman29,项目名称:Graf_lab05_06,代码行数:54,代码来源:qcanvas.cpp

示例14:

static QAccessibleInterface *relatedInterface(QAccessibleInterface *iface, QAccessible::RelationFlag flag)
{
    typedef QPair<QAccessibleInterface *, QAccessible::Relation> RelationPair;
    QVector<RelationPair> rels = iface->relations(flag);

    for (int i = 1; i < rels.count(); ++i)
        delete rels.at(i).first;

    return rels.value(0).first;
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例15: columnCount

int QcepDataArraySpreadsheetModel::columnCount(const QModelIndex &parent) const
{
  QcepDataArrayPtr array(m_Array);

  if (array) {
    QVector<int> dims = array->dimensions();

    return dims.value(1);
  } else {
    return 0;
  }
}
开发者ID:guyjennings,项目名称:qceplib,代码行数:12,代码来源:qcepdataarrayspreadsheetmodel.cpp


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