File indexing completed on 2024-04-21 03:51:05

0001 /*
0002     SPDX-FileCopyrightText: 2010 Daniel Laidig <laidig@kde.org>
0003     SPDX-FileCopyrightText: 2009 Alexander Rieder <alexanderrieder@gmail.com>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 // based on Cantor's LaTeX rendering code
0008 
0009 #ifndef PRACTICE_LATEXRENDERER_H
0010 #define PRACTICE_LATEXRENDERER_H
0011 
0012 #include <QObject>
0013 
0014 class QLabel;
0015 
0016 namespace Practice
0017 {
0018 class LatexRenderer : public QObject
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit LatexRenderer(QObject *parent = nullptr);
0024     void setResultLabel(QLabel *label)
0025     {
0026         m_label = label;
0027     }
0028     void renderLatex(QString tex);
0029 
0030     static bool isLatex(const QString &tex);
0031 
0032 private Q_SLOTS:
0033     void convertToPs();
0034     void convertToImage();
0035     void latexRendered();
0036 
0037 private:
0038     QLabel *m_label{nullptr};
0039     QString m_latexFilename;
0040 };
0041 
0042 }
0043 
0044 #endif // PRACTICE_LATEXRENDERER_H