Peter Kümmel wrote:
> Abdelrazak Younes wrote:
>>>> There is no way to see what kind of events are pending?
>>>> If not we could probably install an event filter.
>>> When we are in "adjustViewWithScrollBar" which calls "scrollBufferView"
>>> isn't it clear that it is a scroll event?
>> Of course the current event is a scroll event but my question was about
>> the _pending_ event.
> 
> To check the pending events is maybe a bit complicated, but attached patch
> minimizes the side effect risk, because it only ckecks for
> QCoreApplication::hasPendingEvents() when a scrollbar event happens.
> And we could fine tune it by using the argument if there are problems.
> 
> Maybe Helge could test the patch before beta 3 (when was it? Next month ;) )
> 
> 
> Peter
> 
> 
> ------------------------------------------------------------------------
> 
> Index: src/frontends/qt4/GuiWorkArea.cpp
> ===================================================================
> --- src/frontends/qt4/GuiWorkArea.cpp (revision 18380)
> +++ src/frontends/qt4/GuiWorkArea.cpp (working copy)
> @@ -190,7 +190,7 @@
>  
>       // Initialize the vertical Scroll Bar
>       QObject::connect(verticalScrollBar(), SIGNAL(actionTriggered(int)),
> -             this, SLOT(adjustViewWithScrollBar(int)));
> +             this, SLOT(verticalScrollBarActionTriggered(int)));
>  
>       // disable context menu for the scrollbar
>       verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);
> @@ -231,6 +231,16 @@
>  }
>  
>  
> +void GuiWorkArea::verticalScrollBarActionTriggered(int)
> +{
> +     // TODO Should we use the action argument
> +     // (SliderPageStepSub, SliderPageStepAdd)?
> +     if (!QCoreApplication::hasPendingEvents()) {
> +             scrollBufferView(verticalScrollBar()->sliderPosition());
> +     }
> +}
> +
> +
>  void GuiWorkArea::adjustViewWithScrollBar(int)
>  {
>       scrollBufferView(verticalScrollBar()->sliderPosition());
> Index: src/frontends/qt4/GuiWorkArea.h
> ===================================================================
> --- src/frontends/qt4/GuiWorkArea.h   (revision 18379)
> +++ src/frontends/qt4/GuiWorkArea.h   (working copy)
> @@ -156,6 +156,10 @@
>       /// timer to limit triple clicks
>       void doubleClickTimeout();
>  
> +private Q_SLOTS:
> +     /// process vertical scroll bar event
> +     void verticalScrollBarActionTriggered(int action);
> +
>  private:
>       /// The slot connected to SyntheticMouseEvent::timeout.
>       void generateSyntheticMouseEvent();


Does not work: the slider and the content aren't synchronous any more.


-- 
Peter Kümmel

Reply via email to