• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ qFuzzyCompare函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中qFuzzyCompare函数的典型用法代码示例。如果您正苦于以下问题:C++ qFuzzyCompare函数的具体用法?C++ qFuzzyCompare怎么用?C++ qFuzzyCompare使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: snappingOffsetIterator

QList<QLineF> Snapper::findSnappingOffsetLines(const SnapLineMap &snappingOffsetMap,
                                         Qt::Orientation orientation,
                                         double snapLine,
                                         double lowerLimit,
                                         double upperLimit,
                                         QList<QRectF> *boundingRects) const
{
    QList<QLineF> lineList;

    SnapLineMapIterator snappingOffsetIterator(snappingOffsetMap);
    while (snappingOffsetIterator.hasNext()) {
        snappingOffsetIterator.next();

        const QRectF &formEditorItemRect(snappingOffsetIterator.value().first);
        double formEditorItemRectLowerLimit;
        double formEditorItemRectUpperLimit;
        if (orientation == Qt::Horizontal) {
            formEditorItemRectLowerLimit = formEditorItemRect.left();
            formEditorItemRectUpperLimit = formEditorItemRect.right();
        } else {
            formEditorItemRectLowerLimit = formEditorItemRect.top();
            formEditorItemRectUpperLimit = formEditorItemRect.bottom();
        }


        if (qFuzzyCompare(snapLine, snappingOffsetIterator.key()) &&
           !(lowerLimit > formEditorItemRectUpperLimit ||
             upperLimit < formEditorItemRectLowerLimit)) {
            lineList += createSnapLine(orientation,
                                       snapLine,
                                       lowerLimit,
                                       upperLimit,
                                       formEditorItemRect);
            if (boundingRects != 0)
                boundingRects->append(snappingOffsetIterator.value().first);
        }
    }


    return lineList;
}
开发者ID:CNOT,项目名称:julia-studio,代码行数:41,代码来源:snapper.cpp


示例2: loadPixmap

QPixmap loadPixmap(const QString &path)
{
    qreal ratio = 1.0;
    QPixmap pixmap;

    const qreal devicePixelRatio = qApp->devicePixelRatio();

    if (!qFuzzyCompare(ratio, devicePixelRatio)) {
        QImageReader reader;
        reader.setFileName(qt_findAtNxFile(path, devicePixelRatio, &ratio));
        if (reader.canRead()) {
            reader.setScaledSize(reader.size() * (devicePixelRatio / ratio));
            pixmap = QPixmap::fromImage(reader.read());
            pixmap.setDevicePixelRatio(devicePixelRatio);
        }
    } else {
        pixmap.load(path);
    }

    return pixmap;
}
开发者ID:linuxdeepin,项目名称:dde-control-center,代码行数:21,代码来源:basiclistdelegate.cpp


示例3: paint

void WGraphicsArrowItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
    const QLineF& line = m_line;

    if (qFuzzyCompare(line.length(), qreal(0.)))
        return;

    // Draw the line itself
    painter->setPen(m_pen);
    painter->drawLine(line);

    // Draw the arrows
    double angle = ::acos(line.dx() / line.length());
    if (line.dy() >= 0)
        angle = TwoPi - angle;

	painter->setBrush(Qt::black);

	QPointF startPos = m_line.p1();
	QPointF endPos = m_line.p2();
	if (!m_uniDirectedArrow) {
		// QPointF startNodeArrowP1 = startPos + QPointF(sin(angle + Pi / 3) * m_arrowSize,
		// 											  cos(angle + Pi / 3) * m_arrowSize);
		// QPointF startNodeArrowP2 = startPos + QPointF(sin(angle + Pi - Pi / 3) * m_arrowSize,
		// 											  cos(angle + Pi - Pi / 3) * m_arrowSize);
		// painter->drawPolygon(QPolygonF() << line.p1() << startNodeArrowP1 << startNodeArrowP2);
		QLineF arrowPoints = Wf::getArrowPoints(endPos, startPos, m_arrowSize);
		painter->drawPolygon(QPolygonF() << line.p1() << arrowPoints.p1() << arrowPoints.p2());
	}

	{
		// QPointF endNodeArrowP1 = endPos + QPointF(sin(angle - Pi / 3) * m_arrowSize,
		// 										  cos(angle - Pi / 3) * m_arrowSize);
		// QPointF endNodeArrowP2 = endPos + QPointF(sin(angle - Pi + Pi / 3) * m_arrowSize,
		// 										  cos(angle - Pi + Pi / 3) * m_arrowSize);
		// painter->drawPolygon(QPolygonF() << line.p2() << endNodeArrowP1 << endNodeArrowP2);
		QLineF arrowPoints = Wf::getArrowPoints(startPos, endPos, m_arrowSize);
		painter->drawPolygon(QPolygonF() << line.p2() << arrowPoints.p1() << arrowPoints.p2());
	}
}
开发者ID:joonhwan,项目名称:Waffle,代码行数:40,代码来源:WGraphicsArrowItem.cpp


