X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_DoubleSpinBox.cpp;h=7f3b896b68ef62893945117fa8f3e5c8aa4f3e65;hb=63d86e00e1e6a482fcad527ae0b883deccceed11;hp=090cf58f313f407e85842105dde7982de2254806;hpb=423c10234142d14d0d5de89383f2f96a4ec5930f;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp b/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp index 090cf58f3..7f3b896b6 100644 --- a/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp @@ -1,9 +1,24 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: ModuleBase_DoubleSpinBox.cxx -// Author: Sergey TELKOV +// Copyright (C) 2014-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + #include "ModuleBase_DoubleSpinBox.h" +#include "ModuleBase_Tools.h" #include #include @@ -58,16 +73,9 @@ const double PSEUDO_ZERO = 1.e-20; */ ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget* theParent, int thePrecision) : QDoubleSpinBox(theParent), - myCleared(false), - myIsEmitKeyPressEvent(false) + myCleared(false) { - // VSR 01/07/2010: Disable thousands separator for spin box - // (to avoid inconsistency of double-2-string and string-2-double conversion) - QLocale loc; - loc.setNumberOptions(loc.numberOptions() | - QLocale::OmitGroupSeparator | - QLocale::RejectGroupSeparator); - setLocale(loc); + setLocale(ModuleBase_Tools::doubleLocale()); // MPV 15/09/2014: this must be set before setDecimals; // otherwise in release mode setDecimals may crash @@ -203,42 +211,6 @@ QString ModuleBase_DoubleSpinBox::removeTrailingZeroes(const QString& src) const return res; } -void ModuleBase_DoubleSpinBox::keyPressEvent(QKeyEvent* theEvent) -{ - 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; - } - break; - default: - break; - } - QDoubleSpinBox::keyPressEvent(theEvent); -} - -void ModuleBase_DoubleSpinBox::keyReleaseEvent(QKeyEvent* theEvent) -{ - switch (theEvent->key()) { - case Qt::Key_Enter: - case Qt::Key_Return: { - // the enter has already been processed when key is pressed, - // key release should not be processed in operation manager - if (myIsEmitKeyPressEvent) { - theEvent->accept(); - emit enterReleased(); - return; - } - } - break; - default: - break; - } - QDoubleSpinBox::keyReleaseEvent(theEvent); -} - /*! \brief Perform \a steps increment/decrement steps. @@ -353,14 +325,6 @@ void ModuleBase_DoubleSpinBox::onTextChanged(const QString& ) myCleared = false; } -bool ModuleBase_DoubleSpinBox::enableKeyPressEvent(const bool& theEnable) -{ - bool aPreviousValue = myIsEmitKeyPressEvent; - myIsEmitKeyPressEvent = theEnable; - - return aPreviousValue; -} - void ModuleBase_DoubleSpinBox::setValueEnabled(const bool& theEnable) { setReadOnly(!theEnable);