mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +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
0e740018ff
commit
2f9d323396
@ -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()
|
void TocWidget::filterContents()
|
||||||
{
|
{
|
||||||
if (!tocTV->model())
|
if (!tocTV->model())
|
||||||
|
@ -42,6 +42,8 @@ public:
|
|||||||
///
|
///
|
||||||
bool getStatus(Cursor & cur, FuncRequest const & fr, FuncStatus & status)
|
bool getStatus(Cursor & cur, FuncRequest const & fr, FuncStatus & status)
|
||||||
const;
|
const;
|
||||||
|
// update the view when the model has changed
|
||||||
|
void checkModelChanged();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/// Schedule new update of the display unless already scheduled.
|
/// Schedule new update of the display unless already scheduled.
|
||||||
|
Loading…
Reference in New Issue
Block a user