0027127: Implementation of compilation of OCCT Products samples on all platforms...
[occt.git] / samples / qt / FuncDemo / src / graphwidget.h
CommitLineData
aff5997d 1/****************************************************************************
2**
3** Copyright (C) 2006-2007 Trolltech ASA. All rights reserved.
4**
5** This file is part of the example classes of the Qt Toolkit.
6**
7** Licensees holding a valid Qt License Agreement may use this file in
8** accordance with the rights, responsibilities and obligations
9** contained therein. Please consult your licensing agreement or
10** contact sales@trolltech.com if any conditions of this licensing
11** agreement are not clear to you.
12**
13** Further information about Qt licensing is available at:
14** http://www.trolltech.com/products/qt/licensing.html or by
15** contacting info@trolltech.com.
16**
17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19**
20****************************************************************************/
21
22#ifndef GRAPHWIDGET_H
23#define GRAPHWIDGET_H
24
caee72a9 25#include <QGraphicsView>
aff5997d 26
27#include "FThread.h"
28
29#include <TDocStd_Document.hxx>
30#include <TDF_Label.hxx>
31
32class Node;
33
34class GraphWidget : public QGraphicsView
35{
36 Q_OBJECT
37
38public:
39 GraphWidget(QWidget* parent);
40 ~GraphWidget();
41
42 bool createModel(const Handle(TDocStd_Document)& doc);
43 Handle(TDocStd_Document) getDocument() { return myDocument; }
44
45 Node* findNode(const TDF_Label& );
46 void setNbThreads(const int nb);
47 int getNbThreads();
48 void accelerateThread(const int thread_index);
49 void slowDownThread(const int thread_index);
50 void compute();
51
52 void setFinished();
53 bool isFinished();
54
55protected:
56 void wheelEvent(QWheelEvent *event);
57 void drawBackground(QPainter *painter, const QRectF &rect);
58 void scaleView(qreal scaleFactor);
59
60private:
61 Handle(TDocStd_Document) myDocument;
62 int myNbThreads;
63 FThread* myThread1;
64 FThread* myThread2;
65 FThread* myThread3;
66 FThread* myThread4;
67 int myNbFinishedThreads;
68};
69
70#endif