Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
QmlMitkBigRenderLock.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3  The Medical Imaging Interaction Toolkit (MITK)
4 
5  Copyright (c) German Cancer Research Center,
6  Division of Medical and Biological Informatics.
7  All rights reserved.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without
10  even the implied warranty of MERCHANTABILITY or FITNESS FOR
11  A PARTICULAR PURPOSE.
12 
13  See LICENSE.txt or http://www.mitk.org for details.
14 
15  ===================================================================*/
16 
17 #include "QmlMitkBigRenderLock.h"
18 #include "QVTKQuickItem.h"
19 
21 {
22  static QMutex globalRenderingLock;
23  return globalRenderingLock;
24 }
25 
27 :QObject(parent)
28 {
29 }
30 
31 bool QmlMitkBigRenderLock::eventFilter(QObject* /*obj*/, QEvent* /*event*/)
32 {
33  /*
34  TODO
35 
36  this should BLOCK during rendering, i.e.
37 
38  it should acquire a mutex lock which is also acquired by the rendering method in QVTKQuickItem
39 
40  TODO:
41 
42  THIS MUST BE CHANGED!
43 
44  It is NOT sufficient to delay signal delivery, BUT we must block rendering until the signal is completely processed.
45  TODO: what would happen if a signal receiver calls rendering->ForceImmediateUpdateAll ?
46  */
47 
48  if ( GetMutex().tryLock() )
49  {
50  // ok, let's continue
51  }
52  else
53  {
54  GetMutex().lock();
55  }
56 
57  GetMutex().unlock();
58 
59  return false; // don't actually filter/remove events
60 }
bool eventFilter(QObject *obj, QEvent *event)
QmlMitkBigRenderLock(QObject *parent=0)
static QMutex & GetMutex()