本文整理汇总了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);
}
}
}
示例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);
}
示例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);
}
}
示例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 );
}
}
示例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();
}
示例6: setSliderPosition
void Knob::updatePosition(int val)
{
setSliderPosition(val);
setToolTip(QString::number(val));
update();
emit sliderMoved(val);
}
示例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);
}
示例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 ) );
}
}
示例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 ());
}
示例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 );
}
示例11: sliderRange
void
ScrollBar::catchSliderMoved(int value)
{
double min, max;
sliderRange(value, min, max);
Q_EMIT sliderMoved(orientation(), min, max);
}
示例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 ) );
}
}
示例13: value
void NSlider::wheelEvent(QWheelEvent *event)
{
QSlider::wheelEvent(event);
qreal val = value() / (qreal)maximum();
emit sliderMoved(val);
}
示例14: sliderMoved
void PhMediaPanel::onSliderChanged(int position)
{
PhTime time = position * PhTimeCode::timePerFrame(this->timeCodeType());
if(_clock)
_clock->setTime(time);
emit sliderMoved(time);
}
示例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() );
}