std::map<void*, int> MY_SENDERS;
Events_LongOp::Events_LongOp(void* theSender)
- : Events_Message(Events_LongOp::errorID(), theSender)
+ : Events_Message(Events_LongOp::eventID(), theSender)
{
}
{
}
-Events_ID Events_LongOp::errorID()
+Events_ID Events_LongOp::eventID()
{
Events_Loop* aLoop = Events_Loop::loop();
return aLoop->eventByName("LongOperation");
MY_SENDERS[theSender]++;
if (toSend) {
- Events_LongOp anError(theSender);
- Events_Loop::loop()->send(anError);
+ Events_LongOp anEvent(theSender);
+ Events_Loop::loop()->send(anEvent);
}
}
else MY_SENDERS[theSender] = aCount - 1;
}
if (MY_SENDERS.empty()) {
- Events_LongOp anError(theSender);
- Events_Loop::loop()->send(anError);
+ Events_LongOp anEvent(theSender);
+ Events_Loop::loop()->send(anEvent);
}
}
public:
virtual ~Events_LongOp();
/// Returns the identifier of this event
- static Events_ID errorID();
+ static Events_ID eventID();
/// Starts the long operation
static void start(void* theSender = 0);
/// Stops the long operation
void Model_Update::processEvent(const Events_Message* theMessage)
{
if (isExecuted) return; // nothing to do: it is executed now
- Events_LongOp::start(this);
+ //Events_LongOp::start(this);
isExecuted = true;
const ModelAPI_ObjectUpdatedMessage* aMsg =
dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
// flush
static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
Events_Loop::loop()->flush(EVENT_DISP);
- Events_LongOp::end(this);
+ //Events_LongOp::end(this);
isExecuted = false;
}
// Author: Artem ZHIDKOV
#include "SketchSolver_Solver.h"
+#include <Events_LongOp.h>
SketchSolver_Solver::SketchSolver_Solver()
{
if (myEquationsSystem.constraints <= 0)
return SLVS_RESULT_EMPTY_SET;
+ Events_LongOp::start(this);
Slvs_Solve(&myEquationsSystem, myGroupID);
+ Events_LongOp::end(this);
return myEquationsSystem.result;
}
return;
}
- if (theMessage->eventID() == Events_Loop::loop()->eventByName("LongOperation")) {
+ if (theMessage->eventID() == Events_LongOp::eventID()) {
if (Events_LongOp::isPerformed())
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
- else
+ //QTimer::singleShot(10, this, SLOT(onStartWaiting()));
+ else
QApplication::restoreOverrideCursor();
return;
}
}
}
+//******************************************************
+void XGUI_Workshop::onStartWaiting()
+{
+ if (Events_LongOp::isPerformed()) {
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+ }
+}
+
//******************************************************
void XGUI_Workshop::onFeatureUpdatedMsg(const ModelAPI_ObjectUpdatedMessage* theMsg)
{
void onWidgetValuesChanged();
+ void onStartWaiting();
+
private:
void initMenu();