Commits

Henning Schröder committed dbf6e7e

quickstart documented

Comments (0)

Files changed (4)

 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'default'
+html_theme = 'sphinxdoc'
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
 
 .. toctree::
    :maxdepth: 2
+   
+   integration
+
+
+
 
 Indices and tables
 ==================

doc/integration.rst

+How to add EmbeddedPyQt to your C++ project
+===========================================
+
+
+Quickstart
+----------
+
+Six simple steps to embed Python into your Qt C++ project.
+
+1. Add the ``embpyqt`` folder to your project.
+
+2. Add the embpyqt-files and Python to your build. For qmake do
+
+.. code-block:: sh
+
+ INCLUDEPATH += -I./embpyqt
+ SOURCES += \
+     embpyqt/embeddedpyqt.cpp \
+     embpyqt/pythonize.cpp
+ HEADERS += \
+     embpyqt/embeddedpyqt.h \
+     embpyqt/pythonize.h
+ # Python
+ LIBS        += -lpython2.7 -L/usr/lib/
+ INCLUDEPATH += /usr/include/python2.7/
+
+
+3. Create an EmbeddedPyQt instance in your project:
+
+.. code-block:: c
+
+ #include "embpyqt/embeddedpyqt.h"
+ ...
+ EmbeddedPyQt embpyqt = new EmbeddedPyQt();
+  
+
+4. Register classes and instances to embpyqt:
+
+.. code-block:: c
+
+ embpyqt->registerObject(mainWindow);
+ embpyqt->registerMetaObject(Test::staticMetaObject);
+ 
+The instances will be known by their object name. To register classes
+you have to pass the staticMetaObject attribute.
+
+If an instance is a child object of a already registered instance (like embpyqt)
+you do not have to register it manually. It will be accessible as an
+attribute. The same applies to instance properties.
+
+
+5. Call the init script:
+
+.. code-block:: c
+
+ embpyqt->init("embpyqt/python/initembpyqt.py");
+
+Make sure that the python folder is copied to your installation target
+by your build system and that the path is correct.
+
+
+6. Now you can call Python from C++ by using the execute method:
+
+.. code-block:: c
+
+ embpyqt->execute("embpyqt_console.Visible = True", true);
+ 
+Python can connect to existing C++ signals and is able to modify the
+user interface.
     test.h
 FORMS    += mainwindow.ui
 
-# Python support
+
+# -- Generic Python support --------------------------------------
 INCLUDEPATH += -I./embpyqt
 LIBS        += -lpython2.7 -L/usr/lib/
 INCLUDEPATH += /usr/include/python2.7/
+
+# -- Add embpyqt -------------------------------------------------
 SOURCES += \
     embpyqt/embeddedpyqt.cpp \
     embpyqt/pythonize.cpp