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


C++ sliderMoved函数代码示例

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


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

示例1: setPosition

void SliderBase::mouseMoveEvent(QMouseEvent *e)
{
	if (_ignoreMouseMove)
	{
		_ignoreMouseMove = false;
		return;
	}

	double ms = 0.0;
	if (d_scrollMode == ScrMouse)
	{
		setPosition(e->pos());
		if (d_mass > 0.0)
		{
			ms = double(d_time.elapsed());
			if (ms < 1.0) ms = 1.0;
			d_speed = (exactValue() - exactPrevValue()) / ms;
			d_time.start();
		}
		if (value() != prevValue())
		{
			emit sliderMoved(value(), _id);
			emit sliderMoved((int)value(), _id);
		}
	}

}
开发者ID:Adamiko,项目名称:los,代码行数:27,代码来源:sliderbase.cpp

示例2: minValue

void SliderBase::wheelEvent(QWheelEvent *e)
{
	if(_ignoreMouseWheel)
	{
		e->ignore();
		return;
	}

	e->accept();

	float inc = (maxValue() - minValue()) / 40;
	if (e->modifiers() == Qt::ShiftModifier)
		inc = inc / 10;

	if (inc < step())
		inc = step();

	if (e->delta() > 0)
		setValue(value() + inc);
	else
		setValue(value() - inc);

	emit sliderMoved(value(), _id);
	emit sliderMoved((int)value(), _id);
}
开发者ID:Adamiko,项目名称:los,代码行数:25,代码来源:sliderbase.cpp

示例3: qDebug

void CQBarChart::setSlider()
{
#ifdef DEBUG_UI
  qDebug() << "-- in qwt3dPlot.cpp Plot3d::setSlider --";
#endif

  if (mSliderActive)
    if (mData.valueZone != 0)
      {
        mpSliderColumn->setMinimum(0);

        if (mData.columns == 1)
          mpSliderColumn->setMaximum((mData.columns - 1) * 1000);
        else
          mpSliderColumn->setMaximum(mData.columns * 1000);

        mpSliderRow->setMinimum(0);

        if (mData.rows == 1)
          mpSliderRow->setMaximum((mData.rows - 1) * 1000);
        else
          mpSliderRow->setMaximum(mData.rows * 1000);

        sliderMoved(mpSliderColumn->value() / 1000, mpSliderRow->value() / 1000);
      }
}
开发者ID:copasi,项目名称:COPASI,代码行数:26,代码来源:qwt3dPlot.cpp

示例4: qDebug

// Based on code from qslider.cpp
void Slider::mousePressEvent( QMouseEvent *e )
{
	qDebug("pressed (%d, %d)", e->pos().x(), e->pos().y());
	if( e->button() == Qt::LeftButton )
	{
		qDebug( "Left button" );
		QStyleOptionSlider opt;
		initStyleOption( &opt );
		const QRect sliderRect = style()->subControlRect( QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this );
		const QPoint center = sliderRect.center() - sliderRect.topLeft();
		// to take half of the slider off for the setSliderPosition call we use the center - topLeft

		if ( ! sliderRect.contains( e->pos() ) )
		{
			qDebug( "accept" );
			e->accept();

			int v = pixelPosToRangeValue( pick( e->pos() - center ) );
			setSliderPosition( v );
			triggerAction( SliderMove );
			setRepeatAction( SliderNoAction );
			emit sliderMoved( v );//TODO: ok?
			emit sliderPressed(); //TODO: ok?
		}
		else
		{
			QSlider::mousePressEvent( e );
		}
	}
	else
	{
		QSlider::mousePressEvent( e );
	}
}
开发者ID:MarcAntoine-Arnaud,项目名称:QtAV,代码行数:35,代码来源:Slider.cpp

示例5: Q_D

