mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 05:01:49 +00:00
TocWidget: Fix perf regression
4d1ad336
fixed #9754 but caused perf issues by cancelling the gains of having a
timer (introduced after #7138). This introduces in GuiToc::enableView() a
lightweight check of whether the widget should be updated. The logic is inspired
from GuiViewSource::enableView().
This commit is contained in:
parent
8149d4fc0b
commit
009dc75fef
@ -66,9 +66,12 @@ void GuiToc::dispatchParams()
|
||||
}
|
||||
|
||||
|
||||
void GuiToc::enableView(bool /*enable*/)
|
||||
void GuiToc::enableView(bool enable)
|
||||
{
|
||||
widget_->updateViewForce();
|
||||
widget_->checkModelChanged();
|
||||
if (!enable)
|
||||
// In the opposite case, updateView() will be called anyway.
|
||||
widget_->updateViewForce();
|
||||
}
|
||||
|
||||
|
||||
|
@ -452,6 +452,14 @@ void TocWidget::updateViewForce()
|
||||
}
|
||||
|
||||
|
||||
void TocWidget::checkModelChanged()
|
||||
{
|
||||
if (!gui_view_.documentBufferView() ||
|
||||
gui_view_.tocModels().model(current_type_) != tocTV->model())
|
||||
updateViewForce();
|
||||
}
|
||||
|
||||
|
||||
void TocWidget::filterContents()
|
||||
{
|
||||
if (!tocTV->model())
|
||||
|
@ -42,6 +42,8 @@ public:
|
||||
///
|
||||
bool getStatus(Cursor & cur, FuncRequest const & fr, FuncStatus & status)
|
||||
const;
|
||||
// update the view when the model has changed
|
||||
void checkModelChanged();
|
||||
|
||||
public Q_SLOTS:
|
||||
/// Schedule new update of the display unless already scheduled.
|
||||
|
Loading…
Reference in New Issue
Block a user