From 9c3604ab60dac558897e16dce1610bc9cba33a5e Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 3 Feb 2016 14:15:40 +0300 Subject: [PATCH] Correction of a distance restart operation. Some code corrections. --- src/ModuleBase/ModuleBase_DoubleSpinBox.cpp | 6 ------ src/ModuleBase/ModuleBase_DoubleSpinBox.h | 1 - src/ModuleBase/ModuleBase_WidgetEditor.cpp | 16 ---------------- src/ModuleBase/ModuleBase_WidgetEditor.h | 5 ----- 4 files changed, 28 deletions(-) diff --git a/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp b/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp index 851a74834..dba8c5d0f 100644 --- a/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp @@ -200,24 +200,18 @@ QString ModuleBase_DoubleSpinBox::removeTrailingZeroes(const QString& src) const void ModuleBase_DoubleSpinBox::keyPressEvent(QKeyEvent* theEvent) { - bool isEmitKeyRelease = false; switch (theEvent->key()) { case Qt::Key_Enter: case Qt::Key_Return: { // do not react to the Enter key, the property panel processes it if (!myIsEmitKeyPressEvent) return; - else - isEmitKeyRelease = true; } break; default: break; } QDoubleSpinBox::keyPressEvent(theEvent); - - if (isEmitKeyRelease) - emit enterPressed(); } void ModuleBase_DoubleSpinBox::keyReleaseEvent(QKeyEvent* theEvent) diff --git a/src/ModuleBase/ModuleBase_DoubleSpinBox.h b/src/ModuleBase/ModuleBase_DoubleSpinBox.h index ec18e3500..4fbdbccb2 100644 --- a/src/ModuleBase/ModuleBase_DoubleSpinBox.h +++ b/src/ModuleBase/ModuleBase_DoubleSpinBox.h @@ -57,7 +57,6 @@ Q_OBJECT signals: /// The signal about key release on the control, that corresponds to the attribute /// \param theEvent key release event - void enterPressed(); void enterReleased(); protected slots: diff --git a/src/ModuleBase/ModuleBase_WidgetEditor.cpp b/src/ModuleBase/ModuleBase_WidgetEditor.cpp index 08086481b..41ec508e2 100644 --- a/src/ModuleBase/ModuleBase_WidgetEditor.cpp +++ b/src/ModuleBase/ModuleBase_WidgetEditor.cpp @@ -36,7 +36,6 @@ ModuleBase_WidgetEditor::ModuleBase_WidgetEditor(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId) : ModuleBase_WidgetDoubleValue(theParent, theData, theParentId), - //myIsEnterPressedEmitted(false), myXPosition(-1), myYPosition(-1) { } @@ -53,9 +52,6 @@ void ModuleBase_WidgetEditor::editedValue(double& outValue, QString& outText) ModuleBase_ParamSpinBox* anEditor = new ModuleBase_ParamSpinBox(&aDlg); anEditor->enableKeyPressEvent(true); - //if (!myIsEditing) { - // connect(anEditor, SIGNAL(enterPressed()), this, SLOT(onEnterPressed())); - //} anEditor->setMinimum(0); anEditor->setMaximum(DBL_MAX); @@ -77,10 +73,6 @@ void ModuleBase_WidgetEditor::editedValue(double& outValue, QString& outText) aDlg.move(aPoint); aDlg.exec(); - //if (!myIsEditing) { - // disconnect(anEditor, SIGNAL(keyReleased(QKeyEvent*)), this, SLOT(onEnterPressed())); - //} - outText = anEditor->text(); bool isDouble; double aValue = outText.toDouble(&isDouble); @@ -98,8 +90,6 @@ bool ModuleBase_WidgetEditor::focusTo() void ModuleBase_WidgetEditor::showPopupEditor(const bool theSendSignals) { - //myIsEnterPressedEmitted = false; - // we need to emit the focus in event manually in order to save the widget as an active // in the property panel before the mouse leave event happens in the viewer. The module // ask an active widget and change the feature visualization if the widget is not the current one. @@ -126,7 +116,6 @@ void ModuleBase_WidgetEditor::showPopupEditor(const bool theSendSignals) // it is processed in operation manager //emit focusOutWidget(this); - //if (myIsEnterPressedEmitted) if (!myIsEditing) emit enterClicked(this); } @@ -134,11 +123,6 @@ void ModuleBase_WidgetEditor::showPopupEditor(const bool theSendSignals) storeValue(); } -/*void ModuleBase_WidgetEditor::onEnterPressed() -{ - myIsEnterPressedEmitted = true; -}*/ - void ModuleBase_WidgetEditor::setCursorPosition(const int theX, const int theY) { myXPosition = theX; diff --git a/src/ModuleBase/ModuleBase_WidgetEditor.h b/src/ModuleBase/ModuleBase_WidgetEditor.h index 063dd2b2b..43d9c099b 100644 --- a/src/ModuleBase/ModuleBase_WidgetEditor.h +++ b/src/ModuleBase/ModuleBase_WidgetEditor.h @@ -50,9 +50,6 @@ Q_OBJECT void setCursorPosition(const int theX, const int theY); -//protected slots: - //void onEnterPressed(); - private: void editedValue(double& outValue, QString& outText); @@ -63,8 +60,6 @@ private: ///< the kinds of possible features QStringList myFeatureKinds; - //bool myIsEnterPressedEmitted; - int myXPosition, myYPosition; }; -- 2.39.2