Implemented a work-around for a buggy behavior for Qt5, where application focus is given to a completion list but not returned after selecting an entry by double-clicking it.

Fri, 31 Jan 2014 12:12:56 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 31 Jan 2014 12:12:56 +0100
changeset 3238
fa28dab59a9e
parent 3236
92e15257b24e
child 3242
a7e006073658

Implemented a work-around for a buggy behavior for Qt5, where application focus is given to a completion list but not returned after selecting an entry by double-clicking it.

Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Helpviewer.HelpWindow.html file | annotate | diff | comparison | revisions
Documentation/Source/eric5.QScintilla.QsciScintillaCompat.html file | annotate | diff | comparison | revisions
QScintilla/QsciScintillaCompat.py file | annotate | diff | comparison | revisions
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Fri Jan 31 11:00:24 2014 +0100
+++ b/Documentation/Help/source.qhp	Fri Jan 31 12:12:56 2014 +0100
@@ -5580,6 +5580,7 @@
       <keyword name="HelpWindow.__closeNetworkMonitor" id="HelpWindow.__closeNetworkMonitor" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.__closeNetworkMonitor" />
       <keyword name="HelpWindow.__copy" id="HelpWindow.__copy" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.__copy" />
       <keyword name="HelpWindow.__currentChanged" id="HelpWindow.__currentChanged" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.__currentChanged" />
+      <keyword name="HelpWindow.__del__" id="HelpWindow.__del__" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.__del__" />
       <keyword name="HelpWindow.__docsInstalled" id="HelpWindow.__docsInstalled" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.__docsInstalled" />
       <keyword name="HelpWindow.__feedsManagerClosed" id="HelpWindow.__feedsManagerClosed" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.__feedsManagerClosed" />
       <keyword name="HelpWindow.__filterQtHelpDocumentation" id="HelpWindow.__filterQtHelpDocumentation" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.__filterQtHelpDocumentation" />
@@ -9407,6 +9408,7 @@
       <keyword name="QsciScintillaCompat" id="QsciScintillaCompat" ref="eric5.QScintilla.QsciScintillaCompat.html#QsciScintillaCompat" />
       <keyword name="QsciScintillaCompat (Constructor)" id="QsciScintillaCompat (Constructor)" ref="eric5.QScintilla.QsciScintillaCompat.html#QsciScintillaCompat.__init__" />
       <keyword name="QsciScintillaCompat (Module)" id="QsciScintillaCompat (Module)" ref="eric5.QScintilla.QsciScintillaCompat.html" />
+      <keyword name="QsciScintillaCompat.__completionListSelected" id="QsciScintillaCompat.__completionListSelected" ref="eric5.QScintilla.QsciScintillaCompat.html#QsciScintillaCompat.__completionListSelected" />
       <keyword name="QsciScintillaCompat.__doSearchTarget" id="QsciScintillaCompat.__doSearchTarget" ref="eric5.QScintilla.QsciScintillaCompat.html#QsciScintillaCompat.__doSearchTarget" />
       <keyword name="QsciScintillaCompat.__setFoldMarker" id="QsciScintillaCompat.__setFoldMarker" ref="eric5.QScintilla.QsciScintillaCompat.html#QsciScintillaCompat.__setFoldMarker" />
       <keyword name="QsciScintillaCompat._encodeString" id="QsciScintillaCompat._encodeString" ref="eric5.QScintilla.QsciScintillaCompat.html#QsciScintillaCompat._encodeString" />
--- a/Documentation/Source/eric5.Helpviewer.HelpWindow.html	Fri Jan 31 11:00:24 2014 +0100
+++ b/Documentation/Source/eric5.Helpviewer.HelpWindow.html	Fri Jan 31 12:12:56 2014 +0100
@@ -178,6 +178,9 @@
 <td><a href="#HelpWindow.__currentChanged">__currentChanged</a></td>
 <td>Private slot to handle the currentChanged signal.</td>
 </tr><tr>
+<td><a href="#HelpWindow.__del__">__del__</a></td>
+<td>Special method called during object destruction.</td>
+</tr><tr>
 <td><a href="#HelpWindow.__docsInstalled">__docsInstalled</a></td>
 <td>Private slot handling the end of documentation installation.</td>
 </tr><tr>
@@ -859,7 +862,16 @@
 <dd>
 index of the current tab (integer)
 </dd>
-</dl><a NAME="HelpWindow.__docsInstalled" ID="HelpWindow.__docsInstalled"></a>
+</dl><a NAME="HelpWindow.__del__" ID="HelpWindow.__del__"></a>
+<h4>HelpWindow.__del__</h4>
+<b>__del__</b>(<i></i>)
+<p>
+        Special method called during object destruction.
+</p><p>
+        Note: This empty variant seems to get rid of the Qt message
+        'Warning: QBasicTimer::start: QBasicTimer can only be used with
+        threads started with QThread'
+</p><a NAME="HelpWindow.__docsInstalled" ID="HelpWindow.__docsInstalled"></a>
 <h4>HelpWindow.__docsInstalled</h4>
 <b>__docsInstalled</b>(<i>installed</i>)
 <p>
