[Interest] synchronize multiple graphicsviews

Alexander Görtz nylocx at googlemail.com
Wed Sep 11 10:25:14 CEST 2013


Hi

> >  > The thing is (as you probably guess already) that these fires the
> >  > signal too, so i end up in a loop

I hope I get this right, but maybe you should try to do it like it is done in 
the Qt GUI elements. In the setter slot you could check if the new value 
equals the current value and only emit it they don't match. So this should 
break your infinit loop.


Am Dienstag, 10. September 2013, 13:41:58 schrieb Christoph Kurz:
> > > Good morning,
> > > 
> >  > I have something like profiler and each thread is contained in its own
> >  > graphicsview. On the x axis is time of course and i want the setpos in
> >  > one thread to be propagated in the others.
> >  > 
> >  > So i hooked the horizontalScrollBar::valueChanged and i am trying
> >  > to dispatch the signal to other views.
> >  > The thing is (as you probably guess already) that these fires the
> >  > signal too, so i end up in a loop.
> >  > 
> >  > But when i block the signals, the view's position does not get
> >  > updated. I tried (i think) to call every setscenerect, update,
> >  > viewport->update etc but don't succeeded to get the view visualy
> >  > updated.
> >  > 
> >  > What is the best way to do this?
> 
> Have you tried to use QObject::disconnect() instead of blockSignals(true) ?
> 
> It should work, though I don't know about the performance of using connect()
> and disconnect() all the time.
> 
> Especially if you have lots of different views it will also result in a lot
> of code.
> 
> Hope that helps
> 
> > > Many thanks,
> > > 
> >  > Mojmir
> >  > _______________________________________________
> >  > Interest mailing list
> >  > Interest at qt-project.org
> >  > http://lists.qt-project.org/mailman/listinfo/interest
> >  > <http://lists.qt-project.org/mailman/listinfo/interest>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130911/8beac2ad/attachment.sig>


More information about the Interest mailing list