Skip to content

Commit

Permalink
update webserver example for qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
j2doll committed Mar 13, 2021
1 parent ee99dd9 commit e67147e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 18 deletions.
4 changes: 0 additions & 4 deletions WebServer/WebServer.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
TARGET = WebServer
TEMPLATE = app

equals( QT_MAJOR_VERSION, 6 ) {
QT += core5compat
}

QT += core
QT += network
QT -= gui
Expand Down
4 changes: 0 additions & 4 deletions WebServer/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
#include <QVariant>
#include <QHash>

#if QT_VERSION_MAJOR >= 6 // Qt6 or higher version
#include <QtCore5Compat>
#endif

#include "request.hpp"
#include "response.hpp"

Expand Down
4 changes: 0 additions & 4 deletions WebServer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
#include <QVector>
#include <QList>

#if QT_VERSION_MAJOR >= 6 // Qt6 or higher version
#include <QtCore5Compat>
#endif

#include "recurse.hpp"

#include "xlsxdocument.h"
Expand Down
12 changes: 11 additions & 1 deletion WebServer/recurse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
#include <QVector>

#if QT_VERSION_MAJOR >= 6 // Qt6 or higher version
#include <QtCore5Compat>
#include <QRegularExpression>
#include <QRegularExpressionMatch>
#endif

#include <functional>
Expand Down Expand Up @@ -439,10 +440,19 @@ namespace Recurse
{
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();

#if QT_VERSION_MAJOR >= 6 // Qt6 or higher version
QRegularExpression debug_strings("(recurse|development)");

QRegularExpressionMatch rem = debug_strings.match(env.value("DEBUG"));
if ( rem.hasMatch() )
m_debug = true;
#else
QRegExp debug_strings("(recurse|development)");

if (debug_strings.indexIn(env.value("DEBUG")) != -1)
m_debug = true;
#endif

}

inline Application::Application(int &argc, char **argv, QObject *parent)
Expand Down
2 changes: 1 addition & 1 deletion WebServer/request.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <QUrlQuery>

#if QT_VERSION_MAJOR >= 6 // Qt6 or higher version
#include <QtCore5Compat>
#include <QRegularExpression>
#endif

class Request
Expand Down
4 changes: 0 additions & 4 deletions WebServer/response.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
#include <QHash>
#include <QJsonDocument>

#if QT_VERSION_MAJOR >= 6 // Qt6 or higher version
#include <QtCore5Compat>
#endif

#include <functional>

class Response
Expand Down

0 comments on commit e67147e

Please sign in to comment.