1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00
occt/samples/qt/FuncDemo/src/FThread.h
vro 894133a5ad 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).
2020-12-25 17:08:25 +03:00

46 lines
1.1 KiB
C++

#ifndef _FTHREAD_H_
#define _FTHREAD_H_
#include <Standard_WarningsDisable.hxx>
#include <QThread>
#include <Standard_WarningsRestore.hxx>
#include <TFunction_Logbook.hxx>
#include <TFunction_Iterator.hxx>
#include <TFunction_Driver.hxx>
#include <Standard_Mutex.hxx>
class GraphWidget; // shows graphically execution of functions
class FThread : public QThread
{
Q_OBJECT
public:
FThread(QObject* parent = 0);
~FThread();
void setIterator(const TFunction_Iterator& ); // to iterate and call functions
void setLogbook(const Handle(TFunction_Logbook)& ); // to set logbook with modifications
void setGraph(GraphWidget* ); // to change color of a graph circle
void setThreadIndex(const int ); // to set the index of the thread
void setMutex(Standard_Mutex* );
protected:
void run();
virtual TDF_Label getFreeFunction(); // Returns any free (not executed yet) function
private:
TFunction_Iterator itr;
Handle(TFunction_Logbook) log;
Standard_Mutex* pmutex;
int thread_index;
GraphWidget* graph;
};
#endif // _FTHREAD_H_