mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 14:38:14 +02:00
fixed the losing focus too often problem in rangeSizeWidget for scanwidget
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@34 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
parent
6c19d75359
commit
40af9384b5
@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include
|
|||||||
RESOURCES += icons.qrc
|
RESOURCES += icons.qrc
|
||||||
|
|
||||||
|
|
||||||
DEFINES += VERBOSE DACS_INT
|
DEFINES += VERBOSE DACS_INT VERYVERBOSE
|
||||||
|
|
||||||
|
|
||||||
target.path += $(DESTDIR)
|
target.path += $(DESTDIR)
|
||||||
|
@ -87,17 +87,21 @@ void qScanWidget::SetupWidgetWindow(){
|
|||||||
spinFrom->setValue(0);
|
spinFrom->setValue(0);
|
||||||
spinFrom->setToolTip(rangeTip);
|
spinFrom->setToolTip(rangeTip);
|
||||||
spinFrom->setMaximum(1000000);
|
spinFrom->setMaximum(1000000);
|
||||||
|
spinFrom->setKeyboardTracking(false);
|
||||||
lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
lblTo->setToolTip(rangeTip);
|
lblTo->setToolTip(rangeTip);
|
||||||
spinTo->setValue(1);
|
spinTo->setValue(1);
|
||||||
spinTo->setToolTip(rangeTip);
|
spinTo->setToolTip(rangeTip);
|
||||||
spinTo->setMaximum(1000000);
|
spinTo->setMaximum(1000000);
|
||||||
|
spinTo->setKeyboardTracking(false);
|
||||||
lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
lblSize->setToolTip(rangeTip);
|
lblSize->setToolTip(rangeTip);
|
||||||
lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
lblSize->setFixedWidth(67);
|
lblSize->setFixedWidth(67);
|
||||||
spinSize->setValue(1);
|
spinSize->setValue(1);
|
||||||
|
spinSize->setSingleStep(0.1);
|
||||||
spinSize->setToolTip(rangeTip);
|
spinSize->setToolTip(rangeTip);
|
||||||
|
spinSize->setKeyboardTracking(false);
|
||||||
layoutRange->addItem(new QSpacerItem(40,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
layoutRange->addItem(new QSpacerItem(40,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||||
layoutRange->addWidget(lblFrom);
|
layoutRange->addWidget(lblFrom);
|
||||||
layoutRange->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
layoutRange->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||||
@ -175,9 +179,9 @@ void qScanWidget::Initialization(){
|
|||||||
//precision
|
//precision
|
||||||
connect(spinPrecision, SIGNAL(valueChanged(int)), this, SLOT(SetPrecision(int)));
|
connect(spinPrecision, SIGNAL(valueChanged(int)), this, SLOT(SetPrecision(int)));
|
||||||
//range values
|
//range values
|
||||||
connect(spinFrom, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps()));
|
connect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
connect(spinTo, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps()));
|
connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
connect(spinSize, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps()));
|
connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
//custom values
|
//custom values
|
||||||
connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps()));
|
connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps()));
|
||||||
connect(btnCustom, SIGNAL(clicked()), this, SLOT(DeleteCustomSteps()));
|
connect(btnCustom, SIGNAL(clicked()), this, SLOT(DeleteCustomSteps()));
|
||||||
@ -191,8 +195,8 @@ void qScanWidget::Initialization(){
|
|||||||
|
|
||||||
|
|
||||||
void qScanWidget::EnableSizeWidgets(){
|
void qScanWidget::EnableSizeWidgets(){
|
||||||
#ifdef VERBOSE
|
#ifdef VERYVERBOSE
|
||||||
cout << "Entering enable size widgets" << endl;
|
cout << "Entering EnableSizeWidgets()" << endl;
|
||||||
#endif
|
#endif
|
||||||
//setting to defaults is not done here as this is called even if mode changes
|
//setting to defaults is not done here as this is called even if mode changes
|
||||||
//so only if its to change the size widget type, its set to default for the others
|
//so only if its to change the size widget type, its set to default for the others
|
||||||
@ -286,6 +290,9 @@ void qScanWidget::EnableSizeWidgets(){
|
|||||||
|
|
||||||
|
|
||||||
void qScanWidget::SetMode(int mode){
|
void qScanWidget::SetMode(int mode){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cout << "Entering SetMode()" << endl;
|
||||||
|
#endif
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Setting\tscan:" << id << "\tmode:" << mode << endl;
|
cout << "Setting\tscan:" << id << "\tmode:" << mode << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -332,6 +339,9 @@ void qScanWidget::SetMode(int mode){
|
|||||||
|
|
||||||
|
|
||||||
int qScanWidget::SetScan(int mode){
|
int qScanWidget::SetScan(int mode){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cout << "Entering SetScan()" << endl;
|
||||||
|
#endif
|
||||||
string parameter = string(dispParameter->text().toAscii().constData());
|
string parameter = string(dispParameter->text().toAscii().constData());
|
||||||
string script = string(dispScript->text().toAscii().constData());
|
string script = string(dispScript->text().toAscii().constData());
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -384,6 +394,9 @@ int qScanWidget::SetScan(int mode){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void qScanWidget::BrowsePath(){
|
void qScanWidget::BrowsePath(){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cout << "Entering BrowsePath()" << endl;
|
||||||
|
#endif
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Browsing Script File Path\tscan:" << id << endl;
|
cout << "Browsing Script File Path\tscan:" << id << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -404,6 +417,9 @@ void qScanWidget::BrowsePath(){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void qScanWidget::SetScriptFile(){
|
void qScanWidget::SetScriptFile(){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cout << "Entering SetScriptFile()" << endl;
|
||||||
|
#endif
|
||||||
QString fName = dispScript->text();bool set = false;
|
QString fName = dispScript->text();bool set = false;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Setting\tscan:" << id << "\tscript:" << fName.toAscii().constData() << endl;
|
cout << "Setting\tscan:" << id << "\tscript:" << fName.toAscii().constData() << endl;
|
||||||
@ -465,6 +481,9 @@ void qScanWidget::SetScriptFile(){
|
|||||||
|
|
||||||
|
|
||||||
void qScanWidget::SetParameter(){
|
void qScanWidget::SetParameter(){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cout << "Entering SetParameter()" << endl;
|
||||||
|
#endif
|
||||||
QString parameter = dispParameter->text();
|
QString parameter = dispParameter->text();
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Setting\tscan:" << id << "\tparameter:" << parameter.toAscii().constData() << endl;
|
cout << "Setting\tscan:" << id << "\tparameter:" << parameter.toAscii().constData() << endl;
|
||||||
@ -485,6 +504,9 @@ void qScanWidget::SetParameter(){
|
|||||||
|
|
||||||
|
|
||||||
void qScanWidget::SetPrecision(int value){
|
void qScanWidget::SetPrecision(int value){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cout << "Entering SetPrecision()" << endl;
|
||||||
|
#endif
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Setting\tscan:" << id << "\tprecision:" << value << endl;
|
cout << "Setting\tscan:" << id << "\tprecision:" << value << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -498,7 +520,9 @@ void qScanWidget::SetPrecision(int value){
|
|||||||
|
|
||||||
|
|
||||||
void qScanWidget::SetNSteps(int num){
|
void qScanWidget::SetNSteps(int num){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cout << "Entering SetNSteps()" << endl;
|
||||||
|
#endif
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Setting number of steps" << endl;
|
cout << "Setting number of steps" << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -510,15 +534,15 @@ void qScanWidget::SetNSteps(int num){
|
|||||||
if(radioRange->isChecked()){
|
if(radioRange->isChecked()){
|
||||||
//calculate the step size and display it
|
//calculate the step size and display it
|
||||||
if(num==1){
|
if(num==1){
|
||||||
disconnect(spinTo, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps()));
|
disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
spinTo->setValue(spinFrom->value());
|
spinTo->setValue(spinFrom->value());
|
||||||
connect(spinTo, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps()));
|
connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
}else if(num>1)
|
}else if(num>1)
|
||||||
num--;
|
num--;
|
||||||
double stepSize = (spinTo->value()-spinFrom->value())/num;
|
double stepSize = (spinTo->value()-spinFrom->value())/num;
|
||||||
disconnect(spinSize,SIGNAL(editingFinished()), this, SLOT(SetRangeSteps()));
|
disconnect(spinSize,SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
spinSize->setValue(stepSize);
|
spinSize->setValue(stepSize);
|
||||||
connect(spinSize, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps()));
|
connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
//set these positions
|
//set these positions
|
||||||
SetRangeSteps();
|
SetRangeSteps();
|
||||||
}else if(radioCustom->isChecked()){
|
}else if(radioCustom->isChecked()){
|
||||||
@ -534,6 +558,9 @@ void qScanWidget::SetNSteps(int num){
|
|||||||
|
|
||||||
|
|
||||||
void qScanWidget::SetRangeSteps(){
|
void qScanWidget::SetRangeSteps(){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cout << "Entering SetRangeSteps()" << endl;
|
||||||
|
#endif
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Setting\tscan:" << id << "\trange\t";
|
cout << "Setting\tscan:" << id << "\trange\t";
|
||||||
#endif
|
#endif
|
||||||
@ -541,9 +568,9 @@ void qScanWidget::SetRangeSteps(){
|
|||||||
double sizeVal = spinSize->value();
|
double sizeVal = spinSize->value();
|
||||||
//if step size is 0, min and max should be same
|
//if step size is 0, min and max should be same
|
||||||
if(!sizeVal){
|
if(!sizeVal){
|
||||||
disconnect(spinTo, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps()));
|
disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
spinTo->setValue(fromVal);
|
spinTo->setValue(fromVal);
|
||||||
connect(spinTo, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps()));
|
connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
QString tip = rangeTip + QString("<br><br><font color=\"red\">"
|
QString tip = rangeTip + QString("<br><br><font color=\"red\">"
|
||||||
"<nobr>Note: Increase the <b>step size</b> from zero to be able to change the range.</nobr></font>");
|
"<nobr>Note: Increase the <b>step size</b> from zero to be able to change the range.</nobr></font>");
|
||||||
lblSize->setToolTip(tip);
|
lblSize->setToolTip(tip);
|
||||||
@ -563,9 +590,9 @@ void qScanWidget::SetRangeSteps(){
|
|||||||
//actualNumSteps will be negative if from<to and size wasnt negative.so change it to positive
|
//actualNumSteps will be negative if from<to and size wasnt negative.so change it to positive
|
||||||
if(actualNumSteps<0){
|
if(actualNumSteps<0){
|
||||||
actualNumSteps*=-1;
|
actualNumSteps*=-1;
|
||||||
disconnect(spinSize,SIGNAL(editingFinished()), this, SLOT(SetRangeSteps()));
|
disconnect(spinSize,SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
spinSize->setValue(-1*sizeVal);
|
spinSize->setValue(-1*sizeVal);
|
||||||
connect(spinSize, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps()));
|
connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
sizeVal = spinSize->value();
|
sizeVal = spinSize->value();
|
||||||
}
|
}
|
||||||
//increment is required like vice versa in setNSteps
|
//increment is required like vice versa in setNSteps
|
||||||
@ -593,6 +620,11 @@ void qScanWidget::SetRangeSteps(){
|
|||||||
if(SetScan(comboScript->currentIndex())==qDefs::OK){
|
if(SetScan(comboScript->currentIndex())==qDefs::OK){
|
||||||
char cId[5];sprintf(cId,"%d",id);
|
char cId[5];sprintf(cId,"%d",id);
|
||||||
QString script = dispScript->text();
|
QString script = dispScript->text();
|
||||||
|
|
||||||
|
disconnect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
|
disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
|
disconnect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
|
|
||||||
//positions wont be loaded if its custom script
|
//positions wont be loaded if its custom script
|
||||||
if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){
|
if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){
|
||||||
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
||||||
@ -613,6 +645,11 @@ void qScanWidget::SetRangeSteps(){
|
|||||||
string(cNum)+string("</nobr>"),"ScanWidget");
|
string(cNum)+string("</nobr>"),"ScanWidget");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
|
connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
|
connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -621,7 +658,9 @@ void qScanWidget::SetRangeSteps(){
|
|||||||
|
|
||||||
|
|
||||||
int qScanWidget::SetCustomSteps(){
|
int qScanWidget::SetCustomSteps(){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cout << "Entering SetCustomSteps()" << endl;
|
||||||
|
#endif
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Setting\tscan:" << id << "\tcustom\tnum pos:" << comboCustom->count() << endl;
|
cout << "Setting\tscan:" << id << "\tcustom\tnum pos:" << comboCustom->count() << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -707,6 +746,9 @@ int qScanWidget::SetCustomSteps(){
|
|||||||
|
|
||||||
|
|
||||||
void qScanWidget::DeleteCustomSteps(){
|
void qScanWidget::DeleteCustomSteps(){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cout << "Entering DeleteCustomSteps()" << endl;
|
||||||
|
#endif
|
||||||
QString pos = comboCustom->currentText();
|
QString pos = comboCustom->currentText();
|
||||||
bool found = false;
|
bool found = false;
|
||||||
//loops through to find the index and to make sure its in the list
|
//loops through to find the index and to make sure its in the list
|
||||||
@ -729,6 +771,9 @@ void qScanWidget::DeleteCustomSteps(){
|
|||||||
|
|
||||||
|
|
||||||
void qScanWidget::SetFileSteps(){
|
void qScanWidget::SetFileSteps(){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cout << "Entering SetFileSteps()" << endl;
|
||||||
|
#endif
|
||||||
QString fName = dispFile->text();
|
QString fName = dispFile->text();
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Setting\tscan:" << id << "\tfile\t:" << fName.toAscii().constData() << endl;
|
cout << "Setting\tscan:" << id << "\tfile\t:" << fName.toAscii().constData() << endl;
|
||||||
@ -848,6 +893,9 @@ void qScanWidget::SetFileSteps(){
|
|||||||
|
|
||||||
|
|
||||||
void qScanWidget::BrowseFileStepsPath(){
|
void qScanWidget::BrowseFileStepsPath(){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cout << "Entering BrowseFileStepsPath()" << endl;
|
||||||
|
#endif
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Browsing Steps File Path\tscan:" << id << endl;
|
cout << "Browsing Steps File Path\tscan:" << id << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -871,8 +919,8 @@ void qScanWidget::BrowseFileStepsPath(){
|
|||||||
|
|
||||||
|
|
||||||
void qScanWidget::LoadPositions(){
|
void qScanWidget::LoadPositions(){
|
||||||
#ifdef VERBOSE
|
#ifdef VERYVERBOSE
|
||||||
cout << "Loading positions" << endl;
|
cout << "Entering LoadPositions()" << endl;
|
||||||
#endif
|
#endif
|
||||||
disconnect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps()));
|
disconnect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps()));
|
||||||
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
||||||
@ -937,6 +985,9 @@ void qScanWidget::LoadPositions(){
|
|||||||
|
|
||||||
|
|
||||||
void qScanWidget::Refresh(){
|
void qScanWidget::Refresh(){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cout << "Entering Refresh()" << endl;
|
||||||
|
#endif
|
||||||
int mode = (myDet->getScanMode(id));
|
int mode = (myDet->getScanMode(id));
|
||||||
string script = myDet->getScanScript(id);
|
string script = myDet->getScanScript(id);
|
||||||
string parameter = myDet->getScanParameter(id);
|
string parameter = myDet->getScanParameter(id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user