markdownview.cpp 518 B

12345678910111213141516171819202122232425262728
  1. #include "markdownview.h"
  2. MarkdownView::MarkdownView(QWidget *parent)
  3. : QMainWindow(parent)
  4. {
  5. ui.setupUi(this);
  6. }
  7. MarkdownView::~MarkdownView()
  8. {
  9. }
  10. void MarkdownView::viewMarkdown(QString& text)
  11. {
  12. #if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
  13. QString tips = QString(
  14. "NOTE: Your Qt version is lower than 5.14, so you can't preview Markdown for the time being."
  15. "\n"
  16. "\n"
  17. "%1").arg(text);
  18. ui.textEdit->setPlainText(tips);
  19. #else
  20. ui.textEdit->setMarkdown(text);
  21. #endif
  22. }