Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 5fea93a

Browse files
committed
Fix compatibility issue with Qt 5.15
1 parent ff24053 commit 5fea93a

File tree

6 files changed

+260
-225
lines changed

6 files changed

+260
-225
lines changed

src/rameditwidgets/schedulecommenteditwidget.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ void ScheduleCommentEditWidget::setColor(const QColor &color)
2626

2727
void ScheduleCommentEditWidget::setComment()
2828
{
29+
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
30+
QString comment = ui_commentEdit->toPlainText();
31+
#else
2932
QString comment = ui_commentEdit->toMarkdown();
33+
#endif
3034
if (!m_comment) {
3135
m_comment = new RamScheduleComment( m_project );
3236
m_comment->setDate(m_date);
@@ -71,7 +75,11 @@ void ScheduleCommentEditWidget::setupUi()
7175
ui_commentEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
7276
dummyLayout->addWidget(ui_commentEdit);
7377
if (m_comment)
78+
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
79+
ui_commentEdit->setPlainText(m_comment->comment());
80+
#else
7481
ui_commentEdit->setMarkdown(m_comment->comment());
82+
#endif
7583
}
7684

7785
void ScheduleCommentEditWidget::connectEvents()

src/rameditwidgets/scheduleentryeditwidget.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ void ScheduleEntryEditWidget::setComment()
2828
auto step = qobject_cast<RamStep*>(ui_stepBox->currentObject());
2929
m_entry = new RamScheduleEntry(m_user, step, m_date);
3030
}
31-
31+
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
32+
m_entry->setComment(ui_commentEdit->toPlainText());
33+
#else
3234
m_entry->setComment(ui_commentEdit->toMarkdown());
35+
#endif
3336
}
3437

3538
void ScheduleEntryEditWidget::setupUi()
@@ -73,8 +76,12 @@ void ScheduleEntryEditWidget::setupUi()
7376
ui_commentEdit->setObjectName("commentEdit");
7477
ui_commentEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
7578
dummyLayout->addWidget(ui_commentEdit);
76-
if (m_entry)
79+
if (m_entry)
80+
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
81+
ui_commentEdit->setPlainText(m_entry->comment());
82+
#else
7783
ui_commentEdit->setMarkdown(m_entry->comment());
84+
#endif
7885

7986
// Get due tasks
8087
const QDate date = m_date.date();

src/ramobjectdelegates/ramobjectdelegate.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,11 @@ int RamObjectDelegate::drawMarkdown(QPainter *painter, QRect rect, const QString
665665

666666
QTextDocument td;
667667
td.setIndentWidth(20);
668+
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
669+
td.setPlainText(md);
670+
#else
668671
td.setMarkdown(md);
672+
#endif
669673
td.setTextWidth(rect.width());
670674

671675
QRect clipRect(rect);

src/ramobjectdelegates/ramscheduledelegate.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,11 @@ int RamScheduleDelegate::drawMarkdown(QPainter *painter, QRect rect, const QStri
317317

318318
QTextDocument td;
319319
td.setIndentWidth(20);
320+
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
321+
td.setPlainText(md);
322+
#else
320323
td.setMarkdown(md);
324+
#endif
321325
td.setTextWidth(rect.width());
322326

323327
QRect clipRect(rect);

src/ramobjects/ramabstractobject.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,19 +380,31 @@ QVariant RamAbstractObject::roleData(int role) const
380380
td.setIndentWidth(20);
381381
QString comment = this->comment();
382382
if (comment != "") {
383+
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
384+
td.setPlainText(comment);
385+
#else
383386
td.setMarkdown(comment);
387+
#endif
384388
h += 5 + td.size().height();
385389
w = std::fmax(w, td.size().width());
386390
}
387391
QString details = this->details();
388392
if (details != "") {
393+
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
394+
td.setPlainText(details);
395+
#else
389396
td.setMarkdown(details);
397+
#endif
390398
h += 5 + td.size().height();
391399
w = std::fmax(w, td.size().width());
392400
}
393401
QString subDetails = this->subDetails();
394402
if (subDetails != "") {
403+
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
404+
td.setPlainText(subDetails);
405+
#else
395406
td.setMarkdown(subDetails);
407+
#endif
396408
h += 5 + td.size().height();
397409
w = std::fmax(w, td.size().width());
398410
}

0 commit comments

Comments
 (0)