Mercurial > octave
diff libgui/graphics/Container.cc @ 23401:e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
* graphics.in.h (axes::properties): Initialize non-property members.
* Array.h (Array<T>::ArrayRep::ArrayRep): Always use new to initialize
data member.
* Sparse.h (Sparse<T>::SparseRep::SparseRep): Initialize d and r
data members.
* idx-vector.cc, idx-vector.h: Explicitly mention idx_base_rep in
constructor initialization lists.
(idx_vector::idx_vector_rep::as_array): Avoid passing null pointer to
memcpy.
(idx_vector::idx_colon_rep::idx_colon_rep): Use default for trivial
constructor.
(idx_vector::idx_range_rep::idx_range_rep): Delete trivial construtor.
(idx_vector::idx_scalar_rep::idx_scalar_rep): Likewise.
(idx_vector::idx_mask_rep::idx_mask_rep): Likewise.
* Container.cc (Container::childEvent): Only set mouse tracking for
child widgets as they are added.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 15 Apr 2017 11:54:33 -0400 |
parents | 4b642b593ec2 |
children | db1fdf4384dd |
line wrap: on
line diff
--- a/libgui/graphics/Container.cc Sat Apr 15 10:25:53 2017 -0700 +++ b/libgui/graphics/Container.cc Sat Apr 15 11:54:33 2017 -0400 @@ -106,9 +106,21 @@ void Container::childEvent (QChildEvent* xevent) { - if (xevent->child ()->isWidgetType ()) - qobject_cast<QWidget*> (xevent->child ())->setMouseTracking ( - hasMouseTracking ()); + // Enable mouse tracking in child widgets as they are added if the + // container also has mouse tracking enabled. There is no need to + // do this when child objects are removed. + + if (xevent->added ()) + { + QObject *obj = xevent->child (); + + if (obj && obj->isWidgetType ()) + { + QWidget *widget = qobject_cast<QWidget*> (obj); + + if (widget) + widget->setMouseTracking (hasMouseTracking ()); + } + } } - }