ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget* theParent, int thePrecision)
: QDoubleSpinBox(theParent),
myCleared(false),
- //myIsModified(false),
myIsEmitKeyPressEvent(false)
{
// VSR 01/07/2010: Disable thousands separator for spin box
connect(lineEdit(), SIGNAL(textChanged( const QString& )), this,
SLOT(onTextChanged( const QString& )));
-
- //connect(this, SIGNAL(valueChanged(const QString&)), this, SLOT(onValueChanged(const QString&)));
}
/*!
void ModuleBase_DoubleSpinBox::onTextChanged(const QString& )
{
myCleared = false;
- //myIsModified = true;
}
-/*void ModuleBase_DoubleSpinBox::onValueChanged(const QString& theValue)
-{
- myIsModified = true;
-}
-
-bool ModuleBase_DoubleSpinBox::isModified() const
-{
- return myIsModified;
-}
-
-void ModuleBase_DoubleSpinBox::clearModified()
-{
- myIsModified = false;
-}*/
-
bool ModuleBase_DoubleSpinBox::enableKeyPressEvent(const bool& theEnable)
{
bool aPreviousValue = myIsEmitKeyPressEvent;
/// Validate current value
virtual QValidator::State validate(QString&, int&) const;
- /// Returns true if the current value is modified by has not been applyed yet
- //virtual bool isModified() const;
-
- /// Clears modified state
- //void clearModified();
-
/// Change enable/disable internal state to emit key press event
/// \param theEnable if true, the signal is emitted
/// \return the previous value
protected slots:
/// Called on text changed
virtual void onTextChanged(const QString&);
- /// Called on value changed
- //void onValueChanged(const QString& theValue);
protected:
/// Removes extra trailing zero symbols
/// Precision value
int myPrecision;
- /// Boolean value whether the spin box content is modified
- //bool myIsModified;
};
#endif
/// \return Currently installed property panel
ModuleBase_IPropertyPanel* propertyPanel() const { return myPropertyPanel; }
-public slots:
- /// SLOT, that is called after the operation is validated and feature validation errors have changed.
- //virtual void onValidationStateChanged() = 0;
-
protected slots:
/// Process values changed event for processing feature attribute validation errors.
virtual void onWidgetChanged() = 0;
#include <QKeyEvent>
ModuleBase_IntSpinBox::ModuleBase_IntSpinBox(QWidget* theParent)
-: QSpinBox(theParent)//,
- //myIsModified(false)
+: QSpinBox(theParent)
{
- //connect(this, SIGNAL(valueChanged(const QString&)), this, SLOT(onValueChanged(const QString&)));
}
-/*void ModuleBase_IntSpinBox::onValueChanged(const QString& theValue)
-{
- myIsModified = true;
-}
-
-bool ModuleBase_IntSpinBox::isModified() const
-{
- return myIsModified;
-}
-
-void ModuleBase_IntSpinBox::clearModified()
-{
- myIsModified = false;
-}*/
-
void ModuleBase_IntSpinBox::keyPressEvent(QKeyEvent *theEvent)
{
switch (theEvent->key()) {
explicit ModuleBase_IntSpinBox(QWidget* theParent = 0);
virtual ~ModuleBase_IntSpinBox() {};
- /// Returns true if the current value is modified by has not been applyed yet
- //virtual bool isModified() const;
-
- /// Clears modified state
- //void clearModified();
-
-protected slots:
- /// Called on value changed
- //void onValueChanged(const QString& theValue);
-
protected:
/// Called on key press event
virtual void keyPressEvent(QKeyEvent* theEvent);
-
-private:
- /// Boolean value whether the spin box content is modified
- //bool myIsModified;
};
#endif
bool ModuleBase_WidgetDoubleValue::processEnter()
{
bool isModified = getValueState() == ModifiedInPP;
- //bool isModified = mySpinBox->isModified();
if (isModified) {
emit valuesChanged();
- //mySpinBox->clearModified();
mySpinBox->selectAll();
}
return isModified;
#include <string>
ExpressionEditor::ExpressionEditor(QWidget* theParent)
-: QPlainTextEdit(theParent), myCompletedAndSelected(false), myIsModified(false)
+: QPlainTextEdit(theParent), myCompletedAndSelected(false)
{
myCompleter = new QCompleter(this);
myCompleter->setWidget(this);
void ExpressionEditor::keyPressEvent(QKeyEvent* theEvent)
{
- bool anIsModified = myIsModified;
-
if (myCompletedAndSelected && handledCompletedAndSelected(theEvent))
return;
myCompletedAndSelected = false;
return myPlaceHolderText;
}
-bool ExpressionEditor::isModified() const
-{
- return myIsModified;
-}
-
-void ExpressionEditor::clearModified()
-{
- myIsModified = false;
-}
-
void ExpressionEditor::paintEvent( QPaintEvent* theEvent )
{
QPlainTextEdit::paintEvent( theEvent );
void ExpressionEditor::onTextChanged()
{
- myIsModified = true;
emit valueModified();
}
bool ModuleBase_WidgetExprEditor::processEnter()
{
- //bool isModified = myEditor->isModified();
bool isModified = getValueState() == ModifiedInPP;
if (isModified) {
emit valuesChanged();
- //myEditor->clearModified();
myEditor->selectAll();
}
return isModified;
/// Returns placeholder list
QString placeHolderText() const;
- /// Returns true if the current value is modified by has not been applyed yet
- bool isModified() const;
-
- /// Clears modified state
- void clearModified();
-
public slots:
/// Insert additional string for completion
/// \param theCompletion a string to insert
QCompleter* myCompleter;
bool myCompletedAndSelected;
QString myPlaceHolderText;
-
- /// Boolean value whether the spin box content is modified
- bool myIsModified;
};
/**
bool ModuleBase_WidgetIntValue::processEnter()
{
bool isModified = getValueState() == ModifiedInPP;
- //bool isModified = mySpinBox->isModified();
if (isModified) {
emit valuesChanged();
- //mySpinBox->clearModified();
mySpinBox->selectAll();
}
return isModified;
bool PartSet_WidgetPoint2D::processEnter()
{
- //bool isModified = myXSpin->isModified() || myYSpin->isModified();
bool isModified = getValueState() == ModifiedInPP;
if (isModified) {
- bool isXModified = myXSpin->hasFocus();//myXSpin->isModified();
+ bool isXModified = myXSpin->hasFocus();
emit valuesChanged();
- //onValuesChanged();
- //myXSpin->clearModified();
- //myYSpin->clearModified();
if (isXModified)
myXSpin->selectAll();
else
bool PartSet_WidgetPoint2dDistance::processEnter()
{
- //bool isModified = mySpinBox->isModified();
bool isModified = getValueState() == ModifiedInPP;
if (isModified) {
emit valuesChanged();
- //mySpinBox->clearModified();
mySpinBox->selectAll();
}
return isModified;
/// \param theFeature a feature
void updateAcceptAllAction(const FeaturePtr& theFeature);
-public slots:
- /// Reimplemented from ModuleBase_ErrorMgr::onValidationStateChanged().
- //virtual void onValidationStateChanged();
-
protected slots:
/// Reimplemented from ModuleBase_ErrorMgr::onWidgetChanged().
virtual void onWidgetChanged();
if (aFOperation) {
workshop()->errorMgr()->updateActions(aFOperation->feature());
}
- //emit validationStateChanged(theEnabled);
}
void XGUI_OperationMgr::updateApplyOfOperations(ModuleBase_Operation* theOperation)
case Qt::Key_Return:
case Qt::Key_Enter: {
isAccepted = onProcessEnter();
- /*ModuleBase_Operation* aOperation = currentOperation();
- ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
- ModuleBase_ModelWidget* aActiveWgt = aPanel->activeWidget();
- if (!aActiveWgt || !aActiveWgt->processEnter()) {
- if (!myWorkshop->module()->processEnter(aActiveWgt ? aActiveWgt->attributeID() : "")) {
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(currentOperation());
- if (!aFOperation || myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty()) {
- emit keyEnterReleased();
- commitOperation();
- }
- else
- isAccepted = false;
- }
- }*/
}
break;
case Qt::Key_N:
SLOT(onOperationCommitted(ModuleBase_Operation*)));
connect(myOperationMgr, SIGNAL(operationAborted(ModuleBase_Operation*)),
SLOT(onOperationAborted(ModuleBase_Operation*)));
- //connect(myOperationMgr, SIGNAL(validationStateChanged(bool)),
- // myErrorMgr, SLOT(onValidationStateChanged()));
#ifndef HAVE_SALOME
connect(myMainWindow, SIGNAL(exitKeySequence()), SLOT(onExit()));
}
}
-//******************************************************
-/*void XGUI_Workshop::onValidationStateChanged(bool theEnabled)
-{
- XGUI_OperationMgr* anOperationMgr = operationMgr();
- if (anOperationMgr) {
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
- (anOperationMgr->currentOperation());
- if (aFOperation) {
- QAction* anAction = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept);
- myErrorMgr->updateActionState(anAction, aFOperation->feature(), theEnabled);
- }
- }
-}*/
-
-
//******************************************************
void XGUI_Workshop::deactivateActiveObject(const ObjectPtr& theObject, const bool theUpdateViewer)
{
connect(myPropertyPanel, SIGNAL(enterClicked()),
myOperationMgr, SLOT(onProcessEnter()));
- //connect(myOperationMgr, SIGNAL(validationStateChanged(bool)),
- // this, SLOT(onValidationStateChanged(bool)));
}
//******************************************************
/// the operation can be committed and do it if it returns true.
void onAcceptActionClicked();
- /// Listens the corresponded signal from operation manager and send it with the Ok
- /// action to operation manager.
- /// \param theEnabled an enabled state for the action
- //void onValidationStateChanged(bool theEnabled);
-
- //connect(myOperationMgr, SIGNAL(validationStateChanged(bool)),
- // aOkAct, SLOT(setEnabled(bool)));
-
-
private:
/// Init menu
void initMenu();