comparison Framework/Viewport/WidgetViewport.cpp @ 277:a38465cc909f am-2

Qt: refresh ok + mouse interaction ok
author am@osimis.io
date Mon, 27 Aug 2018 14:41:49 +0200
parents 84844649a8fd
children 8a86695fcbc3
comparison
equal deleted inserted replaced
276:5de5699ad570 277:a38465cc909f
72 { 72 {
73 centralWidget_->SetStatusBar(*statusBar_); 73 centralWidget_->SetStatusBar(*statusBar_);
74 } 74 }
75 75
76 backgroundChanged_ = true; 76 backgroundChanged_ = true;
77 observers_.Apply(*this, &IObserver::NotifyChange); 77 observers_.Apply(*this, &IObserver::OnViewportContentChanged);
78 78
79 return *widget; 79 return *widget;
80 } 80 }
81 81
82 82
83 void WidgetViewport::NotifyChange(const IWidget& widget) 83 void WidgetViewport::NotifyChange(const IWidget& widget)
84 { 84 {
85 backgroundChanged_ = true; 85 backgroundChanged_ = true;
86 observers_.Apply(*this, &IObserver::NotifyChange); 86 observers_.Apply(*this, &IObserver::OnViewportContentChanged);
87 } 87 }
88 88
89 89
90 void WidgetViewport::SetSize(unsigned int width, 90 void WidgetViewport::SetSize(unsigned int width,
91 unsigned int height) 91 unsigned int height)
95 if (centralWidget_.get() != NULL) 95 if (centralWidget_.get() != NULL)
96 { 96 {
97 centralWidget_->SetSize(width, height); 97 centralWidget_->SetSize(width, height);
98 } 98 }
99 99
100 observers_.Apply(*this, &IObserver::NotifyChange); 100 observers_.Apply(*this, &IObserver::OnViewportContentChanged);
101 } 101 }
102 102
103 103
104 bool WidgetViewport::Render(Orthanc::ImageAccessor& surface) 104 bool WidgetViewport::Render(Orthanc::ImageAccessor& surface)
105 { 105 {
152 else 152 else
153 { 153 {
154 mouseTracker_.reset(NULL); 154 mouseTracker_.reset(NULL);
155 } 155 }
156 156
157 observers_.Apply(*this, &IObserver::NotifyChange); 157 observers_.Apply(*this, &IObserver::OnViewportContentChanged);
158 } 158 }
159 159
160 160
161 void WidgetViewport::MouseUp() 161 void WidgetViewport::MouseUp()
162 { 162 {
163 if (mouseTracker_.get() != NULL) 163 if (mouseTracker_.get() != NULL)
164 { 164 {
165 mouseTracker_->MouseUp(); 165 mouseTracker_->MouseUp();
166 mouseTracker_.reset(NULL); 166 mouseTracker_.reset(NULL);
167 observers_.Apply(*this, &IObserver::NotifyChange); 167 observers_.Apply(*this, &IObserver::OnViewportContentChanged);
168 } 168 }
169 } 169 }
170 170
171 171
172 void WidgetViewport::MouseMove(int x, 172 void WidgetViewport::MouseMove(int x,
193 } 193 }
194 194
195 if (repaint) 195 if (repaint)
196 { 196 {
197 // The scene must be repainted, notify the observers 197 // The scene must be repainted, notify the observers
198 observers_.Apply(*this, &IObserver::NotifyChange); 198 observers_.Apply(*this, &IObserver::OnViewportContentChanged);
199 } 199 }
200 } 200 }
201 201
202 202
203 void WidgetViewport::MouseEnter() 203 void WidgetViewport::MouseEnter()
204 { 204 {
205 isMouseOver_ = true; 205 isMouseOver_ = true;
206 observers_.Apply(*this, &IObserver::NotifyChange); 206 observers_.Apply(*this, &IObserver::OnViewportContentChanged);
207 } 207 }
208 208
209 209
210 void WidgetViewport::MouseLeave() 210 void WidgetViewport::MouseLeave()
211 { 211 {
215 { 215 {
216 mouseTracker_->MouseUp(); 216 mouseTracker_->MouseUp();
217 mouseTracker_.reset(NULL); 217 mouseTracker_.reset(NULL);
218 } 218 }
219 219
220 observers_.Apply(*this, &IObserver::NotifyChange); 220 observers_.Apply(*this, &IObserver::OnViewportContentChanged);
221 } 221 }
222 222
223 223
224 void WidgetViewport::MouseWheel(MouseWheelDirection direction, 224 void WidgetViewport::MouseWheel(MouseWheelDirection direction,
225 int x, 225 int x,