>From qt4-doc about `QWidget::setContentsMargins':

    "Changing the margins will trigger a resizeEvent()."

and within src/gui/kernel/qwidget.cpp (qt-4.8.6):

    if (left == d->leftmargin && top == d->topmargin
         && right == d->rightmargin && bottom == d->bottommargin)
        return;
    ...
    
so resizeEvent() is called only if the margins are changed.

It means that the current order in `RosegardenScrollView::resizeEvent' is:

    QAbstractScrollArea::resizeEvent
    RosegardenScrollView::updateScrollBars
    QWidget::setContentsMargins       (from updateBottomWidgetGeometry)
      +---> QAbstractScrollArea::resizeEvent if the margins are changed

and we can get a loop

    +---> resizeEvent ---> setContentsMargins---+
    |                                           |
    |                                           v
    +-------------------<-----------------------+

i.e. when the horizontal scrollbar appairs and the value for

    verticalScrollBar()->setMaximum(
        std::max(contentsHeight() - visibleHeight(), 0));

in `updateScrollBars' jumps from 0 to a little positive value.

On Sun, Apr 26, 2015 at 09:38:09PM -0400, Ted Felix wrote:
>    It's probably the enormous number of resize events that are sent out 
> with the animated resizing.  I see hundreds of them, then the endless 
> loop and crash.

Here is the loop:

    0) resizeEvent
    1) verticalScrollBar()->setMaximum(nonzero);
    2) setContentsMargins
    3) margins changed -> resizeEvent
    4) verticalScrollBar()->setMaximum(0);
    5) setContentsMargin
    6) margins changed -> resizeEvent
    7) goto 1

However, after the swap between `updateBottomWidgetGeometry' and
`updateScrollBars', proposed in

    http://sourceforge.net/p/rosegarden/mailman/message/34048181/

the order becomes:

    QAbstractScrollArea::resizeEvent
    QWidget::setContentsMargins
      +---> QAbstractScrollArea::resizeEvent if the margins are changed
    RosegardenScrollView::updateScrollBars();

Now the loop 'setContentsMargins @ resizeEvent' stops after the first step:

    resizeEvent
    setContentsMargins
    margins changed -> resizeEvent
    setContentsMargins
    margins changed -> NO

It makes sense, so the bug is fixed.

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@lists.sourceforge.net - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to