Skip to content
This repository was archived by the owner on Feb 14, 2019. It is now read-only.

Commit 1d74920

Browse files
committed
[qt] Compatibility for qt < 5.3.0 and qt < 5.5.0
1 parent c9d7530 commit 1d74920

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/widget/QMathView.cc

+18
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ typedef libxml2_MathView MathView;
4141
class QMathViewLogger : public AbstractLogger
4242
{
4343
public:
44+
#if QT_VERSION >= 0x050300
4445
QMathViewLogger(const QLoggingCategory& category)
46+
#else
47+
QMathViewLogger(QLoggingCategory& category)
48+
#endif
4549
: AbstractLogger()
4650
, m_category(category)
4751
{}
@@ -54,15 +58,24 @@ class QMathViewLogger : public AbstractLogger
5458
qCCritical(m_category) << log;
5559
} else if (m_category.isWarningEnabled() && log.startsWith("[MathView] *** Warning")) {
5660
qCWarning(m_category) << log;
61+
#if QT_VERSION >= 0x050500
5762
} else if (m_category.isInfoEnabled() && log.startsWith("[MathView] *** Info")) {
5863
qCInfo(m_category) << log;
64+
#else
65+
} else if (m_category.isDebugEnabled() && log.startsWith("[MathView] *** Info")) {
66+
qCDebug(m_category) << log;
67+
#endif
5968
} else if (m_category.isDebugEnabled() && log.startsWith("[MathView] *** Debug")) {
6069
qCDebug(m_category) << log;
6170
}
6271
}
6372

6473
private:
74+
#if QT_VERSION >= 0x050300
6575
const QLoggingCategory& m_category;
76+
#else
77+
QLoggingCategory& m_category;
78+
#endif
6679
};
6780

6881
class QMathViewPrivate
@@ -79,7 +92,11 @@ class QMathViewPrivate
7992
RGBColor m_backgroundColor;
8093
};
8194

95+
#if QT_VERSION >= 0x050300
8296
QMathView::QMathView(const QFont& font, const QLoggingCategory& category)
97+
#else
98+
QMathView::QMathView(const QFont& font, QLoggingCategory& category)
99+
#endif
83100
: d(new QMathViewPrivate())
84101
{
85102
d->m_rawFont = QRawFont::fromFont(font);
@@ -123,6 +140,7 @@ void QMathView::setFont(const QFont& font) {
123140
d->m_view, d->m_backend->getMathGraphicDevice()
124141
));
125142
}
143+
126144
void QMathView::update(QPainter* painter) {
127145
d->m_rc.setPainter(painter);
128146
d->m_view->render(d->m_rc, scaled::zero(), -d->m_view->getBoundingBox().height);

src/widget/QMathView.hh

+6-1
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,22 @@
2323
#ifndef QMathView_hh
2424
#define QMathView_hh
2525

26-
#include <QtCore/QSizeF>
26+
#include <QSizeF>
2727
#include <QLoggingCategory>
2828
#include <QColor>
29+
#include <QtGlobal>
2930

3031
class QMathViewPrivate;
3132
class QPainter;
3233

3334
class QMathView
3435
{
3536
public:
37+
#if QT_VERSION >= 0x050300
3638
QMathView(const QFont& font, const QLoggingCategory& category);
39+
#else
40+
QMathView(const QFont& font, QLoggingCategory& category);
41+
#endif
3742
~QMathView();
3843
void loadURI(const char* mathml_url);
3944
void loadBuffer(const char* mathml_buf);

0 commit comments

Comments
 (0)