ID 327640 - Custom Panels cannot be scrolled when out of focus - Nuke11+

Follow

Problem summary
In earlier versions of Nuke, if a user had a custom scrollable panel, they could scroll through while focused on another panel.
Unfortunately, it no longer works in Nuke11 and above.

This behaviour only happens with Custom Panels.  
Default Nuke panels ( e.g Script Editor ) scroll correctly when focused on another panel.

Customer reported version
nuke.11.1v1

Customer reported platform
centos6

Steps to reproduce

1) Place your panel script (Or download the attached script) and set it up in your '.nuke' directory.

2) Open Nuke, open your custom panel.

3) Focus on your panel (Click in your panel's window) and scroll down.  (You should be able to scroll your panel)

4) Scroll another panel ( e.g Script Editor ) while keeping focus on the custom panel.

5) Follow step 3, but put your focus on the Script Editor

Result: The custom panel will no longer scroll until focused on.

Workaround
You can use Qt to create a custom event on the QDialog, associated with the custom panel that will set focus on Enter event.
 

import nukescriptsfrom PySide2 import QtWidgets, QtCoreclass ScrollTestWidget(QtWidgets.QWidget):    def __init__(self):        super( ScrollTestWidget, self).__init__()        self.setLayout( QtWidgets.QVBoxLayout() )        self.myTable = QtWidgets.QTableWidget()        for x in range(50):            self.myTable.insertRow(x)            self.myTable.setItem(x , 0, QtWidgets.QTableWidgetItem())        self.layout().addWidget(self.myTable)    def event(self, event):        if event.type() == QtCore.QEvent.Type.Enter:            ### print event            self.myTable.setFocus()        return super(ScrollTestWidget, self).event(event)nukescripts.panels.registerWidgetAsPanel('ScrollTestWidget', 'Test table panel', 'uk.co.thefoundry.ScrollTestWidget')

Or you can use the Wheel event on an eventFilter to set focus when scrolling:

import nukescriptsfrom PySide2 import QtWidgets, QtCoreclass ScrollTestWidget(QtWidgets.QWidget):    def __init__(self, parent=None):         super(ScrollTestWidget, self).__init__(parent)        self.setLayout(QtWidgets.QVBoxLayout())        self.myTable = QtWidgets.QTableWidget()        for x in range(50):            self.myTable.insertRow(x)            self.myTable.setItem(x , 0, QtWidgets.QTableWidgetItem())        self.layout().addWidget(self.myTable)    def eventFilter(self, widget, event):         if event.type() == QtCore.QEvent.Type.Wheel:            if self.myTable.underMouse():                 self.myTable.setFocus()        return super(ScrollTestWidget, self).eventFilter(widget, event)    def showEvent(self, event):         self.installEventFilter(self)        super(ScrollTestWidget, self).showEvent(event)nukescripts.panels.registerWidgetAsPanel('ScrollTestWidget', 'Test table panel', 'uk.co.thefoundry.ScrollTestWidget')
 
 
Reproduced by support
This bug has been reproduced in:
Nuke11.1v1 - Windows 7 - Mac10.13 - CentOS6.9
Nuke11.0v3 - Windows 7 - Mac10.13 - CentOS6.9
Nuke11.0v1 - Windows 7 - Mac10.13 - CentOS6.9

Unable to reproduce bug in:
Nuke10.5v7

Earliest version tested
Nuke10.5v7  - This issue no longer appears in this version and has regressed

Expected behaviour
The custom panel should be scroll-able while not in focus.

Actual behaviour
The custom panel does not scroll when it isn't focused.

    We're sorry to hear that

    Please tell us why