-
Notifications
You must be signed in to change notification settings - Fork 257
Description
Dear @klayoutmatthias,
This is related to https://www.klayout.de/forum/discussion/comment/3035
In my PYA, I want to use a custom widget (promoted from QTableView) with various features, including keyboard Cut & Paste.
The user interface (*.ui) designed by using Qt Designer is complicated.
To enable these features, I've defined a subclass (promoted in Qt Designer) that is defined as:
class MyTableView( pya.QTableView ):
def __init_( self, parent=None ):
super( MyTableView, self ).__init__(parent)
:
def keyPressEvent( self, event ):
:
However, when starting the PYA script that reads the UI file by pya.QFormBuilder().load(), a warning below is delivered.
Warning: "QFormBuilder was unable to create a custom widget of the class 'MyTableView'; defaulting to base class 'QTableView'."
Referring to the idea in:
https://stackoverflow.com/questions/37775472/quiloader-requirements-for-loading-ui-file-with-custom-widgets
Do you think it's possible to newly provide class 'QUiLoader' in PYA and RBA that can be used as follows?
class CustomQUiLoader( pya.QUiLoader ):
def createWidget( self, className, parent=None, name='' ):
if className == 'MyTableView':
ret = MyTableView(parent)
ret.setObjectName(name)
return ret
return super().createWidget(className, parent, name)
dialog = CustomQUiLoader().load( 'myComplicatedTable.ui', parent )
:
:
:
Thanks and best regards,
Kazzz-S