- public:
- SMESHGUI_DiagValidator (QWidget * parent, const char * name = 0):
- QValidator(parent,name) {}
-
- State validate (QString & text, int & pos) const
- {
- text.stripWhiteSpace();
- text.replace(QRegExp("[^0-9]+"), "-");
- if (text == "-")
- text = "";
- int ind = text.find(QRegExp("-[0-9]+-"));
- if (ind > 0) { // leave only two ids
- ind = text.find('-', ind + 1);
- if (ind > 0)
- text.truncate(ind);
- }
- if (pos > text.length())
- pos = text.length();
- return Acceptable;
- }
+public:
+ //! Constructor. Sets passed boolean flag to \c true.
+ BusyLocker( bool& busy ) : myBusy( busy ) { myBusy = true; }
+ //! Destructor. Clear external boolean flag passed as parameter to the constructor to \c false.
+ ~BusyLocker() { myBusy = false; }
+private:
+ bool& myBusy; //! External 'busy state' boolean flag