bugGNU Octave - Bugs: bug #53600, Use convention Qt event handling...


bug #53600: Use convention Qt event handling for consistent octave_dock_widget focusing

Submitted by:  Dan Sebald <sebald>
Submitted on:  Tue 10 Apr 2018 05:38:41 AM UTC  
Category: GUISeverity: 3 - Normal
Priority: 5 - NormalItem Group: Other
Status: NoneAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: Any

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sat 14 Apr 2018 05:11:20 PM UTC, comment #4:

It's in the patch designed to bring the V.E. tab to the front when calling "openvar x":


The idea of this bug report is to move away from using tabData() in such a way by simply reusing the code that already achieves that for some other feature.

As for the recursion, I recall Qt documentation stating one has to be a bit careful with the focus routines because recursions easily occur, depending on how the window manager works I would guess.

Dan Sebald <sebald>
Sat 14 Apr 2018 02:29:59 PM UTC, comment #3:

What do yo mean by "but the routine focus_command_window() has a more straightforward method"? focus_command_window () is also just calling command_window->focus (). The focus routine is merely a replacement of the setFocus method.

Searching in all files, I only see the use of tabData in the old webinfo.cc doc-browser, which is not used anymore. Where is it used for handling octave_dock_widgets?

Torsten <ttl>
Project Member
Fri 13 Apr 2018 03:28:25 PM UTC, comment #2:

This changeset needs a bit of work. Testing along with a different bug patch, this can get into a recursive focus under certain conditions. I'll come back to this one later.

Dan Sebald <sebald>
Tue 10 Apr 2018 07:16:33 AM UTC, comment #1:

It happens that octave_dock_widget currently has a virtual method "focus()" which in theory serves the same purpose as Qt QWidget focusInEvent() handler. So I propose moving the contents of focus() to an overridden focusInEvent() and then inherently make use of that code in all octave_dock_widget objects simply by issuing the standard setFocus() method. Changeset attached.

Note that I removed most of the setFocusProxy() from the objects inheriting octave_dock_widget. The focus behaved better that way because with that proxy in place the focusInEvent never occurred. (I suppose that is why someone put the ->focus() virtual function in the code, to ensure that it is always called.) The thing to do if one needs to ensure some child in a octave_dock_widget derivative gets the focus is to override and add to focusInEvent(), some examples of which are already in the code.

(file #43865)

Dan Sebald <sebald>
Tue 10 Apr 2018 05:38:41 AM UTC, original submission:

In the fix for Bug #53443 the solution for bringing non-command-window octave_dock_widgets (i.e., variable_editor) to the front, even if a tabbed QDockWidget. The code utilizes some undocumentated tabData() of QTabBars. It works, but the routine focus_command_window() has a more straightforward method that utilizes conventional Qt methods. The goal is to reuse such code with other octave_dock_widgets.

Dan Sebald <sebald>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by ttl (Posted a comment)
  • -unavailable- added by sebald (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 10 Apr 2018 07:16:33 AM UTCsebaldAttached File-=>Added octave-eliminate_focus_and_tab_to_front_functions-djs2018apr10.patch, #43865

    Back to the top

    Powered by Savane 3.1-cleanup1