Gui slot call focus fix (#150)

* fix for editingFinished for qlineedit using isModified()

* spinbox disable keyboard tracking to use valuechanged so slot called only after editing finished, focus fix

* return pressed forces qtextfield to be set (slot for tab checks for modification flag due to avoid unnecessary set when focus). This is to remove inconsistencies from command line. A return should set even if it looks like no modification in gui

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
This commit is contained in:
Dhanya Thattil
2020-09-02 16:56:57 +02:00
committed by GitHub
parent 050f0ff8a0
commit 180c7b7191
15 changed files with 290 additions and 133 deletions

View File

@@ -87,9 +87,9 @@ void qTabPlot::Initialization() {
SLOT(SetStreamingFrequency()));
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetStreamingFrequency()));
connect(spinTimeGap, SIGNAL(editingFinished()), this,
connect(spinTimeGap, SIGNAL(valueChanged(double)), this,
SLOT(SetStreamingFrequency()));
connect(spinNthFrame, SIGNAL(editingFinished()), this,
connect(spinNthFrame, SIGNAL(valueChanged(int)), this,
SLOT(SetStreamingFrequency()));
// navigation buttons for options
@@ -174,17 +174,17 @@ void qTabPlot::Initialization() {
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(isXMinModified()));
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(isXMaxModified()));
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(isYMinModified()));
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(isYMaxModified()));
connect(chkAspectRatio, SIGNAL(toggled(bool)), this,
SLOT(CheckAspectRatio()));
connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(isZMinModified()));
connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(isZMaxModified()));
}
void qTabPlot::Select1DPlot(bool enable) {
@@ -389,6 +389,48 @@ void qTabPlot::SetTitles() {
SLOT(SetTitles()));
}
void qTabPlot::isXMinModified() {
if (dispXMin->isModified()) {
dispXMin->setModified(false);
SetXRange();
}
}
void qTabPlot::isXMaxModified() {
if (dispXMax->isModified()) {
dispXMax->setModified(false);
SetXRange();
}
}
void qTabPlot::isYMinModified() {
if (dispYMin->isModified()) {
dispYMin->setModified(false);
SetYRange();
}
}
void qTabPlot::isYMaxModified() {
if (dispYMax->isModified()) {
dispYMax->setModified(false);
SetYRange();
}
}
void qTabPlot::isZMinModified() {
if (dispZMin->isModified()) {
dispZMin->setModified(false);
SetZRange();
}
}
void qTabPlot::isZMaxModified() {
if (dispZMax->isModified()) {
dispZMax->setModified(false);
SetZRange();
}
}
void qTabPlot::SetXRange() {
LOG(logDEBUG) << "Enable X axis range";
@@ -452,10 +494,14 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
disconnect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
disconnect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
disconnect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
disconnect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
disconnect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
disconnect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
disconnect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
disconnect(dispXMin, SIGNAL(editingFinished()), this,
SLOT(isXMinModified()));
disconnect(dispXMax, SIGNAL(editingFinished()), this,
SLOT(isXMaxModified()));
disconnect(dispYMin, SIGNAL(editingFinished()), this,
SLOT(isYMinModified()));
disconnect(dispYMax, SIGNAL(editingFinished()), this,
SLOT(isYMaxModified()));
// check all, fill all
chkXMin->setChecked(true);
@@ -550,10 +596,10 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(isXMinModified()));
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(isXMaxModified()));
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(isYMinModified()));
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(isYMaxModified()));
bool isRange[4]{true, true, true, true};
plot->SetXYRangeChanged(true, ranges, isRange);
@@ -583,9 +629,9 @@ void qTabPlot::GetStreamingFrequency() {
SLOT(SetStreamingFrequency()));
disconnect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetStreamingFrequency()));
disconnect(spinTimeGap, SIGNAL(editingFinished()), this,
disconnect(spinTimeGap, SIGNAL(valueChanged(double)), this,
SLOT(SetStreamingFrequency()));
disconnect(spinNthFrame, SIGNAL(editingFinished()), this,
disconnect(spinNthFrame, SIGNAL(valueChanged(int)), this,
SLOT(SetStreamingFrequency()));
try {
int freq = det->getRxZmqFrequency().tsquash(
@@ -621,9 +667,9 @@ void qTabPlot::GetStreamingFrequency() {
SLOT(SetStreamingFrequency()));
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetStreamingFrequency()));
connect(spinTimeGap, SIGNAL(editingFinished()), this,
connect(spinTimeGap, SIGNAL(valueChanged(double)), this,
SLOT(SetStreamingFrequency()));
connect(spinNthFrame, SIGNAL(editingFinished()), this,
connect(spinNthFrame, SIGNAL(valueChanged(int)), this,
SLOT(SetStreamingFrequency()));
}