示例4: NewtonRaphsonRootFind

/*
 *  NewtonRaphsonRootFind :
 *  Use Newton-Raphson iteration to find better root.
 */
static qreal NewtonRaphsonRootFind(QPointF *Q, QPointF P, qreal u)
{
    qreal       numerator, denominator;
    QPointF         Q1[3], Q2[2];   /*  Q' and Q''          */
    QPointF     Q_u, Q1_u, Q2_u; /*u evaluated at Q, Q', & Q''  */
    qreal       uPrime;     /*  Improved u          */
    int         i;

    /* Compute Q(u) */
    Q_u = BezierII(3, Q, u);

    /* Generate control vertices for Q' */
    for (i = 0; i <= 2; ++i) {
        Q1[i].setX((Q[i+1].x() - Q[i].x()) * 3.0);
        Q1[i].setY((Q[i+1].y() - Q[i].y()) * 3.0);
    }

    /* Generate control vertices for Q'' */
    for (i = 0; i <= 1; ++i) {
        Q2[i].setX((Q1[i+1].x() - Q1[i].x()) * 2.0);
        Q2[i].setY((Q1[i+1].y() - Q1[i].y()) * 2.0);
    }

    /* Compute Q'(u) and Q''(u) */
    Q1_u = BezierII(2, Q1, u);
    Q2_u = BezierII(1, Q2, u);

    /* Compute f(u)/f'(u) */
    numerator = (Q_u.x() - P.x()) * (Q1_u.x()) + (Q_u.y() - P.y()) * (Q1_u.y());
    denominator = (Q1_u.x()) * (Q1_u.x()) + (Q1_u.y()) * (Q1_u.y()) +
                  (Q_u.x() - P.x()) * (Q2_u.x()) + (Q_u.y() - P.y()) * (Q2_u.y());

    if (qFuzzyCompare(denominator, qreal(0.0))) {
        denominator = Zero;
    }

    /* u = u - f(u)/f'(u) */
    uPrime = u - (numerator / denominator);
    return (uPrime);
}
开发者ID:KDE,项目名称:koffice,代码行数:44,代码来源:ArtworkCurveFit.cpp


示例5: QRadialGradient

