Files
z-bar-qt/Plugins/ZShell/Llm/mathtext.hpp
T
zach 52feb6006a
C++ / fmt (pull_request) Failing after 4s
C++ / build (pull_request) Failing after 9s
JS/TS / lint (pull_request) Successful in 9s
JS/TS / fmt (pull_request) Successful in 16s
C++ / clang-tidy (pull_request) Failing after 43s
Python / static (pull_request) Failing after 57s
Rust / fmt (pull_request) Successful in 1m30s
Rust / build (pull_request) Successful in 2m5s
Rust / clippy (pull_request) Successful in 1m55s
Python / verify (pull_request) Successful in 2m23s
chore: format llm c files
2026-08-31 19:02:26 +02:00

72 lines
1.9 KiB
C++

#pragma once
#include <QColor>
#include <QImage>
#include <QObject>
#include <QString>
#include <QUrl>
#include <QtQml>
#include <memory>
#include <jkqtmathtext/jkqtmathtext.h>
namespace ZShell::llm {
class LlmMathText : public QObject {
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(QString latex READ latex WRITE setLatex NOTIFY changed)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY changed)
Q_PROPERTY(
double fontPointSize READ fontPointSize WRITE setFontPointSize NOTIFY
changed)
Q_PROPERTY(
qreal devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio
NOTIFY changed)
Q_PROPERTY(QImage image READ image NOTIFY changed)
Q_PROPERTY(QUrl imageUrl READ imageUrl NOTIFY changed)
Q_PROPERTY(qreal width READ width NOTIFY changed)
Q_PROPERTY(qreal height READ height NOTIFY changed)
Q_PROPERTY(bool ok READ ok NOTIFY changed)
public:
explicit LlmMathText(QObject* parent = nullptr);
[[nodiscard]] QString latex() const { return m_latex; }
void setLatex(const QString& value);
[[nodiscard]] QColor color() const { return m_color; }
void setColor(const QColor& value);
[[nodiscard]] double fontPointSize() const { return m_fontPointSize; }
void setFontPointSize(double value);
[[nodiscard]] qreal devicePixelRatio() const { return m_devicePixelRatio; }
void setDevicePixelRatio(qreal value);
[[nodiscard]] QImage image() const { return m_image; }
[[nodiscard]] QUrl imageUrl() const { return m_imageUrl; }
[[nodiscard]] qreal width() const { return m_width; }
[[nodiscard]] qreal height() const { return m_height; }
[[nodiscard]] bool ok() const { return m_ok; }
Q_SIGNALS:
void changed();
private:
void reRender();
std::shared_ptr<JKQTMathText> m_renderer;
QString m_latex;
QColor m_color;
double m_fontPointSize = 12.0;
qreal m_devicePixelRatio = 1.0;
QImage m_image;
QUrl m_imageUrl;
qreal m_width = 0;
qreal m_height = 0;
bool m_ok = false;
int m_requestId = 0;
bool m_inFlight = false;
};
} // namespace ZShell::llm