Andre Poenitz wrote: > On Fri, May 18, 2007 at 08:43:12AM +0200, Peter Kümmel wrote: >> Andre Poenitz wrote: >>>> =================================================================== >>>> --- src/frontends/qt4/GuiWorkArea.cpp (revision 18380) >>>> +++ src/frontends/qt4/GuiWorkArea.cpp (working copy) >>>> @@ -161,7 +161,7 @@ >>>> >>>> GuiWorkArea::GuiWorkArea(int w, int h, int id, LyXView & lyx_view) >>>> : WorkArea(id, lyx_view), need_resize_(false), schedule_redraw_(false), >>>> - preedit_lines_(1) >>>> + preedit_lines_(1), delayed_scrollbar_sync(*new QTimer(this)) >>> Do you need an explicit timer object? There's QObject::startTimer() >>> and QObject::timerEvent()... >> Ah, didn't know there is already a timer when being a QObject. Will >> have a look at it. >> >> >>>> Index: src/frontends/qt4/GuiWorkArea.h >>>> =================================================================== >>>> --- src/frontends/qt4/GuiWorkArea.h (revision 18380) >>>> +++ src/frontends/qt4/GuiWorkArea.h (working copy) >>>> @@ -156,6 +156,14 @@ >>>> /// timer to limit triple clicks >>>> void doubleClickTimeout(); >>>> >>>> +private Q_SLOTS: >>>> + /// process vertical scroll bar event >>>> + void verticalScrollBarActionTriggered(int action); >>>> + /// >>>> + void verticalScrollBarSliderPressed(); >>>> + /// >>>> + void verticalScrollBarSliderReleased(); >>>> + >>>> private: >>>> /// The slot connected to SyntheticMouseEvent::timeout. >>>> void generateSyntheticMouseEvent(); >>>> @@ -177,6 +185,8 @@ >>>> bool schedule_redraw_; >>>> /// >>>> int preedit_lines_; >>>> + /// >>>> + QTimer& delayed_scrollbar_sync; >>> A _reference_? Why? >> At could forward declare QTimer, but isn't that important. > > This would be possible with a pointer, to.
But then you are not forced by the compiler to initialize it, because of this a prefer a reference, it's shorter in declaring and using than *const. > > What you wrote works indeed, but I am not sure that it is > clear to everybody glancing over the code _why_ it works. > I'm preparing a patch which works, and where I know why. > Andre' > -- Peter Kümmel