QGradient* Gradient::platformGradient()
{
    if (m_gradient)
        return m_gradient;

    if (m_radial)
        m_gradient = new QRadialGradient(m_p1.x(), m_p1.y(), m_r1, m_p0.x(), m_p0.y());
    else
        m_gradient = new QLinearGradient(m_p0.x(), m_p0.y(), m_p1.x(), m_p1.y());

    QColor stopColor;
    Vector<ColorStop>::iterator stopIterator = m_stops.begin();
    qreal lastStop(0.0);
    const qreal lastStopDiff = 0.0000001;
    while (stopIterator != m_stops.end()) {
        stopColor.setRgbF(stopIterator->red, stopIterator->green, stopIterator->blue, stopIterator->alpha);
        if (qFuzzyCompare(lastStop, qreal(stopIterator->stop)))
            lastStop = stopIterator->stop + lastStopDiff;
        else
            lastStop = stopIterator->stop;
        if (m_radial && m_r0)
            lastStop = m_r0 / m_r1 + lastStop * (1.0f - m_r0 / m_r1);
        m_gradient->setColorAt(lastStop, stopColor);
        ++stopIterator;
    }

    switch(m_spreadMethod) {
    case SpreadMethodPad:
        m_gradient->setSpread(QGradient::PadSpread);
        break;
    case SpreadMethodReflect:
        m_gradient->setSpread(QGradient::ReflectSpread);
        break;
    case SpreadMethodRepeat:
        m_gradient->setSpread(QGradient::RepeatSpread);
        break;
    }

    return m_gradient;
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:40,代码来源:GradientQt.cpp


示例6: lineIntersectPlane

bool glc::lineIntersectPlane(const GLC_Line3d& line, const GLC_Plane& plane, GLC_Point3d* pPoint)
{
	const GLC_Vector3d n= plane.normal();
	const GLC_Point3d p= line.startingPoint();
	const GLC_Vector3d d= line.direction();

	const double denominator= d * n;
	if (qFuzzyCompare(fabs(denominator), 0.0))
	{
		qDebug() << " glc::lineIntersectPlane : Line parallel to the plane";
		// The line is parallel to the plane
		return false;
	}
	else
	{
		// The line intersect the plane by one point
		const double t= -((n * p) + plane.coefD()) / denominator;
		(*pPoint)= p + (t * d);

		return true;
	}
}
开发者ID:AlessioMorale,项目名称:GLC_lib,代码行数:22,代码来源:glc_geomtools.cpp


示例7: QIODevice

VoiceAnalyzer::VoiceAnalyzer(const QAudioFormat &format, QObject *parent):
    QIODevice(parent),
    m_format(format),
    m_frequency(0),
    m_position(0),
    m_fftHelper(new FastFourierTransformer(this))
{
    Q_ASSERT(qFuzzyCompare(M_SAMPLE_COUNT_MULTIPLIER,
                           float(2)/(M_TWELTH_ROOT_OF_2 -1.0)));
    m_totalSampleCount = qRound(qreal(PrecisionPerNote)
                                *TargetFrequencyParameter
                                *M_SAMPLE_COUNT_MULTIPLIER);
    m_samples.reserve(m_totalSampleCount);
    int i = 2;
    int j = 1;
    for (; i < TargetFrequencyParameter; i *= 2) {
        j++;
    }
    m_maximumVoiceDifference = j*12;

    setCutOffPercentage(CutOffScaler);
}
开发者ID:RobertoMalatesta,项目名称:emscripten-qt,代码行数:22,代码来源:voiceanalyzer.cpp


示例8: it

void CSceneWidget::onHideBoxsTriggerd(bool triggerd)
{
    QListIterator<QGraphicsItem*> it(scene()->items());
    while(it.hasNext())
    {
        CGraphicsItem *gi = qgraphicsitem_cast<CGraphicsItem*>(it.next());
        if(!qFuzzyCompare(gi->zValue(), qreal(0.0)))
        {
            gi->setEditMode(!triggerd);
            gi->setVisible(!triggerd);
        }
    }

    if(QAction *action = qobject_cast<QAction*>(sender()))
    {
        if(triggerd)
            action->setText(tr("Show boxs"));
        else
            action->setText(tr("Hide boxs"));
    }
    update();
}
开发者ID:slima4,项目名称:zgui-qt,代码行数:22,代码来源:scenewidget.cpp


示例9: drawHighlightRect

    /*!
     * \brief Draw an hightlight rectangle arround an item
     *
     * \param painter painter where the item is highlighted
     * \param rect    The rectangular area to be drawn
     * \param pw      Pen width of highlight rectangle drawn.
     * \param option  The style option which contains palette and other information.
     */
    void drawHighlightRect(QPainter *painter, QRectF rect, qreal pw,
            const QStyleOptionGraphicsItem *option)
    {
        const QRectF murect = painter->transform().mapRect(QRectF(0, 0, 1, 1));
        if(qFuzzyCompare(qMax(murect.width(), murect.height()), qreal(0.0))) {
            return;
        }

        const QPen savePen = painter->pen();
        const QBrush saveBrush = painter->brush();

        const QRectF mbrect = painter->transform().mapRect(rect);
        if(qMin(mbrect.width(), mbrect.height()) < qreal(1.0)) {
            return;
        }

        qreal itemStrokeWidth = pw;
        const qreal pad = itemStrokeWidth / 2;
        const qreal strokeWidth = 0; // cosmetic pen

        const QColor fgcolor = option->palette.windowText().color();
        const QColor bgcolor( // ensure good contrast against fgcolor
                fgcolor.red()   > 127 ? 0 : 255,
                fgcolor.green() > 127 ? 0 : 255,
                fgcolor.blue()  > 127 ? 0 : 255);

        rect.adjust(pad, pad, -pad, -pad);

        painter->setPen(QPen(bgcolor, strokeWidth, Qt::SolidLine));
        painter->setBrush(Qt::NoBrush);
        painter->drawRect(rect);

        painter->setPen(QPen(option->palette.windowText(), 0, Qt::DashLine));
        painter->setBrush(Qt::NoBrush);
        painter->drawRect(rect);

        painter->setPen(savePen);
        painter->setBrush(saveBrush);
    }
开发者ID:damiansimanuk,项目名称:qucs-qt4,代码行数:47,代码来源:item.cpp


示例10: qt_graphicsItem_highlightSelected

void GraphicsUtils::qt_graphicsItem_highlightSelected(QPainter *painter, const QStyleOptionGraphicsItem *option, const QRectF & boundingRect, const QPainterPath & path)
{	
    const QRectF murect = painter->transform().mapRect(QRectF(0, 0, 1, 1));
    if (qFuzzyCompare(qMax(murect.width(), murect.height()) + 1, 1))
        return;

    const QRectF mbrect = painter->transform().mapRect(boundingRect);
    if (qMin(mbrect.width(), mbrect.height()) < double(1.0))
        return;

    double itemPenWidth = 1.0;
	const double pad = itemPenWidth / 2;
    const double penWidth = 0; // cosmetic pen

    const QColor fgcolor = option->palette.windowText().color();
    const QColor bgcolor( // ensure good contrast against fgcolor
        fgcolor.red()   > 127 ? 0 : 255,
        fgcolor.green() > 127 ? 0 : 255,
        fgcolor.blue()  > 127 ? 0 : 255);

    painter->setPen(QPen(bgcolor, penWidth, Qt::SolidLine));
    painter->setBrush(Qt::NoBrush);
	if (path.isEmpty()) {
		painter->drawRect(boundingRect.adjusted(pad, pad, -pad, -pad));
	}
	else {
		painter->drawPath(path);
	}

	painter->setPen(QPen(option->palette.windowText(), 0, Qt::DashLine));
    painter->setBrush(Qt::NoBrush);
	if (path.isEmpty()) {
		painter->drawRect(boundingRect.adjusted(pad, pad, -pad, -pad));
	}
	else {
		painter->drawPath(path);
	} 
}
开发者ID:DHaylock,项目名称:fritzing-app,代码行数:38,代码来源:graphicsutils.cpp


示例11: p1

void TestQgsDistanceArea::basic()
{
    QgsPoint p1( 1.0, 3.0 ), p2( -2.0, -1.0 );
    QgsDistanceArea daA;
    double resultA, resultB, resultC;

    daA.setEllipsoid( GEO_NONE );
    resultA = daA.measureLine( p1, p2 );
    QCOMPARE( resultA, 5.0 );

    // Now, on an ellipsoid. Always less?
    daA.setSourceCrs( 3006 );
    daA.setEllipsoid( "WGS84" );
    daA.setEllipsoidalMode( true );
    resultA = daA.measureLine( p1, p2 );
    QVERIFY( resultA < 5.0 );

    // Test copy constructor
    QgsDistanceArea daB( daA );
    resultB = daB.measureLine( p1, p2 );
    QCOMPARE( resultA, resultB );

    // Different Ellipsoid
    daB.setEllipsoid( "WGS72" );
    resultB = daB.measureLine( p1, p2 );
    QVERIFY( ! qFuzzyCompare( resultA, resultB ) );

    // Test assignment
    QSharedPointer<QgsDistanceArea> daC( new QgsDistanceArea );
    *daC = daB;
    resultC = daC->measureLine( p1, p2 );
    QCOMPARE( resultB, resultC );

    // Use parameter setting of ellipsoid radii (from WGS72 )
    daA.setEllipsoid( 6378135.0, 6378135.0 - ( 6378135.0 / 298.26 ) );
    resultA = daA.measureLine( p1, p2 );
    QCOMPARE( resultA, resultB );
}
开发者ID:avautour,项目名称:QGIS,代码行数:38,代码来源:testqgsdistancearea.cpp


示例12: glReadPixels

// Initialized the mover
void GLC_SetTargetMover::init(const GLC_UserInput& userInput)
{
	// Z Buffer component of selected point between 0 and 1
	GLfloat Depth;
	// read selected point
	glReadPixels(userInput.x(), m_pViewport->viewVSize() - userInput.y() , 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &Depth);

	// Test if there is geometry under picking point
	if (!qFuzzyCompare(Depth, 1.0f))
	{	// Geometry find -> Update camera's target position
		const GLC_Point3d target(m_pViewport->unProject(userInput.x(), userInput.y()));
		m_pViewport->cameraHandle()->setTargetCam(target);
	}
	else
	{	// Geometry not find -> panning

		const GLC_Point3d curPos(m_pViewport->mapPosMouse(userInput.x(), userInput.y()));
		const GLC_Point3d prevPos(m_pViewport->mapPosMouse(m_pViewport->viewHSize() / 2, m_pViewport->viewVSize() / 2));
		const GLC_Vector3d VectPan(curPos - prevPos);	// panning vector
		// pan camera
		m_pViewport->cameraHandle()->pan(VectPan);
	}
}
开发者ID:01iv3r,项目名称:OpenPilot,代码行数:24,代码来源:glc_settargetmover.cpp


示例13: goodGainOffsetTest

bool VariableDesc::goodGainOffsetTest(const VariableDesc& var)
{
    DEBUG_FUNC_NAME

    const QString conversionType = var.conversionType();
    qreal aValue = var.aValue();
    qreal bValue = var.bValue();

    // zero-full scale
    if (conversionType == getVARIABLE_CONVERSION_TYPE_STRING_0())
    {
        return !qFuzzyCompare(aValue, bValue);
    }
    // gain-offset
    else if (conversionType == getVARIABLE_CONVERSION_TYPE_STRING_1())
    {
        return (aValue != 0.0);
    }
    else
    {
        return true;
    }
}
开发者ID:jiaoy06,项目名称:eddypro-gui,代码行数:23,代码来源:variable_desc.cpp


示例14: NormaliseWidths

void StretchHeaderView::NormaliseWidths(const QList<int>& sections) {
  if (!stretch_enabled_)
    return;

  const ColumnWidthType total_sum =
      std::accumulate(column_widths_.begin(), column_widths_.end(), 0.0);
  ColumnWidthType selected_sum = total_sum;

  if (!sections.isEmpty()) {
    selected_sum = 0.0;
    for (int i=0 ; i<count() ; ++i)
      if (sections.contains(i))
        selected_sum += column_widths_[i];
  }

  if (total_sum != 0.0 && !qFuzzyCompare(total_sum, 1.0)) {
    const ColumnWidthType mult = (selected_sum + (1.0 - total_sum)) / selected_sum;
    for (int i=0 ; i<column_widths_.count() ; ++i) {
      if (sections.isEmpty() || sections.contains(i))
        column_widths_[i] *= mult;
    }
  }
}
开发者ID:Civil,项目名称:cantata,代码行数:23,代码来源:stretchheaderview.cpp


示例15: iteratorOf

bool OsmAnd::CoreResourcesEmbeddedBundle_P::containsResource(const QString& name, const float displayDensityFactor) const
{
    const auto citResourceEntry = _resources.constFind(name);
    if (citResourceEntry == _resources.cend())
        return false;
    const auto& resourceEntry = *citResourceEntry;

    auto itByDisplayDensityFactor = iteratorOf(constOf(resourceEntry.variantsByDisplayDensityFactor));
    while (itByDisplayDensityFactor.hasNext())
    {
        const auto byDisplayDensityFactorEntry = itByDisplayDensityFactor.next();
        const auto& testDisplayDensityFactor = byDisplayDensityFactorEntry.key();

        if (qFuzzyCompare(displayDensityFactor, testDisplayDensityFactor) ||
            testDisplayDensityFactor >= displayDensityFactor ||
            !itByDisplayDensityFactor.hasNext())
        {
            return true;
        }
    }

    return false;
}
开发者ID:Zahnstocher,项目名称:OsmAnd-core,代码行数:23,代码来源:CoreResourcesEmbeddedBundle_P.cpp


示例16: QFETCH

void tst_QRawFont::advances()
{
    QFETCH(QFont::HintingPreference, hintingPreference);

    QRawFont font(QLatin1String(SRCDIR "testfont.ttf"), 10, hintingPreference);
    QVERIFY(font.isValid());

    QRawFontPrivate *font_d = QRawFontPrivate::get(font);
    QVERIFY(font_d->fontEngine != 0);

    QVector<quint32> glyphIndices;
    glyphIndices << 44 << 83 << 83 << 70 << 69 << 86; // "Foobar"

    bool supportsSubPixelPositions = font_d->fontEngine->supportsSubPixelPositions();
    QVector<QPointF> advances = font.advancesForGlyphIndexes(glyphIndices);
    for (int i=0; i<glyphIndices.size(); ++i) {
        QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0));
        if (supportsSubPixelPositions)
            QVERIFY(advances.at(i).x() > 8.0);

        QVERIFY(qFuzzyIsNull(advances.at(i).y()));
    }
}
开发者ID:tsuibin,项目名称:emscripten-qt,代码行数:23,代码来源:tst_qrawfont.cpp


