1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

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

@@ -52,13 +52,16 @@
class Node;
//! [0]
class GraphWidget : public QGraphicsView
{
Q_OBJECT
public:
GraphWidget(QWidget* parent);
~GraphWidget();
GraphWidget(QWidget *parent = 0);
~GraphWidget();
void itemMoved();
bool createModel(const Handle(TDocStd_Document)& doc);
Handle(TDocStd_Document) getDocument() { return myDocument; }
@@ -73,12 +76,25 @@ public:
void setFinished();
bool isFinished();
public slots:
void shuffle();
void zoomIn();
void zoomOut();
protected:
void keyPressEvent(QKeyEvent *event);
void timerEvent(QTimerEvent *event);
void wheelEvent(QWheelEvent *event);
void drawBackground(QPainter *painter, const QRectF &rect);
void scaleView(qreal scaleFactor);
private:
int timerId;
Node *centerNode;
private:
Standard_Mutex myMutex;
Handle(TDocStd_Document) myDocument;
int myNbThreads;
FThread* myThread1;
@@ -87,5 +103,6 @@ private:
FThread* myThread4;
int myNbFinishedThreads;
};
//! [0]
#endif