changeset 29692:b4e2c6150976

fix missing contents page at startup of doc browser * documentation.cc (documentation): delay setting the first source of the text browser
author Torsten Lilge <ttl-octave@mailbox.org>
date Tue, 18 May 2021 22:17:35 +0200
parents 67eccd062618
children 3f07c0696a97
files libgui/src/documentation.cc
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/documentation.cc	Tue May 18 22:17:34 2021 +0200
+++ b/libgui/src/documentation.cc	Tue May 18 22:17:35 2021 +0200
@@ -47,6 +47,7 @@
 #include <QLineEdit>
 #include <QMessageBox>
 #include <QTabWidget>
+#include <QTimer>
 #include <QVBoxLayout>
 
 #include "documentation.h"
@@ -295,8 +296,16 @@
       }
 
     // Initial view: Contents
-    m_doc_browser->setSource
-      (QUrl ("qthelp://org.octave.interpreter-1.0/doc/octave.html/index.html"));
+    // FIXME: Setting the URL immediately leads to the "No dcument error"
+    //        although the data setup of the help engine seems to be finished.
+    //        At least, when when calling m_doc_browser->setSource in a slot
+    //        of the setupFinished signal, m_doc_browser is still NULL.
+    //        The current workaround is to delay setting the url by 100 ms.
+    QTimer::singleShot (100, this, [=] ()
+      { m_doc_browser->setSource
+        (QUrl ("qthelp://org.octave.interpreter-1.0/doc/octave.html/index.html"));
+      });
+
   }
 
   documentation::~documentation (void)