Skip to content

Commit

Permalink
[BUGFIX] Fixed backward compat. with older Qt5 versions
Browse files Browse the repository at this point in the history
  • Loading branch information
hasherezade committed Sep 15, 2024
1 parent 14d6f20 commit f388aa8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions pe-bear/QtCompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets>
#define QT_SkipEmptyParts Qt::SkipEmptyParts
#else
#include <QtGui>
typedef QRegExp QRegularExpression;
typedef QRegExpValidator QRegularExpressionValidator;
#define QT_SkipEmptyParts QString::SkipEmptyParts
typedef QRegExp QRegularExpression;
typedef QRegExpValidator QRegularExpressionValidator;
#endif

#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
#define QT_SkipEmptyParts Qt::SkipEmptyParts
#else
#define QT_SkipEmptyParts QString::SkipEmptyParts
#endif
2 changes: 1 addition & 1 deletion pe-bear/gui/windows/SignaturesBrowseWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class SigSortFilterProxyModel : public QSortFilterProxyModel
for(int i = 0; i < source->columnCount(); i++)
{
QModelIndex index = source->index(sourceRow, i, sourceParent);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
if (source->data(index).toString().toLower().trimmed().contains(filterRegularExpression())) return true;
#else
if (source->data(index).toString().toLower().trimmed().contains(filterRegExp())) return true;
Expand Down
2 changes: 1 addition & 1 deletion pe-bear/gui/windows/StringsBrowseWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void StringsBrowseWindow::filterPatamsChanged(QString &str, bool isRegex, bool i
if (!this->stringsProxyModel) return;

if (isRegex) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QRegularExpression::PatternOptions options = isCaseSens ?
QRegularExpression::NoPatternOption :
QRegularExpression::CaseInsensitiveOption;
Expand Down

0 comments on commit f388aa8

Please sign in to comment.