示例17: Q_UNUSED

QImage UCScalingImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
{
    Q_UNUSED(requestedSize);

    int separatorPosition = id.indexOf("/");
    float scaleFactor = id.left(separatorPosition).toFloat();
    QString path = id.mid(separatorPosition+1);
    QFile file(path);

    if (file.open(QIODevice::ReadOnly)) {
        QImage image;
        QImageReader imageReader(&file);
        if (!qFuzzyCompare(scaleFactor, (float)1.0)) {
            QSize realSize = imageReader.size();
            imageReader.setScaledSize(realSize * scaleFactor);
        }
        imageReader.read(&image);
        *size = image.size();
        return image;
    } else {
        return QImage();
    }
}
开发者ID:Aleskey78,项目名称:ubuntu-ui-toolkit-win,代码行数:23,代码来源:ucscalingimageprovider.cpp


示例18: evaluateBooleanJavaScriptExpression

bool TemplateEngine::evaluateBooleanJavaScriptExpression(QJSEngine &engine,
                                                         const QString &expression, bool *result,
                                                         QString *errorMessage)
{
    if (errorMessage)
        errorMessage->clear();
    if (result)
        *result = false;
    const QJSValue value = engine.evaluate(expression);
    if (value.isError()) {
        if (errorMessage)
            *errorMessage = QString::fromLatin1("Error in \"%1\": %2")
                .arg(expression, value.toString());
        return false;
    }
    // Try to convert to bool, be that an int or whatever.
    if (value.isBool()) {
        if (result)
            *result = value.toBool();
        return true;
    }
    if (value.isNumber()) {
        if (result)
            *result = !qFuzzyCompare(value.toNumber(), 0);
        return true;
    }
    if (value.isString()) {
        if (result)
            *result = !value.toString().isEmpty();
        return true;
    }
    if (errorMessage)
        *errorMessage = QString::fromLatin1("Cannot convert result of \"%1\" (\"%2\"to bool.")
            .arg(expression, value.toString());

    return false;
}
开发者ID:qtproject,项目名称:qt-creator,代码行数:37,代码来源:templateengine.cpp


