示例#1
0
void VESPERSMotorView::setControl(AMControl *control)
{
	// Disconnect everything first before starting over.
	hideAndDisconnect();

	control_ = control;
	type_ = Full;
	lowLimit_ = 0;
	highLimit_ = 0;
	if (QString::compare(control_->units(), "") == 0){

		units_->setText("mm");
		jogUnits_->setText("mm");
	}
	else{

		units_->setText(control_->units());
		jogUnits_->setText(control_->units());
	}
	title_->setText(control_->name());
	setpoint_->setText(QString::number(control_->value(), 'f', 3));
	jog_->setText(QString::number(0, 'f', 3));

	connect(stop_, SIGNAL(clicked()), control_, SLOT(stop()));
	connect(control_, SIGNAL(connected(bool)), this, SLOT(setEnabled(bool)));
	connect(control_, SIGNAL(unitsChanged(QString)), units_, SLOT(setText(QString)));
	connect(control_, SIGNAL(unitsChanged(QString)), jogUnits_, SLOT(setText(QString)));
	connect(control_, SIGNAL(setpointChanged(double)), this, SLOT(updateSetpoint(double)));
	connect(((AMPVwStatusControl *)control_)->movingPV(), SIGNAL(valueChanged(int)), this, SLOT(updateStatus(int)));

	connect(setpoint_, SIGNAL(returnPressed()), this, SLOT(move()));
	connect(jogLeft_, SIGNAL(clicked()), this, SLOT(jogLeft()));
	connect(jogRight_, SIGNAL(clicked()), this, SLOT(jogRight()));

	delete this->layout();

	QGridLayout *layout = new QGridLayout;
	layout->addWidget(title_, 0, 0, 1, 6);
	layout->addWidget(stop_, 1, 0);
	layout->addWidget(status_, 1, 1, 1, 5, Qt::AlignCenter);
	layout->addWidget(setpointLabel_, 2, 0, Qt::AlignRight);
	layout->addWidget(setpoint_, 2, 1, 1, 5);
	layout->addWidget(units_, 2, 5);
	layout->addWidget(jogLabel_, 3, 0, Qt::AlignRight);
	layout->addWidget(jogLeft_, 3, 1);
	layout->addWidget(jog_, 3, 2, 1, 3);
	layout->addWidget(jogUnits_, 3, 4);
	layout->addWidget(jogRight_, 3, 5);

	setpoint_->show();
	setpointLabel_->show();
	jogLabel_->show();
	jogLeft_->show();
	jog_->show();
	jogRight_->show();
	units_->show();
	jogUnits_->show();

	setLayout(layout);
}
示例#2
0
void VESPERSMotorView::setControl(AMControl *control, double firstSetpoint, double secondSetpoint, QString firstLabel, QString secondLabel)
{
	// Disconnect everything first before starting over.
	hideAndDisconnect();

	control_ = control;
	type_ = Simple;
	lowLimit_ = 0;
	highLimit_ = 0;
	units_->setText(control_->units());
	title_->setText(control_->name());
	firstSetpointButton_->setText(firstLabel);
	secondSetpointButton_->setText(secondLabel);
	firstSetpoint_ = firstSetpoint;
	secondSetpoint_ = secondSetpoint;

	connect(stop_, SIGNAL(clicked()), control_, SLOT(stop()));
	connect(control_, SIGNAL(connected(bool)), this, SLOT(setEnabled(bool)));
	connect(control_, SIGNAL(unitsChanged(QString)), units_, SLOT(setText(QString)));
	connect(control_, SIGNAL(unitsChanged(QString)), jogUnits_, SLOT(setText(QString)));
	connect(control_, SIGNAL(setpointChanged(double)), this, SLOT(updateSetpoint(double)));
	connect(((AMPVwStatusControl *)control_)->movingPV(), SIGNAL(valueChanged(int)), this, SLOT(updateStatus(int)));

	connect(firstSetpointButton_, SIGNAL(clicked()), this, SLOT(moveToFirstSetpoint()));
	connect(secondSetpointButton_, SIGNAL(clicked()), this, SLOT(moveToSecondSetpoint()));

//	this->layout()->deleteLater();
	delete this->layout();

	QGridLayout *layout = new QGridLayout;
	layout->addWidget(title_, 0, 0, 1, 4);
	layout->addWidget(stop_, 1, 0);
	layout->addWidget(status_, 1, 1, 1, 3, Qt::AlignCenter);
	layout->addWidget(firstSetpointButton_, 2, 0, 1, 2, Qt::AlignCenter);
	layout->addWidget(secondSetpointButton_, 2, 2, 1, 2, Qt::AlignCenter);

	firstSetpointButton_->show();
	secondSetpointButton_->show();

	setLayout(layout);
}