--- a/Documentation/Source/eric5.QScintilla.QsciScintillaCompat.html	Fri Jan 31 11:00:24 2014 +0100
+++ b/Documentation/Source/eric5.QScintilla.QsciScintillaCompat.html	Fri Jan 31 12:12:56 2014 +0100
@@ -73,6 +73,9 @@
 <td><a href="#QsciScintillaCompat.__init__">QsciScintillaCompat</a></td>
 <td>Constructor</td>
 </tr><tr>
+<td><a href="#QsciScintillaCompat.__completionListSelected">__completionListSelected</a></td>
+<td>Private slot to handle the selection from the completion list.</td>
+</tr><tr>
 <td><a href="#QsciScintillaCompat.__doSearchTarget">__doSearchTarget</a></td>
 <td>Private method to perform the search in target.</td>
 </tr><tr>
@@ -379,6 +382,24 @@
 <dd>
 parent widget (QWidget)
 </dd>
+</dl><a NAME="QsciScintillaCompat.__completionListSelected" ID="QsciScintillaCompat.__completionListSelected"></a>
+<h4>QsciScintillaCompat.__completionListSelected</h4>
+<b>__completionListSelected</b>(<i>id, txt</i>)
+<p>
+        Private slot to handle the selection from the completion list.
+</p><p>
+        Note: This works around an issue of some window managers taking
+        focus away from the application when clicked inside a completion
+        list but not giving it back when an item is selected via a
+        double-click.
+</p><dl>
+<dt><i>id</i></dt>
+<dd>
+the ID of the user list (integer)
+</dd><dt><i>txt</i></dt>
+<dd>
+the selected text (string)
+</dd>
 </dl><a NAME="QsciScintillaCompat.__doSearchTarget" ID="QsciScintillaCompat.__doSearchTarget"></a>
 <h4>QsciScintillaCompat.__doSearchTarget</h4>
 <b>__doSearchTarget</b>(<i></i>)
@@ -1476,7 +1497,7 @@
 <h4>QsciScintillaCompat.showUserList</h4>
 <b>showUserList</b>(<i>id, lst</i>)
 <p>
-        Public method to show a user supplied list.
+            Public method to show a user supplied list.
 </p><dl>
 <dt><i>id</i></dt>
 <dd>
--- a/QScintilla/QsciScintillaCompat.py	Fri Jan 31 11:00:24 2014 +0100
+++ b/QScintilla/QsciScintillaCompat.py	Fri Jan 31 12:12:56 2014 +0100
@@ -67,6 +67,8 @@
         self.__targetSearchStart = 0
         self.__targetSearchEnd = -1
         self.__targetSearchActive = False
+        
+        self.userListActivated.connect(self.__completionListSelected)
     
     def setLexer(self, lex=None):
         """
@@ -1250,20 +1252,41 @@
     ## replacements for buggy methods
     ###########################################################################
     
-    def showUserList(self, id, lst):
-        """
-        Public method to show a user supplied list.
-        
-        @param id id of the list (integer)
-        @param lst list to be show (list of strings)
+    if "showUserList" not in QsciScintilla.__dict__:
+        def showUserList(self, id, lst):
+            """
+            Public method to show a user supplied list.
+            
+            @param id id of the list (integer)
+            @param lst list to be show (list of strings)
+            """
+            if id <= 0:
+                return
+            
+            self.SendScintilla(
+                QsciScintilla.SCI_AUTOCSETSEPARATOR,
+                ord(self.UserSeparator))
+            self.SendScintilla(
+                QsciScintilla.SCI_USERLISTSHOW, id,
+                self._encodeString(self.UserSeparator.join(lst)))
+    
+    ###########################################################################
+    ## work-arounds for buggy behavior
+    ###########################################################################
+    
+    def __completionListSelected(self, id, txt):
         """
-        if id <= 0:
-            return
+        Private slot to handle the selection from the completion list.
         
-        self.SendScintilla(QsciScintilla.SCI_AUTOCSETSEPARATOR,
-                           ord(self.UserSeparator))
-        self.SendScintilla(QsciScintilla.SCI_USERLISTSHOW, id,
-                           self._encodeString(self.UserSeparator.join(lst)))
+        Note: This works around an issue of some window managers taking
+        focus away from the application when clicked inside a completion
+        list but not giving it back when an item is selected via a
+        double-click.
+        
+        @param id the ID of the user list (integer)
+        @param txt the selected text (string)
+        """
+        self.activateWindow()
     
     ###########################################################################
     ## utility methods

eric ide

mercurial