QGTItemDelegateEditor::QGTItemDelegateEditor(QWidget *parent) : QFrame(parent) {
	this->m_resetPushButton = new QPushButton(QIcon(QString(":/resource/widget/parameter_view_reset.png")), tr(""));
	this->m_resetPushButton->setSizePolicy(QSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed));
	this->setAutoFillBackground(true);

	connect(this->m_resetPushButton, SIGNAL(clicked()), this, SLOT(resetValue()));
}
Exemplo n.º 2
0
bool CToken::SetIntValue( long lValue)
{
	resetValue();
	_type = INT;
	_lValue = lValue;
	return true;
}
Exemplo n.º 3
0
bool CToken::SetFloatValue( float fValue)
{
	resetValue();
	_type = FLOAT;
	_fValue = fValue;
	return true;
}
QgsAttributeFormEditorWidget::QgsAttributeFormEditorWidget( QgsEditorWidgetWrapper* editorWidget, QgsAttributeForm* form )
    : QWidget( form )
    , mWidget( editorWidget )
    , mForm( form )
    , mMode( DefaultMode )
    , mMultiEditButton( new QgsMultiEditToolButton() )
    , mBlockValueUpdate( false )
    , mIsMixed( false )
    , mIsChanged( false )
{
  if ( !mWidget || !mForm )
    return;

  QLayout* l = new QHBoxLayout();
  l->setMargin( 0 );
  l->setContentsMargins( 0, 0, 0, 0 );
  l->addWidget( mWidget->widget() );

  if ( mWidget->widget() )
  {
    mWidget->widget()->setObjectName( mWidget->field().name() );
  }
  connect( mWidget, SIGNAL( valueChanged( const QVariant& ) ), this, SLOT( editorWidgetChanged( const QVariant & ) ) );
  connect( mMultiEditButton, SIGNAL( resetFieldValueTriggered() ), this, SLOT( resetValue() ) );
  connect( mMultiEditButton, SIGNAL( setFieldValueTriggered() ), this, SLOT( setFieldTriggered() ) );

  mMultiEditButton->setField( mWidget->field() );

  setLayout( l );
  updateWidgets();
}
Exemplo n.º 5
0
SpinSlider::SpinSlider(QString text, QString type, QString dataType, qreal min, qreal max, QWidget* parent)
    : QWidget(parent)
{
    value = 1.0;
    this->type = type;
    this->dataType = dataType;
    this->min = min;
    this->max = max;
    QPushButton* resetBtn = new QPushButton(tr("Reset"),this);
    connect(resetBtn, SIGNAL(clicked()), this, SLOT(resetValue()));
    QLabel* label = new QLabel(text+": ");
    label->setFont( QFont("Helvetica", 10) );
    valueLabel = new QLabel("--");
    valueLabel->setFont( QFont("Helvetica", 10) );
    //valueLabel->setFixedWidth(30);
    valueLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
    slider = new QSlider(Qt::Horizontal, this);
    slider->setMinimum(0);
    slider->setMaximum(100);
    //slider->setFixedHeight(16);
    QGridLayout *lay = new QGridLayout();
    lay->setMargin(2);
    lay->setSpacing(2);
    //lay->setColumnStretch(0,1);
    lay->addWidget(label,0,0,1,1);
    lay->addWidget(valueLabel,0,1,1,1);
    lay->addWidget(slider,1,0,1,3);
    lay->addWidget(resetBtn, 0, 2, 1, 1);
    setLayout(lay);
    setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);

    connect(slider, SIGNAL(valueChanged(int)), this, SLOT(changeValue(int)));
    connect(slider, SIGNAL(sliderReleased()), this, SLOT(sliderReleased()));
    connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(sliderMoved(int)));
}
void ObjectNodeInstance::doResetProperty(const QString &propertyName)
{
    m_modelAbstractPropertyHash.remove(propertyName);

    QDeclarativeProperty property(object(), propertyName, context());

    if (!property.isValid())
        return;

    QVariant oldValue = property.read();
    if (oldValue.type() == QVariant::Url) {
        QUrl url = oldValue.toUrl();
        QString path = url.toLocalFile();
        if (QFileInfo(path).exists() && nodeInstanceView())
            nodeInstanceView()->removeFilePropertyFromFileSystemWatcher(object(), propertyName, path);
    }


    QDeclarativeAbstractBinding *binding = QDeclarativePropertyPrivate::binding(property);
    if (binding) {
        binding->setEnabled(false, 0);
        binding->destroy();
    }

    if (property.isResettable()) {
        property.reset();
    } else if (property.propertyTypeCategory() == QDeclarativeProperty::List) {
        QDeclarativeListReference list = qvariant_cast<QDeclarativeListReference>(property.read());

        if (!hasFullImplementedListInterface(list)) {
            qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!";
            return;
        }

        list.clear();
    } else if (property.isWritable()) {
        if (property.read() == resetValue(propertyName))
            return;
        property.write(resetValue(propertyName));
    }
}
Exemplo n.º 7
0
AvgFilter::AvgFilter(int length=10, double lastValue=0.0)
	:	Filter	(lastValue),
		mValueList		(NULL),
		mValueLength	(length),
		mCurrentHeadIndex	(0)
{
	if (length <= 0)
	{
		length = 10;
	}
	mValueLength = 10;
	mValueList = new double[mValueLength];
	resetValue(mLastValue);
}
Exemplo n.º 8
0
SliderDialog::SliderDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl):
  CWindowInterface(parent, fl),
  mpParentWindow(NULL),
  mpContextMenu(NULL),
  mpCurrSlider(NULL),
  mSliderMap(),
  mTaskMap(),
  mCurrentFolderId(0),
  mSliderValueChanged(false),
  mSliderPressed(false),
  mFramework(0),
  mChanged(false)
{
#ifndef Darwin
  setWindowIcon(CQIconResource::icon(CQIconResource::copasi));
#endif // not Darwin

  setupUi(this);

  addToMainWindow(mpParentWindow);

  setObjectName(QString::fromUtf8(name));
  setWindowTitle("Slider Window");

  mpSliderBox->layout()->addItem(new QSpacerItem(0, 5, QSizePolicy::Minimum, QSizePolicy::Expanding));

  this->mpContextMenu = new QMenu(this);
  mpaCreateNewSlider = this->mpContextMenu->addAction("Add New Slider", this, SLOT(createNewSlider()));
  mpaRemoveSlider = this->mpContextMenu->addAction("Remove Slider", this, SLOT(removeSlider()));
  mpaEditSlider = this->mpContextMenu->addAction("Edit Slider", this, SLOT(editSlider()));
  mpaResetValue = this->mpContextMenu->addAction("Reset Value", this, SLOT(resetValue()));
  mpaSetDefault = this->mpContextMenu->addAction("Set new default value", this, SLOT(setDefault()));

  this->mSliderMap[C_INVALID_INDEX].push_back(new QLabel("<p>There are no sliders available for this task. If you select one of the tasks that supports sliders in the copasi object tree, this dialog will become active.</p>", mpSliderBox));

  this->mTaskMap[23] = &SliderDialog::runTimeCourse;
  this->mTaskMap[21] = &SliderDialog::runSteadyStateTask;
  this->mTaskMap[31] = &SliderDialog::runScanTask;
  this->mTaskMap[24] = &SliderDialog::runMCATask;
  this->mTaskMap[35] = &SliderDialog::runLNATask;
  this->mTaskMap[33] = &SliderDialog::runParameterEstimationTask;
  this->mTaskMap[32] = &SliderDialog::runOptimizationTask;
  this->mTaskMap[28] = &SliderDialog::runCrossSectionTask;

  connect(this->mpRunTaskButton, SIGNAL(clicked()), this, SLOT(runTask()));
  connect(this->mpNewSliderButton, SIGNAL(clicked()), this, SLOT(createNewSlider()));
  this->setCurrentFolderId(C_INVALID_INDEX);
  init();
}
Exemplo n.º 9
0
bool CToken::SetNameValue( LPCSTR szValue, int iSize)
{
	resetValue();
	
	LPSTR pNew = new char( iSize);
	if( pNew == NULL)
		return FALSE;

	memcpy( pNew, szValue, iSize);
	pNew[iSize-1] = '\0';
	
	_type = NAME;
	szValue = pNew;
	
	return true;
}
Exemplo n.º 10
0
Parameter::Parameter(const Type &type, const String &niceName, const String &description, var initialValue, var minValue = var(), var maxValue = var(), bool enabled) :
	Controllable(type, niceName, description, enabled),
	lockManualControlMode(false),
	controlMode(MANUAL),
	isPresettable(true),
	isOverriden(false),
	autoAdaptRange(false),
	queuedNotifier(100)
{
	minimumValue = minValue;
	maximumValue = maxValue;
	defaultMinValue = minValue;
	defaultMaxValue = maxValue;

	defaultValue = initialValue;

	resetValue(true);

	scriptObject.setMethod("get", Parameter::getValueFromScript);
	scriptObject.setMethod("set", Controllable::setValueFromScript);
}
Exemplo n.º 11
0
void ObjectNodeInstance::refreshProperty(const PropertyName &name)
{
    QQmlProperty property(object(), QString::fromUtf8(name), context());

    if (!property.isValid())
        return;

    QVariant oldValue(property.read());

    if (property.isResettable())
        property.reset();
    else
        property.write(resetValue(name));

    if (oldValue.type() == QVariant::Url) {
        QByteArray key = oldValue.toUrl().toEncoded(QUrl::UrlFormattingOption(0x100));
        QString pixmapKey = QString::fromUtf8(key.constData(), key.count());
        QPixmapCache::remove(pixmapKey);
    }

    property.write(oldValue);
}
Exemplo n.º 12
0
BoolSetting::BoolSetting(QString note, bool checked, QWidget *parent) :
    QFrame(parent), checked(checked), checkedDefault(checked)
{  
    //Setup widgets
    boolBox = new QToolButton(this);
    boolBox->setCheckable(true);
    titleText = new QLabel(note, this);
    boolReset = new QToolButton(this);
    boolReset->setCheckable(true);
    boolReset->setArrowType(Qt::LeftArrow);
    setChecked(checked);
    setEnabled(true);

    //Connect widgets
    connect(boolBox, SIGNAL(toggled(bool)), SLOT(setChecked(bool)));
    connect(boolReset, SIGNAL(clicked()), SLOT(resetValue()));

    //Show widgets
    QHBoxLayout *holder = new QHBoxLayout(this);
    holder->addWidget(boolBox);
    holder->addWidget(titleText);
    holder->addWidget(boolReset);
    this->setLayout(holder);
}
Exemplo n.º 13
0
// Setup encoder pins
void Encoder::begin(int encPinA, int encPinB)
{
  Encoder::encoderPinA = encPinA;
  Encoder::encoderPinB = encPinB;
  
  pinMode(Encoder::encoderPinA, INPUT_PULLUP); 
  pinMode(Encoder::encoderPinB, INPUT_PULLUP);
  resetValue();
  Encoder::rotating = false;
  lastRotatedTime = 0;
  // interrupt service routine vars
  Encoder::A_set = false;
  Encoder::B_set = false;

  // encoder pin on interrupt 0 on pin D2
  attachInterrupt(0, rotatingCW, CHANGE);

  // encoder pin on interrupt 1 on pin D3
//srg using pin 3 for PWM, can't use for interrupt.  Need to use PinChangeInt.h  http://code.google.com/p/arduino-pinchangeint/wiki/Usage
 // attachInterrupt(1, rotatingCCW, CHANGE);
  
  // http://code.google.com/p/arduino-pinchangeint/wiki/Usage
  
} // begin()
Exemplo n.º 14
0
ReseterSlider::ReseterSlider(QWidget *parent) :
    QSlider(parent)
{
    connect(this, SIGNAL(sliderReleased()), this, SLOT(resetValue()));
}
Exemplo n.º 15
0
CToken::~CToken()
{
	resetValue();
}
Exemplo n.º 16
0
void AC_RotatingPot::resetValue() {
  resetValue(0);
}
Exemplo n.º 17
0
void AC_RotatingPot::begin() {
  pinMode(inputPin, INPUT);
  resetValue(0);
}
Exemplo n.º 18
0
 SharedTestService(QObject* parent = 0) 
     : QObject(parent)
 {
     resetValue();
 }
Exemplo n.º 19
0
void
ValuePage::onResetClicked() {
  resetValue();
  m_cbAddOrRemove->setChecked(false);
  m_input->setEnabled(m_present);
}