This document is for OpenStructure version 2.5, the latest version is 2.9.0 !

Mixing PyQt and C++ Widgets

PyQt5 is a set of Python bindings for Qt5. The exposure from C++ to Python is done with SIP, which has a different mechanism than boost::python.

To access a exported boost::python Qt-Object from Python we provide a method which wraps the Object into a Python SIP Object.

seq_viewer = gui.SequenceViewer() # Create SequenceViewer Object
qobj = seq_viewer.qobject #Get Python SIP Object
print(qobj.size())   # Call function on QWidget

The other way around, each boost::python Qt Object accepts Python objects as input for Qt Objects. It handles the cast to a C++ Qt Object internally.

from PyQt5 import QtWidgets
persp = gui.GostyApp.Instance().perspective
test = persp.GetMenu("Test") #Get boost::python qobject
test_action = QtWidgets.QAction('&Test me', test) #Create Python SIP Object
test.addAction(test_action) #Add Action to boost::python object

Search

Enter search terms or a module, class or function name.

Contents

Documentation is available for the following OpenStructure versions:

dev / 2.9.0 / 2.8 / 2.7 / 2.6 / (Currently viewing 2.5) / 2.4 / 2.3.1 / 2.3 / 2.2 / 2.1 / 2.0 / 1.9 / 1.8 / 1.7.1 / 1.7 / 1.6 / 1.5 / 1.4 / 1.3 / 1.2 / 1.11 / 1.10 / 1.1

This documentation is still under heavy development!
If something is missing or if you need the C++ API description in doxygen style, check our old documentation for further information.