void DSlider::mouseMoveEvent(QMouseEvent *event)
{
    QAbstractSlider::mouseMoveEvent(event);

    Q_D(DSlider);

    if(d->mousePressed) {
        int newPosition = d->pixelPosToRangeValue(d->pick(event->pos()) - d->clickOffset);
        setSliderPosition(newPosition);

        emit sliderMoved(newPosition);
    }

    if (!d->m_hoverShowValue) {
        return;
    }

    QPoint pos = event->pos();
    QRect rect(d->getScalePosition(value()) - CustomDrawingLeftPadding, 10, 20, 20);
    if (d->m_handleHovering) {
        d->m_handleHovering = rect.contains(pos);
    } else {
        d->m_handleHovering = rect.contains(pos);
        if (d->m_handleHovering) {
            d->m_hoverTimout = false;
            if (d->m_hoverShowValueInterval > 0) {
                d->m_hoverTimer.start(d->m_hoverShowValueInterval);
            }
        }
    }

    update();
}
开发者ID:zccrs,项目名称:deepin-tool-kit,代码行数:33,代码来源:dslider.cpp

示例6: setSliderPosition

void Knob::updatePosition(int val)
{
    setSliderPosition(val);
    setToolTip(QString::number(val));
    update();
    emit sliderMoved(val);
}
开发者ID:tedr56,项目名称:Fluxus-Qinterface,代码行数:7,代码来源:knob.cpp

示例7: sliderPressed

void NSlider::mousePressEvent(QMouseEvent *event)
{
	if (event->button() != Qt::RightButton) {
		emit sliderPressed();

		QStyleOptionSlider opt;
		initStyleOption(&opt);
		QRect gr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderGroove, this);
		QRect sr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);

		int pxMin;
		int pxMax;
		if (orientation() == Qt::Horizontal) {
			pxMin = gr.x() +  sr.width() / 2;
			pxMax = gr.right() -  sr.width() / 2 + 1;
		} else {
			pxMin = gr.y() + sr.height() / 2;
			pxMax = gr.bottom() - sr.height() / 2 + 1;
		}

		setValue(QStyle::sliderValueFromPosition(minimum(), maximum(), event->x() - pxMin, pxMax - pxMin, opt.upsideDown));

		emit sliderMoved(value());
	}

	QSlider::mousePressEvent(event);
}
开发者ID:vkolev,项目名称:nulloy,代码行数:27,代码来源:slider.cpp

示例8: rect

void SoundSlider::mouseMoveEvent( QMouseEvent *event )
{
    if( isSliding )
    {
        QRect rect( paddingL - 15,    -1,
                    WLENGTH + 15 * 2 , WHEIGHT + 5 );
        if( !rect.contains( event->pos() ) )
        { /* We are outside */
            if ( !b_mouseOutside )
                setValue( i_oldvalue );
            b_mouseOutside = true;
        }
        else
        { /* We are inside */
            b_mouseOutside = false;
            changeValue( event->x() - paddingL );
            emit sliderMoved( value() );
        }
    }
    else
    {
        int i = ( ( event->x() - paddingL ) * maximum() + 40 ) / WLENGTH;
        i = __MIN( __MAX( 0, i ), maximum() );
        setToolTip( QString("%1  %" ).arg( i ) );
    }
}
开发者ID:RicoP,项目名称:vlcfork,代码行数:26,代码来源:input_slider.cpp

示例9: triggerAction

void ValueSlider::
        triggerAction ( QAbstractSlider::SliderAction action )
{
    qreal d = slider_->maximum () - slider_->minimum ();
    qreal f = slider_->value () - slider_->minimum ();

    f /= d;

    switch(action)
    {
    case QAbstractSlider::SliderNoAction:       break;
    case QAbstractSlider::SliderSingleStepAdd:  f+=0.01; break;
    case QAbstractSlider::SliderSingleStepSub:  f-=0.01; break;
    case QAbstractSlider::SliderPageStepAdd:    f+=0.1; break;
    case QAbstractSlider::SliderPageStepSub:    f-=0.1; break;
    case QAbstractSlider::SliderToMinimum:      f=0; break;
    case QAbstractSlider::SliderToMaximum:      f=1; break;
    case QAbstractSlider::SliderMove:           break;
    }

    if (f<0) f = 0;
    if (f>1) f = 1;

    f *= d;

    slider_->setValue (slider_->minimum () + f);

    sliderMoved(slider_->value ());
}
开发者ID:aveminus,项目名称:freq,代码行数:29,代码来源:valueslider.cpp