示例19: maximum

void XFloatWidget::setValue( qreal in )
    {
    if( !_settingValue )
        {
        if( in > maximum() )
            {
            in = maximum();
            }
        if( in < minimum() )
            {
            in = minimum();
            }

        _settingValue = true;
        if( !qFuzzyCompare( in, _spinner->value() ) )
            {
            _spinner->setValue( in );
            }
        setSliderFromValue( in );
        emit valueChanged( this );
        emit valueChanged( _spinner->value() );
        _settingValue = false;
        }
    }
开发者ID:davidmueller13,项目名称:vexx,代码行数:24,代码来源:XFloatWidget.cpp


示例20: qreal

        void VolumeEffectFilter::treatOneSamplePerChannel(BYTE **buffer, int sampleSize, int channelCount, int frequency)
        {
            float volume = m_volumeEffect->volume();
            if (m_volumeEffect->m_fading) {
                const qreal lastSample = m_volumeEffect->m_fadeDuration * frequency / 1000;
                const qreal completed = qreal(m_volumeEffect->m_fadeSamplePosition++) / lastSample;

                if (qFuzzyCompare(completed, qreal(1.))) {
                    m_volumeEffect->setVolume(m_volumeEffect->m_targetVolume);
                    m_volumeEffect->m_fading = false; //we end the fading effect
                } else {
                    volume = m_volumeEffect->m_fadeCurveFn(m_volumeEffect->m_initialVolume, 
                        m_volumeEffect->m_targetVolume - m_volumeEffect->m_initialVolume,
                        completed);
                }
            }

            for(int c = 0; c < channelCount; ++c) {
                switch (sampleSize)
                {
                case 2:
                    {
                        short *shortBuffer = reinterpret_cast<short*>(*buffer);
                        *shortBuffer *= qRound(volume);
                    }
                    break;
                case 1:
                    **buffer *= qRound(volume);
                    break;
                default:
                    break;
                }

                *buffer += sampleSize;
            }
        }
开发者ID:phen89,项目名称:rtqt,代码行数:36,代码来源:volumeeffect.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ qFuzzyIsNull函数代码示例发布时间:2022-05-30
下一篇:
C++ qFloor函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap