It is not enough to emit signal about focus change here because it can be changed by mouse click in another control. It is not processed in this method.
The same functionality(to store modified value on focus lost) is realized in ::deactivate() of the model widget and processEnter method of the widge.
QDoubleSpinBox::keyPressEvent(theEvent);
}
-bool ModuleBase_DoubleSpinBox::focusNextPrevChild(bool theIsNext)
-{
- //myIsModified = false;
-
- //emit valueStored();
- emit focusNextPrev();
- return QDoubleSpinBox::focusNextPrevChild(theIsNext);
-}
-
/*!
\brief Perform \a steps increment/decrement steps.
/// \return the previous value
bool enableKeyPressEvent(const bool& theEnable);
-signals:
- /// A signal that is emitted by the "Tab" key event. It is emitted before the key is processed.
- void focusNextPrev();
- void valueStored();
-
protected slots:
/// Called on text changed
virtual void onTextChanged(const QString&);
QString removeTrailingZeroes(const QString&) const;
virtual void keyPressEvent(QKeyEvent* theEvent);
- /// The parent method that processes the "Tab"/"SHIF + Tab" keyboard events
- /// Emits a signal about focus change
- /// If theIsNext is true, this function searches forward, if next is false, it searches backward.
- virtual bool focusNextPrevChild(bool theIsNext);
-
private:
// boolen flag whether the key event is emitted. The default value is false
bool myIsEmitKeyPressEvent;
/// The signal about value state modification
void valueStateChanged(int theState);
- void focusNextPrev();
- void valueStored();
-
protected:
/// Sets default value of widget. Normally, widget should fetch this value
/// from the xml. However, some widgets derived widgets could define it
mySpinBox->setToolTip(aTTip);
aControlLay->addRow(myLabel, mySpinBox);
- // Apply widget value change by enter/tab event.
- connect(mySpinBox, SIGNAL(valueStored()), this, SIGNAL(valuesChanged()));
connect(mySpinBox, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified()));
- connect(mySpinBox, SIGNAL(focusNextPrev()), this, SIGNAL(focusNextPrev()));
}
ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue()
}
}
-bool ExpressionEditor::focusNextPrevChild(bool theIsNext)
-{
- //emit valueStored();
- //emit focusNextPrev();
- return QPlainTextEdit::focusNextPrevChild(theIsNext);
-}
-
void ExpressionEditor::onTextChanged()
{
myIsModified = true;
this->setLayout(aMainLay);
connect(myEditor, SIGNAL(valueModified()), this, SIGNAL(valuesModified()));
- //connect(myEditor, SIGNAL(valueStored()), this, SLOT(onTextChanged()));
- //connect(myEditor, SIGNAL(focusNextPrev()), this, SIGNAL(focusNextPrev()));
-
connect(myEditor, SIGNAL(keyReleased(QKeyEvent*)), this, SIGNAL(keyReleased(QKeyEvent*)));
- /// The signal about key release on the control, that corresponds to the attribute
- /// \param theEvent key release event
}
ModuleBase_WidgetExprEditor::~ModuleBase_WidgetExprEditor()
void onTextChanged();
signals:
+ /// The signal about text change in the text editor
void valueModified();
- /// A signal that is emitted by the "Tab" key event. It is emitted before the key is processed.
- //void valueStored();
- //void focusNextPrev();
/// The signal about key release on the control, that corresponds to the attribute
/// \param theEvent key release event
/// Redefinition of virtual method
virtual void paintEvent( QPaintEvent* );
- /// The parent method that processes the "Tab"/"SHIF + Tab" keyboard events
- /// Emits a signal about focus change
- /// If theIsNext is true, this function searches forward, if next is false, it searches backward.
- virtual bool focusNextPrevChild(bool theIsNext);
-
- private:
+private:
QStringListModel* myCompleterModel;
QCompleter* myCompleter;
bool myCompletedAndSelected;
mySpinBox->setToolTip(aTTip);
aControlLay->addRow(myLabel, mySpinBox);
- // Apply widget value change by enter/tab event.
- connect(mySpinBox, SIGNAL(valueStored()), this, SIGNAL(valuesChanged()));
connect(mySpinBox, SIGNAL(valueChanged(int)), this, SIGNAL(valuesModified()));
- connect(mySpinBox, SIGNAL(focusNextPrev()), this, SIGNAL(focusNextPrev()));
}
ModuleBase_WidgetIntValue::~ModuleBase_WidgetIntValue()
myXSpin->setToolTip(tr("X"));
aGroupLay->addWidget(myXSpin, 0, 1);
- // Apply widget value change by enter/tab event.
- connect(myXSpin, SIGNAL(valueStored()), this, SLOT(onValuesChanged()));
connect(myXSpin, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified()));
- connect(myXSpin, SIGNAL(focusNextPrev()), this, SIGNAL(focusNextPrev()));
}
{
QLabel* aLabel = new QLabel(myGroupBox);
myYSpin->setToolTip(tr("Y"));
aGroupLay->addWidget(myYSpin, 1, 1);
- // Apply widget value change by enter/tab event.
- connect(myYSpin, SIGNAL(valueStored()), this, SLOT(onValuesChanged()));
connect(myYSpin, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified()));
- connect(myYSpin, SIGNAL(focusNextPrev()), this, SIGNAL(focusNextPrev()));
}
QVBoxLayout* aLayout = new QVBoxLayout(this);
ModuleBase_Tools::zeroMargins(aLayout);
return aPointIsFound;
}
-void PartSet_WidgetPoint2D::onValuesChanged()
+/*void PartSet_WidgetPoint2D::onValuesChanged()
{
emit valuesChanged();
-}
+}*/
bool PartSet_WidgetPoint2D::processEnter()
{
bool isModified = myXSpin->isModified() || myYSpin->isModified();
if (isModified) {
bool isXModified = myXSpin->isModified();
- onValuesChanged();
+ emit valuesChanged();
+ //onValuesChanged();
myXSpin->clearModified();
myYSpin->clearModified();
if (isXModified)
/// \return boolean result
bool isFeatureContainsPoint(const FeaturePtr& theFeature, double theX, double theY);
-private slots:
+//private slots:
/// Process value changed event
- void onValuesChanged();
+ //void onValuesChanged();
private:
/// Returns point 2d from selected vertex
this, SLOT(activateNextWidget(ModuleBase_ModelWidget*)));
connect(aWidget, SIGNAL(keyReleased(QKeyEvent*)),
this, SIGNAL(keyReleased(QKeyEvent*)));
- //connect(aWidget, SIGNAL(focusNextPrev()),
- // this, SLOT(onFocusNextPrev()));
}
}
}
}
-void XGUI_PropertyPanel::onFocusNextPrev()
-{
- setActiveWidget(NULL);
-}
-
bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext)
{
// it wraps the Tabs clicking to follow in the chain:
emit widgetActivated(myActiveWidget);
} else if (!isEditingMode()) {
emit noMoreWidgets();
- setFocusOnOkButton();
+ //setFocusOnOkButton();
}
}
}
*/
virtual void activateWidget(ModuleBase_ModelWidget* theWidget);
- void onFocusNextPrev();
-
protected:
/// Makes the widget active, deactivate the previous, activate and hightlight the given one
/// \param theWidget a widget