diff --git a/CMakeLists.txt b/CMakeLists.txt index 00caaba1..7ebf27e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,7 @@ endif () include(MicroTeXInstall.cmake) add_subdirectory(lib) +add_subdirectory(doc) file(COPY res DESTINATION .) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 00000000..68d11ff6 --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,4 @@ +set(cwd ${CMAKE_CURRENT_LIST_DIR}) +set(source_root ${microtex_SOURCE_DIR}) +set(version ${microtex_VERSION}) +configure_file(microtex.doxy.in microtex.doxy @ONLY) diff --git a/doc/mainpage.h b/doc/mainpage.h index 4352dbe2..f870f567 100644 --- a/doc/mainpage.h +++ b/doc/mainpage.h @@ -204,7 +204,7 @@ * It is comercially developed by the QT company, while the KDE project * ensures the free software nature of the library. * - * To see how to use \f$\MicroTeX\f$ with QT see this page. + * To see how to use \f$\MicroTeX\f$ with QT see \ref qt_doc. * * \subsection platform_win32 Win32 * Microsoft Windows's native user interface stacks allows drawing of diff --git a/doc/microtex.doxy.in b/doc/microtex.doxy.in index 51bf83a4..c180039f 100644 --- a/doc/microtex.doxy.in +++ b/doc/microtex.doxy.in @@ -874,7 +874,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = "@cwd@/mainpage.h" "@cwd@/cairodoc.h" "@cwd@/fontdoc.h" \ +INPUT = "@cwd@/mainpage.h" "@cwd@/cairodoc.h" "@cwd@/qtdoc.h" "@cwd@/fontdoc.h" \ "@source_root@/lib" \ "@source_root@/platform/cairo" \ "@source_root@/platform/gdi_win/" \ diff --git a/doc/qtdoc.h b/doc/qtdoc.h new file mode 100644 index 00000000..d1828bd2 --- /dev/null +++ b/doc/qtdoc.h @@ -0,0 +1,54 @@ +/** \page qt_doc Qt Documentation + * + * \section qt_opts Build options + * + * \subsection Meson + * to build support for the Qt platform using meson, you need to + * invoke meson using -DQT=true as parameter. + * + * If you want to build the Qt demo too, you need to add the + * -DEXAMPLE_QT=true to the params too. + * + * \subsection CMake + * + * for cmake, you need to configure it, with -DQT=ON + * and optionally with -DBUILD_EXAMPLE_QT=ON. + * + * \section qt_usage Usage + * + * \subsection qt_init Initialization and PlatformFactory setup + * Refer to \ref index "the main page" for info about information about automatic + * font detection. The PlatformFactory setup is qt specific. + * @code + * microtex::InitFontSenseAuto autoinit; + * microtex::MicroTeX::init(autoinit); + * microtex::PlatformFactory::registerFactory("qt", std::make_unique()); + * microtex::PlatformFactory::activate("qt"); + * @endcode + * + * \subsection qt_render Rendering + * You need to make use of microtex::Graphics2D_qt to render + * equations onto a QWidget with QPainter. Please note that the caller + * keeps the ownership of the cairo context. + * + * Before use microtex::Graphics2D_qt, the microtex::Render must be initialized. + * You can either use the convenience + * method microtex::MicroTeX::parse(), or construct it yourself using + * microtex::RenderBuilder if you need more customization. + * + * @code + * void MyWidget::init_render() { + * // _render is a field of MyWidget class + * // microtex::Render* _render; + * _render = microtex::MicroTeX::parse(args...); + * // or use microtex::RenderBuilder + * } + * void MyWidget::paintEvent(QPaintEvent* event) { + * QPainter painter(this); + * painter.setRenderHint(QPainter::Antialiasing, true); + * Graphics2D_qt g2(&painter); + * _render.draw(g2, 0, 0); + * } + * @endcode + * + */