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)
const Config_WidgetAPI* theData,
const std::string& theParentId)
: ModuleBase_WidgetDoubleValue(theParent, theData, theParentId),
- //myIsEnterPressedEmitted(false),
myXPosition(-1), myYPosition(-1)
{
}
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);
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);
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.
// it is processed in operation manager
//emit focusOutWidget(this);
- //if (myIsEnterPressedEmitted)
if (!myIsEditing)
emit enterClicked(this);
}
storeValue();
}
-/*void ModuleBase_WidgetEditor::onEnterPressed()
-{
- myIsEnterPressedEmitted = true;
-}*/
-
void ModuleBase_WidgetEditor::setCursorPosition(const int theX, const int theY)
{
myXPosition = theX;
void setCursorPosition(const int theX, const int theY);
-//protected slots:
- //void onEnterPressed();
-
private:
void editedValue(double& outValue, QString& outText);
///< the kinds of possible features
QStringList myFeatureKinds;
- //bool myIsEnterPressedEmitted;
-
int myXPosition, myYPosition;
};