All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions | Protected Member Functions
QGpGuiTools::DoubleSpinBox Class Reference

Brief description of class still missing. More...

#include <DoubleSpinBox.h>

List of all members.

Public Member Functions

 DoubleSpinBox (QWidget *parent=0)
double value (double expectedValue) const
double value () const

Protected Member Functions

virtual void wheelEvent (QWheelEvent *event)

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

QGpGuiTools::DoubleSpinBox::DoubleSpinBox ( QWidget *  parent = 0)

Description of constructor still missing

References QGpCoreTools::tr(), and TRACE.

    : QDoubleSpinBox(parent)
{
  TRACE;
  switch(rand()%3) {
  default:
    setToolTip(tr("Need more precision? Press ALT while rolling wheel button."));
    break;
  case 1:
    setToolTip(tr("Need a smaller step? Press SHIFT while rolling wheel button."));
    break;
  case 2:
    setToolTip(tr("Need a temporary bigger step? Press CTRL while rolling wheel button."));
    break;
  }
}

Member Function Documentation

double QGpGuiTools::DoubleSpinBox::value ( double  expectedValue) const

Return the current value. If expectedValue is within the current precision of current value, the expected value is returned rather than the rounded current value.

References value().

Referenced by ToolHRFK::parameters(), SciFigs::NameLineDelegate::setModelData(), SourceDelegate::setModelData(), SciFigs::LegendTableDelegate::setModelData(), GeopsyGui::RingEditorDelegate::setModelData(), and SciFigs::LayerPropertiesDelegate::setModelData().

{
  // getting precision
  if(fabs( (value() - expectedValue) * pow(10.0, decimals()) ) > 1.0) {
    return value();
  } else {
    return expectedValue;
  }
}
double QGpGuiTools::DoubleSpinBox::value ( ) const [inline]

Referenced by value().

void QGpGuiTools::DoubleSpinBox::wheelEvent ( QWheelEvent *  event) [protected, virtual]

Let user change the precision and step (alt and shift, respectively)

References QGpCoreTools::tr(), and TRACE.

{
  TRACE;
  if(event->modifiers() & Qt::ShiftModifier) {
    if(event->delta() > 0) {
      setSingleStep(singleStep()*10.0);
    } else {
      if(singleStep()>=pow(0.1,decimals()-1)) {
        setSingleStep(singleStep()*0.1);
      }
    }
    showToolTip(tr("Step=%1").arg(singleStep()));
    event->accept();
  } else if(event->modifiers() & Qt::AltModifier) {
    if(event->delta() > 0) {
      setDecimals(decimals()+1);
    } else {
      setDecimals(decimals()-1);
    }
    showToolTip(tr("Decimals=%1").arg(decimals()));
    event->accept();
  } else {
    QDoubleSpinBox::wheelEvent(event);
  }
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines