16 #include <qlineedit.h>
17 #include <qvalidator.h>
75 QHBoxLayout* layout =
new QHBoxLayout(
this );
76 layout->setSpacing( 0 );
77 layout->setContentsMargins( QMargins() );
79 for (
int i =
ButtonCnt - 1; i >= 0; i-- )
83 btn->setFocusPolicy( Qt::NoFocus );
84 layout->addWidget( btn );
86 connect( btn, SIGNAL(released()), SLOT(
btnReleased()) );
87 connect( btn, SIGNAL(clicked()), SLOT(
btnClicked()) );
105 btn->setFocusPolicy( Qt::NoFocus );
106 layout->addWidget( btn );
108 connect( btn, SIGNAL(released()), SLOT(
btnReleased()) );
109 connect( btn, SIGNAL(clicked()), SLOT(
btnClicked()) );
120 QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) );
123 setFocusPolicy( Qt::StrongFocus );
473 bool converted =
false;
487 if (
event->type() == QEvent::PolishRequest )
499 return QWidget::event(
event );
526 bool accepted =
true;
528 switch (
event->key() )
532 if (
event->modifiers() & Qt::ControlModifier )
540 if (
event->modifiers() & Qt::ControlModifier )
557 case Qt::Key_PageDown:
564 if (
event->modifiers() & Qt::ShiftModifier )
567 if (
event->key() == Qt::Key_PageDown )
568 increment = -increment;
584 QWidget::keyPressEvent (
event );
601 if (
event->modifiers() & Qt::ControlModifier )
606 if (
event->modifiers() & Qt::ShiftModifier )
610 #if QT_VERSION < 0x050e00
611 const QPoint wheelPos =
event->pos();
612 const int wheelDelta =
event->delta();
614 const QPoint wheelPos =
event->position().toPoint();
616 const QPoint delta =
event->angleDelta();
617 const int wheelDelta = ( qAbs( delta.x() ) > qAbs( delta.y() ) )
618 ? delta.x() : delta.y();
644 stepSize =
qwtMaxF( stepSize, 1.0e-10 * ( max - min ) );
651 const double range = max - min;
655 value += std::ceil( ( min -
value ) / range ) * range;
657 else if (
value > max )
659 value -= std::ceil( (
value - max ) / range ) * range;
667 value = min + qRound( (
value - min ) / stepSize ) * stepSize;
669 if ( stepSize > 1e-12 )
671 if ( qFuzzyCompare(
value + 1.0, 1.0 ) )
676 else if ( qFuzzyCompare(
value, max ) )
732 text.setNum( number );
763 int w = tmp.setNum(
minimum() ).length();
764 int w1 = tmp.setNum(
maximum() ).length();
779 w += 2 * style()->pixelMetric( QStyle::PM_DefaultFrameWidth );
784 w += QWidget::sizeHint().width() -
m_data->
valueEdit->sizeHint().width();
786 const int h = qMin( QWidget::sizeHint().height(),
789 return QSize( w, h );
793 #include "moc_qwt_counter.cpp"