0029750: Samples - function arrows are not updated by moving a node in FuncDemo qt sample

The visual links between functions are recovered.
The demo is synchronized with a corresponding demo from Qt (qt486-vc10-32\examples\graphicsview\elasticnodes). It may be successfully compiled by any further versions of Qt including 5.10.1
Also, because Open CASCADE (and OCAF in particular) is improved for usage in multi-threading mode, usage of mutexes is added in this sample (for access to the sharing TNaming_UsedShapes attribute, for example).
This commit is contained in:
vro
2020-12-17 13:17:46 +03:00
committed by bugmaster
parent 41046145c4
commit 894133a5ad
21 changed files with 388 additions and 81 deletions

View File

@@ -1,5 +1,6 @@
#include "FThread.h"
#include "graphwidget.h"
#include "BaseDriver.h"
#include <TFunction_Function.hxx>
#include <TFunction_IFunction.hxx>
@@ -39,6 +40,11 @@ void FThread::setThreadIndex(const int theIndex)
this->thread_index = theIndex;
}
void FThread::setMutex(Standard_Mutex* pmutex)
{
this->pmutex = pmutex;
}
// Returns any free (not executed yet) function
TDF_Label FThread::getFreeFunction()
{
@@ -94,12 +100,16 @@ void FThread::run()
const bool must = D->MustExecute(log);
if (must)
{
// Usage of mutex for execution of Open CASCADE code is the most stupid thing!!!
// But it makes the execution more reliable...
// Usage of mutex for execution of Open CASCADE code.
// It makes the execution more reliable...
if (!Handle(BaseDriver)::DownCast(D).IsNull())
Handle(BaseDriver)::DownCast(D)->SetMutex(pmutex);
// Execute the driver.
const int ret = D->Execute(log);
if (ret == 0)
{
// Successfully executed!
// Successfuly executed!
itr.SetStatus(L, TFunction_ES_Succeeded);
TDF_LabelList res;