Beispiel #1
0
void LinearGauge::loadSettings( QSettings& pSettings )
{
	// Scale
	Qt::Orientation orientation = (Qt::Orientation) pSettings.value("orientation", Qt::Vertical).toInt();
	QwtThermo::ScalePos scalePosition = (QwtThermo::ScalePos) pSettings.value("scalePosition", QwtThermo::LeftScale).toInt();
	setOrientation( orientation, scalePosition );
	setMinValue( pSettings.value("minValue", 0).toDouble() );
	setMaxValue( pSettings.value("maxValue", 10).toDouble() );

	// Ticks
	setScaleMaxMinor( pSettings.value("scaleMaxMinor", 4).toInt() );
	setScaleMaxMajor( pSettings.value("scaleMaxMajor", 12).toInt() );
	scaleDraw()->enableComponent( QwtAbstractScaleDraw::Labels, pSettings.value("labels", true).toBool() );
	setFont( QFont(	pSettings.value("font").toString(), pSettings.value("fontSize", 8).toDouble()) );

	// Pipe
	setValue( pSettings.value("value", 8).toDouble() );
	setPipeWidth( pSettings.value("pipeWidth", 10).toInt() );
	setFillBrush( QBrush( pSettings.value("pipeColor").toUInt() ) );

	// Alarm
	setAlarmLevel( pSettings.value("alarmLevel", 7).toDouble() );
	setAlarmBrush( QBrush( pSettings.value("alarmBrush").toUInt() ) );
	setAlarmEnabled( pSettings.value("alarmEnabled").toBool() );	

	// Color
	setTextColor( pSettings.value("textColor").toUInt() );
	setBackgroundColor( pSettings.value("backgroundColor").toUInt() );

	AbstractGauge::loadSettings( pSettings );
}
Beispiel #2
0
int QwtThermo::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setValue((*reinterpret_cast< double(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 1;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = alarmEnabled(); break;
        case 1: *reinterpret_cast< double*>(_v) = alarmLevel(); break;
        case 2: *reinterpret_cast< ScalePos*>(_v) = scalePosition(); break;
        case 3: *reinterpret_cast< int*>(_v) = spacing(); break;
        case 4: *reinterpret_cast< int*>(_v) = borderWidth(); break;
        case 5: *reinterpret_cast< double*>(_v) = maxValue(); break;
        case 6: *reinterpret_cast< double*>(_v) = minValue(); break;
        case 7: *reinterpret_cast< int*>(_v) = pipeWidth(); break;
        case 8: *reinterpret_cast< double*>(_v) = value(); break;
        }
        _id -= 9;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setAlarmEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 1: setAlarmLevel(*reinterpret_cast< double*>(_v)); break;
        case 2: setScalePosition(*reinterpret_cast< ScalePos*>(_v)); break;
        case 3: setSpacing(*reinterpret_cast< int*>(_v)); break;
        case 4: setBorderWidth(*reinterpret_cast< int*>(_v)); break;
        case 5: setMaxValue(*reinterpret_cast< double*>(_v)); break;
        case 6: setMinValue(*reinterpret_cast< double*>(_v)); break;
        case 7: setPipeWidth(*reinterpret_cast< int*>(_v)); break;
        case 8: setValue(*reinterpret_cast< double*>(_v)); break;
        }
        _id -= 9;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 9;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Beispiel #3
0
LinearGauge::LinearGauge(QWidget *pParent)
	: QwtThermo(pParent)
{
	setOrientation( Qt::Vertical, QwtThermo::LeftScale );
	setRange( 0, 10 );
	setFillBrush( Qt::green );
	setAlarmBrush( Qt::red );
	setAlarmLevel( 7.0 );
	setAlarmEnabled( true );
	setValue( 8.0 );
}
Beispiel #4
0
int QwtThermo::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QwtAbstractScale::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 1)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 1;
    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
        if (_id < 1)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 1;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< Qt::Orientation*>(_v) = orientation(); break;
        case 1: *reinterpret_cast< ScalePosition*>(_v) = scalePosition(); break;
        case 2: *reinterpret_cast< OriginMode*>(_v) = originMode(); break;
        case 3: *reinterpret_cast< bool*>(_v) = alarmEnabled(); break;
        case 4: *reinterpret_cast< double*>(_v) = alarmLevel(); break;
        case 5: *reinterpret_cast< double*>(_v) = origin(); break;
        case 6: *reinterpret_cast< int*>(_v) = spacing(); break;
        case 7: *reinterpret_cast< int*>(_v) = borderWidth(); break;
        case 8: *reinterpret_cast< int*>(_v) = pipeWidth(); break;
        case 9: *reinterpret_cast< double*>(_v) = value(); break;
        }
        _id -= 10;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setOrientation(*reinterpret_cast< Qt::Orientation*>(_v)); break;
        case 1: setScalePosition(*reinterpret_cast< ScalePosition*>(_v)); break;
        case 2: setOriginMode(*reinterpret_cast< OriginMode*>(_v)); break;
        case 3: setAlarmEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 4: setAlarmLevel(*reinterpret_cast< double*>(_v)); break;
        case 5: setOrigin(*reinterpret_cast< double*>(_v)); break;
        case 6: setSpacing(*reinterpret_cast< int*>(_v)); break;
        case 7: setBorderWidth(*reinterpret_cast< int*>(_v)); break;
        case 8: setPipeWidth(*reinterpret_cast< int*>(_v)); break;
        case 9: setValue(*reinterpret_cast< double*>(_v)); break;
        }
        _id -= 10;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 10;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 10)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 10;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}