mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Fix scrollbar not appearing in new documents unless reloaded (#10729)
QSignalBlocker in updateScrollbar is too strong and prevents the scroll bar from communicating with its scroll area. The only solution to block signals between specifically between two objects is to disconnect. This makes sense in this case, by making updateScrollbar responsible for managing the connection in the first place.
This commit is contained in:
parent
52025d5c9b
commit
764c61a08f
@ -325,10 +325,6 @@ void GuiWorkArea::init()
|
|||||||
generateSyntheticMouseEvent();
|
generateSyntheticMouseEvent();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Initialize the vertical Scroll Bar
|
|
||||||
QObject::connect(verticalScrollBar(), SIGNAL(valueChanged(int)),
|
|
||||||
this, SLOT(scrollTo(int)));
|
|
||||||
|
|
||||||
LYXERR(Debug::GUI, "viewport width: " << viewport()->width()
|
LYXERR(Debug::GUI, "viewport width: " << viewport()->width()
|
||||||
<< " viewport height: " << viewport()->height());
|
<< " viewport height: " << viewport()->height());
|
||||||
|
|
||||||
@ -675,14 +671,18 @@ void GuiWorkArea::toggleCursor()
|
|||||||
|
|
||||||
void GuiWorkArea::Private::updateScrollbar()
|
void GuiWorkArea::Private::updateScrollbar()
|
||||||
{
|
{
|
||||||
|
// Prevent setRange() and setSliderPosition from causing recursive calls via
|
||||||
|
// the signal valueChanged. (#10311)
|
||||||
|
QObject::disconnect(p->verticalScrollBar(), SIGNAL(valueChanged(int)),
|
||||||
|
p, SLOT(scrollTo(int)));
|
||||||
ScrollbarParameters const & scroll_ = buffer_view_->scrollbarParameters();
|
ScrollbarParameters const & scroll_ = buffer_view_->scrollbarParameters();
|
||||||
// Block signals to prevent setRange() and setSliderPosition from causing
|
|
||||||
// recursive calls via the signal valueChanged. (#10311)
|
|
||||||
QSignalBlocker blocker(p->verticalScrollBar());
|
|
||||||
p->verticalScrollBar()->setRange(scroll_.min, scroll_.max);
|
p->verticalScrollBar()->setRange(scroll_.min, scroll_.max);
|
||||||
p->verticalScrollBar()->setPageStep(scroll_.page_step);
|
p->verticalScrollBar()->setPageStep(scroll_.page_step);
|
||||||
p->verticalScrollBar()->setSingleStep(scroll_.single_step);
|
p->verticalScrollBar()->setSingleStep(scroll_.single_step);
|
||||||
p->verticalScrollBar()->setSliderPosition(0);
|
p->verticalScrollBar()->setSliderPosition(0);
|
||||||
|
// Connect to the vertical scroll bar
|
||||||
|
QObject::connect(p->verticalScrollBar(), SIGNAL(valueChanged(int)),
|
||||||
|
p, SLOT(scrollTo(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,7 +111,8 @@ struct GuiWorkArea::Private
|
|||||||
void hideCursor();
|
void hideCursor();
|
||||||
/// show the cursor if it is not visible
|
/// show the cursor if it is not visible
|
||||||
void showCursor();
|
void showCursor();
|
||||||
///
|
/// Set the range and value of the scrollbar and connect to its valueChanged
|
||||||
|
/// signal.
|
||||||
void updateScrollbar();
|
void updateScrollbar();
|
||||||
/// Change the cursor when the mouse hovers over a clickable inset
|
/// Change the cursor when the mouse hovers over a clickable inset
|
||||||
void updateCursorShape();
|
void updateCursorShape();
|
||||||
|
Loading…
Reference in New Issue
Block a user