Skip to content

Commit 8153ef3

Browse files
committed
Support Qt6
1 parent ae2322c commit 8153ef3

File tree

6 files changed

+142
-7
lines changed

6 files changed

+142
-7
lines changed

.gitignore

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# C++ objects and libs
2+
*.slo
3+
*.lo
4+
*.o
5+
*.a
6+
*.la
7+
*.lai
8+
*.so
9+
*.so.*
10+
*.dll
11+
*.dylib
12+
*.json
13+
14+
# Qt-es
15+
object_script.*.Release
16+
object_script.*.Debug
17+
*_plugin_import.cpp
18+
/.qmake.cache
19+
/.qmake.stash
20+
*.pro.user
21+
*.pro.user.*
22+
*.qbs.user
23+
*.qbs.user.*
24+
*.moc
25+
moc_*.cpp
26+
moc_*.h
27+
qrc_*.cpp
28+
ui_*.h
29+
*.qmlc
30+
*.jsc
31+
Makefile*
32+
*build-*
33+
*.qm
34+
*.prl
35+
36+
# Qt unit tests
37+
target_wrapper.*
38+
39+
# QtCreator
40+
*.autosave
41+
42+
# QtCreator Qml
43+
*.qmlproject.user
44+
*.qmlproject.user.*
45+
46+
# QtCreator CMake
47+
CMakeLists.txt.user*
48+
49+
# QtCreator 4.8< compilation database
50+
compile_commands.json
51+
52+
# QtCreator local machine specific files for imported projects
53+
*creator.user*
54+
55+
# Compiled Object files
56+
*.slo
57+
*.lo
58+
*.o
59+
*.obj
60+
61+
# Precompiled Headers
62+
*.gch
63+
*.pch
64+
65+
# Compiled Dynamic libraries
66+
*.so
67+
*.dylib
68+
*.dll
69+
70+
# Fortran module files
71+
*.mod
72+
73+
# Compiled Static libraries
74+
*.lai
75+
*.la
76+
*.a
77+
*.lib
78+
79+
# Executables
80+
*.exe
81+
*.out
82+
*.app
83+
84+
# Platform Specifics - auto generated files
85+
PlatformSpecifics/Windows/*.rc
86+
87+
# Visual studio - project files
88+
*.sln
89+
*.suo
90+
*.vcxproj
91+
*.vcxproj.filters
92+
*.vcxproj.user
93+
94+
# Visual Studio - Build Results
95+
[Dd]ebug/
96+
[Rr]elease/
97+
[Mm]in[Ss]ize[Rr]el/
98+
[Rr]el[Ww]ith[Dd]eb[Ii]nfo/
99+
build*/
100+
101+
# Visual Studio - Browsing Database File
102+
*.sdf
103+
*.opensdf
104+
105+
#osx xcode
106+
DerivedData/
107+
*.DS_Store
108+
*.build
109+
*.xcodeproj
110+
111+
#CPACK related files
112+
CPackConfig-*.cmake
113+
_CPack_Packages/
114+
115+
#packages
116+
*.tar.gz
117+
*.zip
118+
119+
*.swp
120+
*.*~
121+
122+
build_doxygen

qtservice/cmake/QtServiceConfig.cmake.in

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/")
44

55
include(CMakeFindDependencyMacro)
6-
foreach(dependens_lib @QTSERVICE_DEPENDENS@)
7-
find_dependency(${dependens_lib})
8-
endforeach()
6+
#foreach(dependens_lib @QTSERVICE_DEPENDENS@)
7+
# find_dependency(${dependens_lib})
8+
#endforeach()
9+
10+
find_dependency(Qt@QT_VERSION_MAJOR@ COMPONENTS @QT_COMPONENTS@)
911

1012
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
1113

qtservice/examples/interactive/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
****************************************************************************/
4040

4141
#include <QApplication>
42+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
4243
#include <QDesktopWidget>
44+
#endif
4345
#include <QLabel>
4446
#include <QDir>
4547
#include <QSettings>
@@ -87,7 +89,9 @@ void InteractiveService::start()
8789
qApp->setQuitOnLastWindowClosed(false);
8890

8991
gui = new QLabel("Service", 0, Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
92+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
9093
gui->move(QApplication::desktop()->availableGeometry().topLeft());
94+
#endif
9195
gui->show();
9296
}
9397

qtservice/examples/server/main.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@
4646
#include <QStringList>
4747
#include <QDir>
4848
#include <QSettings>
49-
49+
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
50+
#include <QRegularExpression>
51+
#endif
5052
#include "qtservice.h"
5153

5254
// HttpDaemon is the the class that implements the simple HTTP server.
@@ -98,7 +100,13 @@ private slots:
98100
// document back.
99101
QTcpSocket* socket = (QTcpSocket*)sender();
100102
if (socket->canReadLine()) {
101-
QStringList tokens = QString(socket->readLine()).split(QRegExp("[ \r\n][ \r\n]*"));
103+
104+
QStringList tokens;
105+
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
106+
tokens = QString(socket->readLine()).split(QRegularExpression("[ \r\n][ \r\n]*"));
107+
#else
108+
tokens = QString(socket->readLine()).split(QRegExp("[ \r\n][ \r\n]*"));
109+
#endif
102110
if (tokens[0] == "GET") {
103111
QTextStream os(socket);
104112
os.setAutoDetectUnicode(true);

qtservice/src/qtservice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ QtServiceBase::QtServiceBase(int argc, char **argv, const QString &name)
663663
d_ptr = new QtServiceBasePrivate(nm);
664664
d_ptr->q_ptr = this;
665665

666-
d_ptr->serviceFlags = 0;
666+
d_ptr->serviceFlags = static_cast<ServiceFlags>(0);
667667
d_ptr->sysd = 0;
668668
for (int i = 0; i < argc; ++i)
669669
d_ptr->args.append(QString::fromLocal8Bit(argv[i]));

qtservice/src/qtservice.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
# define QT_QTSERVICE_EXPORT
6060
#endif
6161

62-
class QStringList;
6362
class QtServiceControllerPrivate;
6463

6564
class QT_QTSERVICE_EXPORT QtServiceController

0 commit comments

Comments
 (0)