LayoutView documentation on web site does not include Qt binding methods

Hi, Matthias!

Source code in src/layview/layview/gsiDeclLayLayoutView_qt.cc contains bunch of methods in HAVE_QTBINDINGS section, but they are not included into web site documentation through they are referenced in other parts like bookmarks_frame in LV_NoBookmarksView.

Comments

  • Sorry, my bad, I didn't notice that this is methods of LayoutViewWidget. But nevertheless, LayoutViewWidget stuff is referenced in LayoutView as part of internal API.

  • Another question: It's possible to get LayoutViewWidget from LayoutView.view, but there is no method to get LayoutViewWidget from LayoutView.

  • Hi Eugene,

    LayoutView used to be a QWidget, but that turned out no longer to be feasible with the upcoming of a Qt-less LayoutView for the klayout Python module.

    Instead there is LayoutViewWidget if you want to embed a LayoutView into your own user interface.

    For example, this code shows how to instantiate a LayoutView detached from the main window:

    import pya
    
    file = "test.gds"
    
    dialog = pya.QDialog()
    layout = pya.QHBoxLayout(dialog)
    
    lvw = pya.LayoutViewWidget(dialog, False, None, 0 * pya.LayoutViewBase.LV_NoPropertiesPopup)
    
    layout.addWidget(lvw.hierarchy_control_frame())
    layout.addWidget(lvw)
    
    vlayout = pya.QVBoxLayout(dialog)
    layout.addLayout(vlayout)
    
    vlayout.addWidget(lvw.layer_control_frame())
    vlayout.addWidget(lvw.layer_toolbox_frame())
    
    lvw.view().switch_mode("select")
    lvw.view().load_layout(file)
    
    dialog.exec_()
    

    It is however, not possible currently to get the QWidget from an existing LayoutView. That is not impossible, but I wonder what the use case is.

    Kind regards,

    Matthias

  • edited April 2023

    Hi, Matthias!

    Use case is to tweak default appearance of some of LayoutViewWidget widgets while processing MainWindow.on_current_view_changed/on_view_created. For example, hiding/showing cells and layers panels.

  • I see. I feels a bit hacky as you need to act on the internal widget hierarchy, but basically that is possible.
    It should be easy to provide that access. I just wasn't aware of the need to have it. I have created a ticket to remind me: https://github.com/KLayout/klayout/issues/1339

    Matthias

Sign In or Register to comment.