Skip to content

Commit

Permalink
fix Qt 5.9.5 build failure
Browse files Browse the repository at this point in the history
  • Loading branch information
bhaller committed Aug 20, 2024
1 parent 5acf999 commit c703dca
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions QtSLiM/QtSLiMAppDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
#ifdef __APPLE__
// On macOS we enforce Qt 5.15.2 as a hard limit; macOS does not have Qt preinstalled, and there is
// not much reason for anybody to use a version prior to 5.15.2 for a build. 5.15.2 is the only
// LTS version with support for macOS 11, dark mode, and various other things we want. However,
// Qt5 LTS version with support for macOS 11, dark mode, and various other things we want. However,
// if you need to build against an earlier Qt version (because you're using a macOS version earlier
// than 10.13, perhaps), you can disable this check using the above flag and your build will probably
// work; just note that that configuration is unsupported.
Expand All @@ -97,7 +97,7 @@

// We now support Qt 6, but do not require it. Note that SLiM 4.2.2 was the last version that supported only Qt 5.
#if (QT_VERSION >= QT_VERSION_CHECK(7, 0, 0))
#error "SLiMgui requires Qt 5.15 or Qt 6. Qt 7 and later are not supported at this time."
#error "SLiMgui requires Qt 5 or Qt 6. Qt 7 and later are not supported at this time."
#endif
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
#error "SLiMgui requires Qt 5 or Qt 6. Qt 4 and earlier are not supported."
Expand Down
18 changes: 13 additions & 5 deletions QtSLiM/QtSLiMWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5234,6 +5234,14 @@ void QtSLiMWindow::chromosomeActionRunMenu(void)
chromosomeActionReleased();
}

#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
// In some versions of Qt5, such as 5.9.5, QChar::FormFeed did not yet exist
#define Eidos_FormFeed 0x0C
#else
// In Qt6, QChar::FormFeed is the preferred symbol for this
#define Eidos_FormFeed QChar::FormFeed
#endif

void QtSLiMWindow::jumpToPopupButtonRunMenu(void)
{
QPlainTextEdit *scriptTE = ui->scriptTextEdit;
Expand Down Expand Up @@ -5281,7 +5289,7 @@ void QtSLiMWindow::jumpToPopupButtonRunMenu(void)

// Exclude comments that contain newlines and similar characters
if ((comment.indexOf(QChar::LineFeed) != -1) ||
(comment.indexOf(QChar::FormFeed) != -1) ||
(comment.indexOf(Eidos_FormFeed) != -1) ||
(comment.indexOf(QChar::CarriageReturn) != -1) ||
(comment.indexOf(QChar::ParagraphSeparator) != -1) ||
(comment.indexOf(QChar::LineSeparator) != -1))
Expand Down Expand Up @@ -5465,8 +5473,8 @@ void QtSLiMWindow::jumpToPopupButtonRunMenu(void)
// Remove everything including and after the first newline
if (decl.indexOf(QChar::LineFeed) != -1)
decl.truncate(decl.indexOf(QChar::LineFeed));
if (decl.indexOf(QChar::FormFeed) != -1) // form feed; apparently QChar::FormFeed did not exist in older Qt versions
decl.truncate(decl.indexOf(QChar::FormFeed));
if (decl.indexOf(Eidos_FormFeed) != -1)
decl.truncate(decl.indexOf(Eidos_FormFeed));
if (decl.indexOf(QChar::CarriageReturn) != -1)
decl.truncate(decl.indexOf(QChar::CarriageReturn));
if (decl.indexOf(QChar::ParagraphSeparator) != -1)
Expand Down Expand Up @@ -5648,8 +5656,8 @@ void QtSLiMWindow::setScriptBlockLabelTextFromSelection(void)
// Remove everything including and after the first newline
if (decl.indexOf(QChar::LineFeed) != -1)
decl.truncate(decl.indexOf(QChar::LineFeed));
if (decl.indexOf(QChar::FormFeed) != -1) // form feed; apparently QChar::FormFeed did not exist in older Qt versions
decl.truncate(decl.indexOf(QChar::FormFeed));
if (decl.indexOf(Eidos_FormFeed) != -1)
decl.truncate(decl.indexOf(Eidos_FormFeed));
if (decl.indexOf(QChar::CarriageReturn) != -1)
decl.truncate(decl.indexOf(QChar::CarriageReturn));
if (decl.indexOf(QChar::ParagraphSeparator) != -1)
Expand Down
5 changes: 5 additions & 0 deletions VERSIONS
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ development head (in the master branch):
add calcPi() and calcTajimasD() functions thanks to Nick Bailey
extend deviatePositions(), pointDeviated(), sampleNearbyPoint(), and sampleImprovedNearbyPoint() to allow vectorization with a different spatial kernel for each iteration
shift to supporting Qt6 and C++17 to build SLiMgui; Qt5 with C++11 is still supported
for macOS, Qt6 is now the supported plaform for macOS 11/12/13/14; Qt5 should only be used on macOS 10.15
for Windows, Qt6 is now the supported platform for Windows 10 (1809 or later) and Windows 11
for Linux, Qt6 is now the supported platform for Red Hat 8.6/8.8/9.2, openSUSE 15.5, and Ubuntu 22.04 among others
these recommendations are based on Qt6's recommended platforms; earlier platforms should use Qt5
for more details see https://doc.qt.io/qt-6/linux.html, https://doc.qt.io/qt-6/windows.html, https://doc.qt.io/qt-6/macos.html


version 4.2.2 (Eidos version 3.2.2):
Expand Down

0 comments on commit c703dca

Please sign in to comment.