Skip to content

Commit

Permalink
Merge pull request #309 from CreativeLau/develop
Browse files Browse the repository at this point in the history
Make compilation possible with Qt >= 5.12
Relates to GitHub #310
  • Loading branch information
HuguesDelorme authored Dec 5, 2024
2 parents 4fdc1cc + 1a5ffb4 commit ae8dd63
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ option(Mayo_BuildConvCli "Build Mayo CLI converter" ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED)
if(QT_FOUND)
message(STATUS "Qt version ${QT_VERSION}")
if(QT_VERSION VERSION_LESS 5.14)
message(FATAL_ERROR "Qt >= 5.14 is required but detected version is ${QT_VERSION}")
if(QT_VERSION VERSION_LESS 5.12)
message(FATAL_ERROR "Qt >= 5.12 is required but detected version is ${QT_VERSION}")
endif()

set("Qt${QT_VERSION_MAJOR}_DIR" "${QT_DIR}")
Expand Down
2 changes: 2 additions & 0 deletions src/app/qtgui_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ QPixmap toQPixmap(const Image_PixMap& pixmap)
auto fnToQImageFormat = [](Image_Format occFormat) {
switch (occFormat) {
case Image_Format_RGB: return QImage::Format_RGB888;
#if (QT_VERSION>=QT_VERSION_CHECK(5,14,0))
case Image_Format_BGR: return QImage::Format_BGR888;
#endif
case Image_Format_RGBA: return QImage::Format_ARGB32;
case Image_Format_RGBF: return QImage::Format_RGB444;
case Image_Format_Gray: return QImage::Format_Grayscale8;
Expand Down
4 changes: 4 additions & 0 deletions src/app/widget_main_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,11 @@ void WidgetMainControl::reloadDocumentAfterChange(const DocumentPtr& doc)
;
const auto msgBtns = QMessageBox::Yes | QMessageBox::No;
auto msgBox = new QMessageBox(QMessageBox::Question, tr("Question"), strQuestion, msgBtns, this);
#if (QT_VERSION>=QT_VERSION_CHECK(5,14,0))
msgBox->setTextFormat(Qt::MarkdownText);
#else
msgBox->setTextFormat(Qt::AutoText);
#endif
QtWidgetsUtils::asyncDialogExec(msgBox);
QObject::connect(msgBox, &QMessageBox::buttonClicked, this, [=](QAbstractButton* btn) {
m_docFilesWatcher->acknowledgeDocumentFileChange(doc);
Expand Down
2 changes: 1 addition & 1 deletion src/qtbackend/qt_signal_thread_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ std::any QtSignalThreadHelper::getCurrentThreadContext()

void QtSignalThreadHelper::execInThread(const std::any& context, const std::function<void()>& fn)
{
QTimer::singleShot(0, std::any_cast<QObject*>(context), fn);
QMetaObject::invokeMethod(std::any_cast<QObject*>(context), fn, Qt::ConnectionType::QueuedConnection);
}

} // namespace Mayo

0 comments on commit ae8dd63

Please sign in to comment.