CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxOptimizedUpdateWidget.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 
14 #include <iostream>
15 
16 namespace cx
17 {
18 
19 
21  QWidget(parent), mModified(true)
22 {
23 }
24 
26 {
27  this->prePaintEventPrivate();
28 }
29 
30 void OptimizedUpdateWidget::paintEvent(QPaintEvent* event)
31 {
32  this->prePaintEventPrivate();
33  QWidget::paintEvent(event);
34 }
35 
37 {
38  mModified = true;
39  this->update();
40 }
41 
42 void OptimizedUpdateWidget::prePaintEventPrivate()
43 {
44  if (!mModified)
45  return;
46 
47  this->prePaintEvent();
48 
49  mModified = false;
50 }
51 
52 } // namespace cx
OptimizedUpdateWidget(QWidget *parent=NULL)
virtual void paintEvent(QPaintEvent *event)
Namespace for all CustusX production code.