Example #1
0
void TimeEdit::checkTimeChange(void) {
    this->blockSignals(true);
	if (itsUndefined) {
		if (itsPreviousTime == time()) {
			// NOTE: if minimum time equals the time then the special value text is shown
			setSpecialValueText(itsSpecialValueText);
			QTimeEdit::setTime(minimumTime());
		}
		else {
            itsUndefined = false;
            setSpecialValueText("");
		}
    }
    this->blockSignals(false);
}
Example #2
0
void TimeEdit::setUndefined(bool enabled) {
	this->blockSignals(true);
	itsUndefined = enabled;
	if (enabled) {
		itsPreviousTime = time();
		// NOTE: if minimum time equals the time then the special value text is shown
		setSpecialValueText(itsSpecialValueText);
		QTimeEdit::setTime(minimumTime());
	}
	else {
		setSpecialValueText("");
		QTimeEdit::setTime(itsPreviousTime);
	}
	this->blockSignals(false);
}
Example #3
0
void DateTimeEdit::checkDateTimeChange(void) {
    this->blockSignals(true);
	if (itsUndefined) {
		if (itsPreviousDateTime == dateTime()) { // was undefined and did not change -> re-apply opacity effect
			// NOTE: if minimum date equals the date then the special value text is shown
			setSpecialValueText(itsSpecialValueText);
			QDateTimeEdit::setDateTime(minimumDateTime());
		}
		else {
			itsUndefined = false;
			setSpecialValueText("");
		}
		itsPreviousDateTime = dateTime();
	}
    this->blockSignals(false);
}
Example #4
0
void TimeEdit::setTime(const QTime &time) {
	this->blockSignals(true);
	QTimeEdit::setTime(time);
	itsPreviousTime = time;
	setSpecialValueText("");
	itsUndefined = false;
	this->blockSignals(false);
}
Example #5
0
void DateTimeEdit::setDateTime(const QDateTime &datetime) {
    this->blockSignals(true);
    QDateTimeEdit::setDateTime(datetime);
    itsPreviousDateTime = QDateTimeEdit::dateTime();
    setSpecialValueText("");
    itsUndefined = false;
    this->blockSignals(false);
}
Example #6
0
/******************************************************************************
 * Set the spin box as valid or invalid.
 * If newly invalid, the value is displayed as asterisks.
 * If newly valid, the value is set to the minimum value.
 */
void TimeSpinBox::setValid(bool valid)
{
    if (valid  &&  mInvalid)
    {
        mInvalid = false;
        if (value() < mMinimumValue)
            SpinBox2::setValue(mMinimumValue);
        setSpecialValueText(QString());
        setMinValue(mMinimumValue);
    }
    else if (!valid  &&  !mInvalid)
    {
        mInvalid = true;
        setMinValue(mMinimumValue - 1);
        setSpecialValueText(QString::fromLatin1("**:**"));
        SpinBox2::setValue(mMinimumValue - 1);
    }
}
Example #7
0
void TimeEdit::focusInEvent(QFocusEvent* event)
{
	this->blockSignals(true);
	if (itsUndefined) {
		QTimeEdit::setTime(itsDefaultTime);
		setSpecialValueText("");
		itsPreviousTime = time();
	}

    QTimeEdit::focusInEvent(event);
    this->blockSignals(false);
}
Example #8
0
void QgsSpinBox::setClearValueMode( QgsSpinBox::ClearValueMode mode, const QString &specialValueText )
{
  mClearValueMode = mode;
  mCustomClearValue = 0;

  if ( !specialValueText.isEmpty() )
  {
    int v = value();
    clear();
    setSpecialValueText( specialValueText );
    setValue( v );
  }
}
Example #9
0
void QgsDoubleSpinBox::setClearValue( double customValue, const QString &specialValueText )
{
  mClearValueMode = CustomValue;
  mCustomClearValue = customValue;

  if ( !specialValueText.isEmpty() )
  {
    double v = value();
    clear();
    setSpecialValueText( specialValueText );
    setValue( v );
  }
}
Example #10
0
void QgsDoubleSpinBox::setClearValueMode( QgsDoubleSpinBox::ClearValueMode mode, const QString &clearValueText )
{
  mClearValueMode = mode;
  mCustomClearValue = 0;

  if ( !clearValueText.isEmpty() )
  {
    double v = value();
    clear();
    setSpecialValueText( clearValueText );
    setValue( v );
  }
}
Example #11
0
/******************************************************************************
 * Set the spin box's value.
 */
void TimeSpinBox::setValue(int minutes)
{
    if (!mEnteredSetValue)
    {
        mEnteredSetValue = true;
        mPm = (minutes >= 720);
        if (minutes > maxValue())
            setValid(false);
        else
        {
            if (mInvalid)
            {
                mInvalid = false;
                setSpecialValueText(QString());
                setMinValue(mMinimumValue);
            }
            SpinBox2::setValue(minutes);
            mEnteredSetValue = false;
        }
    }
}