示例10: available

void QSlider::moveSlider( int pos )
{
    int  a = available();
    int newPos = QMIN( a, QMAX( 0, pos ) );
    int newVal = valueFromPosition( newPos );
    if ( sliderVal != newVal ) {
	sliderVal = newVal;
	emit sliderMoved( sliderVal );
    }
    if ( tracking() && sliderVal != value() ) {
	setValue( sliderVal );
	// ### Why do we emit the valueChanged signal here?  It will get emitted in 
	// valueChange() anyway...
	//emit valueChanged( sliderVal );
    }

    switch ( (GUIStyle)style() ) {
    case WindowsStyle:
	newPos = positionFromValue( newVal );
	break;
    default:
    case MotifStyle:
	break;
    }

    if ( sliderPos != newPos )
	reallyMoveSlider( newPos );
}
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:28,代码来源:qslider.cpp

示例11: sliderRange

void
ScrollBar::catchSliderMoved(int value)
{
  double min, max;
  sliderRange(value, min, max);
  Q_EMIT sliderMoved(orientation(), min, max);
}
开发者ID:RTXI,项目名称:rtxi,代码行数:7,代码来源:scrollbar.cpp

示例12: processReleasedButton

void SoundSlider::mouseMoveEvent( QMouseEvent *event )
{
    /* handle mouserelease hijacking */
    if ( isSliding && ( event->buttons() & ~Qt::RightButton ) == Qt::NoButton )
        processReleasedButton();

    if( isSliding )
    {
        QRect rect( paddingL - 15,    -1,
                    wlength + 15 * 2 , wheight + 5 );
        if( !rect.contains( event->pos() ) )
        { /* We are outside */
            if ( !b_mouseOutside )
                setValue( i_oldvalue );
            b_mouseOutside = true;
        }
        else
        { /* We are inside */
            b_mouseOutside = false;
            changeValue( event->x() - paddingL );
            emit sliderMoved( value() );
        }
    }
    else
    {
        int i = ( ( event->x() - paddingL ) * maximum() + 40 ) / wlength;
        i = __MIN( __MAX( 0, i ), maximum() );
        setToolTip( QString("%1  %" ).arg( i ) );
    }
}
开发者ID:medoc92,项目名称:upplay,代码行数:30,代码来源:soundslider.cpp

示例13: value

void NSlider::wheelEvent(QWheelEvent *event)
{
    QSlider::wheelEvent(event);

    qreal val = value() / (qreal)maximum();
    emit sliderMoved(val);
}
开发者ID:chillin2,项目名称:nulloy,代码行数:7,代码来源:slider.cpp

示例14: sliderMoved

void PhMediaPanel::onSliderChanged(int position)
{
	PhTime time = position * PhTimeCode::timePerFrame(this->timeCodeType());
	if(_clock)
		_clock->setTime(time);
	emit sliderMoved(time);
}
开发者ID:FeodorFitsner,项目名称:Joker,代码行数:7,代码来源:PhMediaPanel.cpp

示例15: value

void SoundSlider::wheelEvent( QWheelEvent *event )
{
    int newvalue = value() + event->delta() / ( 8 * 15 ) * f_step;
    setValue( __MIN( __MAX( minimum(), newvalue ), maximum() ) );

    emit sliderReleased();
    emit sliderMoved( value() );
}
开发者ID:medoc92,项目名称:upplay,代码行数:8,代码来源:soundslider.cpp


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