hi,

the attached patch has profound impact on the speed of moving with cursor
and typing as well. at least here.

if you wonder how to reproduce the slowness problems on your box, try to open
user guide, set the nesting on deepest level and try to type fastly or move
with cursor, maybe you'll be lucky...

opinions?
pavel
diff --git a/src/frontends/qt4/TocWidget.cpp b/src/frontends/qt4/TocWidget.cpp
index 84db8bd..6485c57 100644
--- a/src/frontends/qt4/TocWidget.cpp
+++ b/src/frontends/qt4/TocWidget.cpp
@@ -45,7 +45,8 @@ namespace lyx {
 namespace frontend {
 
 TocWidget::TocWidget(GuiView & gui_view, QWidget * parent)
-       : QWidget(parent), depth_(0), persistent_(false), gui_view_(gui_view)
+       : QWidget(parent), depth_(0), persistent_(false), gui_view_(gui_view), 
trigger_update_(false)
+
 {
        setupUi(this);
 
@@ -389,6 +390,15 @@ void TocWidget::enableControls(bool enable)
 
 void TocWidget::updateView()
 {
+       if (trigger_update_)
+               return;
+       trigger_update_=true;
+       QTimer::singleShot(2000, this, SLOT(updateViewForce()));
+}
+
+void TocWidget::updateViewForce()
+{
+       trigger_update_=false;
        if (!gui_view_.documentBufferView()) {
                tocTV->setModel(0);
                depthSL->setMaximum(0);
diff --git a/src/frontends/qt4/TocWidget.h b/src/frontends/qt4/TocWidget.h
index 6dd9fbf..b78b10f 100644
--- a/src/frontends/qt4/TocWidget.h
+++ b/src/frontends/qt4/TocWidget.h
@@ -44,8 +44,10 @@ public:
                const;
 
 public Q_SLOTS:
-       /// Update the display of the dialog whilst it is still visible.
+       /// Schedule new update of the display unless already scheduled.
        void updateView();
+       /// Update the display of the dialog whilst it is still visible.
+       void updateViewForce();
 
 protected Q_SLOTS:
        ///
@@ -99,6 +101,8 @@ private:
        bool persistent_;
        ///
        GuiView & gui_view_;
+       // is  updateview already scheduled?
+       bool trigger_update_;
 };
 
 } // namespace frontend

Reply via email to