Skip to content

Commit ce701c3

Browse files
committed
build(Win): Switch to Qt6
1 parent e0ff360 commit ce701c3

File tree

55 files changed

+521
-270
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+521
-270
lines changed

Installers/InstallerProject/Installer.vcxproj

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,18 @@
3434
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
3535
<Import Project="$(QtMsBuild)\qt_defaults.props" Condition="Exists('$(QtMsBuild)\qt_defaults.props')" />
3636
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
37-
<QtInstall>msvc2019_64</QtInstall>
37+
<QtInstall>qt_msvc_musen</QtInstall>
3838
</PropertyGroup>
3939
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
40-
<QtInstall>msvc2019_64</QtInstall>
40+
<QtInstall>qt_msvc_musen</QtInstall>
4141
</PropertyGroup>
4242
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') OR !Exists('$(QtMsBuild)\Qt.props')">
4343
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
4444
</Target>
45-
<ImportGroup Label="ExtensionSettings"></ImportGroup>
46-
<ImportGroup Label="Shared"></ImportGroup>
45+
<ImportGroup Label="ExtensionSettings">
46+
</ImportGroup>
47+
<ImportGroup Label="Shared">
48+
</ImportGroup>
4749
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Release|x64'">
4850
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
4951
<Import Project="$(QtMsBuild)\Qt.props" />
@@ -54,7 +56,8 @@
5456
</PropertyGroup>
5557
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
5658
<Import Project="$(QtMsBuild)\qt.targets" Condition="Exists('$(QtMsBuild)\qt.targets')" />
57-
<ImportGroup Label="ExtensionTargets"></ImportGroup>
59+
<ImportGroup Label="ExtensionTargets">
60+
</ImportGroup>
5861
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Release|x64'">
5962
<CustomBuildStep>
6063
<Command>Script.bat $(SolutionDir) $(SolutionPath) $(QtInstallDir)</Command>

Installers/Scripts/MainFiles.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ Source: "{#SolutionDir}\LICENSE"; DestDir: "{app}\Licenses"; Fla
2222
[Dirs]
2323
Name: "{#DatabasesDirDst}"; Flags: uninsalwaysuninstall
2424
Name: "{app}\Licenses"; Flags: uninsalwaysuninstall
25-
Name: "{app}\styles"; Flags: uninsalwaysuninstall
25+
; Name: "{app}\styles"; Flags: uninsalwaysuninstall

Installers/Scripts/ModelsCreator.iss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ Source: "{#QtPath}\plugins\{#QtPlatformsDir}\{#QtLibsPlatforms[I]}d.dll"; Dest
8787
Source: "{#QtPath}\plugins\{#QtImageformatsDir}\{#QtLibsImageFormats[I]}d.dll"; DestDir: "{#ModelsCreatorDir}\{#DebugExeDir}\{#QtImageformatsDir}"; Flags: ignoreversion
8888
#endsub
8989
#for {I = 0; I < DimOf(QtLibsImageFormats); I++} QtLibsImageFormatsd_entry
90-
#sub QtLibsStylesd_entry
91-
Source: "{#QtPath}\plugins\{#QtStylesDir}\{#QtLibsStyles[I]}d.dll"; DestDir: "{#ModelsCreatorDir}\{#DebugExeDir}\{#QtStylesDir}"; Flags: ignoreversion
92-
#endsub
93-
#for {I = 0; I < DimOf(QtLibsStyles); I++} QtLibsStylesd_entry
90+
; #sub QtLibsStylesd_entry
91+
; Source: "{#QtPath}\plugins\{#QtStylesDir}\{#QtLibsStyles[I]}d.dll"; DestDir: "{#ModelsCreatorDir}\{#DebugExeDir}\{#QtStylesDir}"; Flags: ignoreversion
92+
; #endsub
93+
; #for {I = 0; I < DimOf(QtLibsStyles); I++} QtLibsStylesd_entry
9494

9595
[Dirs]
9696
; Main directory
@@ -117,7 +117,7 @@ Name: "{#ModelsCreatorDir}\PropertySheets"; Flags: uninsalwaysuninstall
117117
Name: "{#ModelsCreatorDir}\{#DebugExeDir}"; Flags: uninsalwaysuninstall
118118
Name: "{#ModelsCreatorDir}\{#DebugExeDir}\{#QtPlatformsDir}"; Flags: uninsalwaysuninstall
119119
Name: "{#ModelsCreatorDir}\{#DebugExeDir}\{#QtImageformatsDir}"; Flags: uninsalwaysuninstall
120-
Name: "{#ModelsCreatorDir}\{#DebugExeDir}\{#QtStylesDir}"; Flags: uninsalwaysuninstall
120+
; Name: "{#ModelsCreatorDir}\{#DebugExeDir}\{#QtStylesDir}"; Flags: uninsalwaysuninstall
121121

122122
[Code]
123123
// Replaces all lines that contain Tag with Value

Installers/Scripts/QtLibs.iss

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,23 @@
44

55
#define QtPlatformsDir "platforms"
66
#define QtImageformatsDir "imageformats"
7-
#define QtStylesDir "styles"
7+
// ; # define QtStylesDir "styles"
88

9-
#dim QtLibs[4]
10-
#define QtLibs[0] "Qt5Core"
11-
#define QtLibs[1] "Qt5Gui"
12-
#define QtLibs[2] "Qt5OpenGL"
13-
#define QtLibs[3] "Qt5Widgets"
9+
#dim QtLibs[5]
10+
#define QtLibs[0] "Qt6Core"
11+
#define QtLibs[1] "Qt6Gui"
12+
#define QtLibs[2] "Qt6OpenGL"
13+
#define QtLibs[3] "Qt6Widgets"
14+
#define QtLibs[4] "Qt6OpenGLWidgets"
1415

1516
#dim QtLibsPlatforms[1]
1617
#define QtLibsPlatforms[0] "qwindows"
1718

1819
#dim QtLibsImageFormats[1]
1920
#define QtLibsImageFormats[0] "qjpeg"
2021

21-
#dim QtLibsStyles[1]
22-
#define QtLibsStyles[0] "qwindowsvistastyle"
22+
// ; #dim QtLibsStyles[1]
23+
// ; #define QtLibsStyles[0] "qwindowsvistastyle"
2324

2425
#define I
2526

@@ -39,12 +40,12 @@ Source: "{#QtPath}\plugins\{#QtImageformatsDir}\{#QtLibsImageFormats[I]}.dll";
3940
#endsub
4041
#for {I = 0; I < DimOf(QtLibsImageFormats); I++} QtLibsImageFormats_entry
4142

42-
#sub QtLibsStyles_entry
43-
Source: "{#QtPath}\plugins\{#QtStylesDir}\{#QtLibsStyles[I]}.dll"; DestDir: "{app}\{#QtStylesDir}"; Flags: ignoreversion
44-
#endsub
45-
#for {I = 0; I < DimOf(QtLibsStyles); I++} QtLibsStyles_entry
43+
; #sub QtLibsStyles_entry
44+
; Source: "{#QtPath}\plugins\{#QtStylesDir}\{#QtLibsStyles[I]}.dll"; DestDir: "{app}\{#QtStylesDir}"; Flags: ignoreversion
45+
; #endsub
46+
; #for {I = 0; I < DimOf(QtLibsStyles); I++} QtLibsStyles_entry
4647

4748
[Dirs]
4849
Name: "{app}\{#QtPlatformsDir}"; Flags: uninsalwaysuninstall
4950
Name: "{app}\{#QtImageformatsDir}"; Flags: uninsalwaysuninstall
50-
Name: "{app}\{#QtStylesDir}"; Flags: uninsalwaysuninstall
51+
; Name: "{app}\{#QtStylesDir}"; Flags: uninsalwaysuninstall

MusenGUI/MusenGUI.vcxproj

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
3434
<Import Project="$(QtMsBuild)\qt_defaults.props" Condition="Exists('$(QtMsBuild)\qt_defaults.props')" />
3535
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
36-
<QtInstall>msvc2019_64</QtInstall>
37-
<QtModules>core;gui;opengl;widgets</QtModules>
36+
<QtInstall>qt_msvc_musen</QtInstall>
37+
<QtModules>core;gui;widgets;opengl;openglwidgets</QtModules>
3838
</PropertyGroup>
3939
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
40-
<QtInstall>msvc2019_64</QtInstall>
41-
<QtModules>core;gui;opengl;widgets</QtModules>
40+
<QtInstall>qt_msvc_musen</QtInstall>
41+
<QtModules>core;gui;widgets;opengl;openglwidgets</QtModules>
4242
</PropertyGroup>
4343
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') OR !Exists('$(QtMsBuild)\Qt.props')">
4444
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
@@ -69,14 +69,16 @@
6969
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
7070
</Link>
7171
<PostBuildEvent>
72-
<Command></Command>
72+
<Command>
73+
</Command>
7374
</PostBuildEvent>
7475
<CudaCompile />
7576
<PreBuildEvent>
7677
<Command>$(SolutionDir)Version\generate_build_version.bat</Command>
7778
</PreBuildEvent>
7879
<QtRcc />
79-
<QtMoc></QtMoc>
80+
<QtMoc>
81+
</QtMoc>
8082
</ItemDefinitionGroup>
8183
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
8284
<ClCompile>
@@ -96,7 +98,8 @@
9698
<Command>$(SolutionDir)Version\generate_build_version.bat</Command>
9799
</PreBuildEvent>
98100
<QtRcc />
99-
<QtMoc></QtMoc>
101+
<QtMoc>
102+
</QtMoc>
100103
</ItemDefinitionGroup>
101104
<ItemGroup>
102105
<ClCompile Include="main.cpp" />
@@ -311,7 +314,8 @@
311314
<Image Include="Resources\MUSEN_Ico.ico" />
312315
</ItemGroup>
313316
<ItemGroup>
314-
<QtRcc Include="musengui.qrc"></QtRcc>
317+
<QtRcc Include="musengui.qrc">
318+
</QtRcc>
315319
</ItemGroup>
316320
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
317321
<Import Project="$(QtMsBuild)\qt.targets" Condition="Exists('$(QtMsBuild)\qt.targets')" />

MusenGUI/main.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,39 @@
44

55
#include "MUSENMainWindow.h"
66
#include "BuildVersion.h"
7-
#include <QtWidgets/QApplication>
7+
#include <QApplication>
8+
#include <QStyleFactory>
89

910
//#define TUHH_DOMAIN_MEMBER
1011

1112
int main(int argc, char *argv[])
1213
{
14+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
1315
#ifdef _WIN32
1416
SetProcessDPIAware(); // deals with some high-DPI issues. maybe
17+
#endif
1518
#endif
1619

1720
srand(time(nullptr));
1821

1922
QApplication app(argc, argv);
2023

24+
#ifdef _MSC_VER
25+
// force Qt6 to look in ./styles folder for style libraries
26+
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() + "/styles");
27+
28+
const QStringList available = QStyleFactory::keys();
29+
if (available.contains("windowsvista", Qt::CaseInsensitive))
30+
QApplication::setStyle("windowsvista");
31+
else if (available.contains("fusion", Qt::CaseInsensitive))
32+
QApplication::setStyle("fusion");
33+
else if (available.contains("windows11", Qt::CaseInsensitive))
34+
QApplication::setStyle("windows11");
35+
#endif
36+
37+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
2138
qRegisterMetaTypeStreamOperators<QList<int>>("QList<int>");
39+
#endif
2240

2341
QSurfaceFormat format;
2442
format.setDepthBufferSize(24);
@@ -35,7 +53,7 @@ int main(int argc, char *argv[])
3553
const QFileInfo styleInfo("." + stylePath);
3654
const QString styleFullPath = styleInfo.exists() && styleInfo.isFile() ? "." + stylePath : QCoreApplication::applicationDirPath() + stylePath;
3755
QFile styleFile(styleFullPath);
38-
styleFile.open(QFile::ReadOnly);
56+
const bool success = styleFile.open(QFile::ReadOnly);
3957
const QString StyleSheet = QLatin1String(styleFile.readAll());
4058
app.setStyleSheet(StyleSheet);
4159

MusenGUI/shaders/vSphereShader.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
See LICENSE file for license and warranty information. */
44

55
attribute vec3 SphereCoordinate;
6-
attribute vec3 SphereRadius;
6+
attribute float SphereRadius;
77
attribute vec3 SphereColor;
88

99
uniform float SphereScale; // scale to calculate size in pixels

QTDialogs/AgglomeratesDatabaseTab/AgglomOpenGLView.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
/* Copyright (c) 2013-2020, MUSEN Development Team. All rights reserved.
2-
This file is part of MUSEN framework http://msolids.net/musen.
3-
See LICENSE file for license and warranty information. */
1+
/* Copyright (c) 2013-2020, MUSEN Development Team.
2+
* Copyright (c) 2025, DyssolTEC GmbH.
3+
* All rights reserved. This file is part of MUSEN framework. See LICENSE file for license and warranty information. */
44

55
#include "AgglomOpenGLView.h"
66

7-
CAgglomOpenGLView::CAgglomOpenGLView( QWidget *parent ) : QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
7+
CAgglomOpenGLView::CAgglomOpenGLView( QWidget *parent ) : QOpenGLWidget(parent)
88
{
9+
QSurfaceFormat fmt;
10+
fmt.setProfile(QSurfaceFormat::CompatibilityProfile);
11+
fmt.setVersion(2, 0);
12+
setFormat(fmt);
13+
914
//camera position :
1015
m_pCameraTranslation[ 0 ] = 0.0f;
1116
m_pCameraTranslation[ 1 ] = 0.0f;
@@ -91,8 +96,9 @@ void CAgglomOpenGLView::SetupViewPort( int _nWidth, int _nHeight )
9196
//// saving new width and height:
9297
m_nWindowWidth = _nWidth;
9398
m_nWindowHeight = _nHeight;
94-
// changing viewport size to much the new size of the window:
95-
glViewport( 0, 0, _nWidth, _nHeight );
99+
// changing viewport size to match the new size of the window:
100+
const auto dpr = devicePixelRatioF();
101+
glViewport(0, 0, static_cast<GLsizei>(_nWidth * dpr), static_cast<GLsizei>(_nHeight * dpr));
96102
// changing the projection matrix to much the new size of the window:
97103
glMatrixMode( GL_PROJECTION );
98104
glLoadIdentity();
@@ -179,7 +185,6 @@ void CAgglomOpenGLView::AutoCentrateView()
179185
m_pCameraRotation[2] = 0;
180186

181187
update();
182-
updateGL(); // black magic to omit shading of first frame
183188
}
184189

185190
void CAgglomOpenGLView::ZoomView( int _nZoomIn )
@@ -196,8 +201,13 @@ void CAgglomOpenGLView::wheelEvent( QWheelEvent * event )
196201

197202
void CAgglomOpenGLView::mouseMoveEvent( QMouseEvent *event )
198203
{
204+
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
205+
float dx = (event->position().x() - m_LastMousePos.x()) / (float)m_nWindowHeight;
206+
float dy = (event->position().y() - m_LastMousePos.y()) / (float)m_nWindowWidth;
207+
#else
199208
float dx = (event->x() - m_LastMousePos.x()) / (float)m_nWindowHeight;
200209
float dy = (event->y() - m_LastMousePos.y()) / (float)m_nWindowWidth;
210+
#endif
201211

202212
if (( event->buttons() & Qt::LeftButton ) && ( event->modifiers() & Qt::ShiftModifier) )
203213
{

QTDialogs/AgglomeratesDatabaseTab/AgglomOpenGLView.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
/* Copyright (c) 2013-2020, MUSEN Development Team. All rights reserved.
2-
This file is part of MUSEN framework http://msolids.net/musen.
3-
See LICENSE file for license and warranty information. */
1+
/* Copyright (c) 2013-2020, MUSEN Development Team.
2+
* Copyright (c) 2025, DyssolTEC GmbH.
3+
* All rights reserved. This file is part of MUSEN framework. See LICENSE file for license and warranty information. */
44

55
#pragma once
6-
#include <QGLWidget>
7-
#include <QWheelEvent>
8-
#include <GL/glu.h>
6+
#include <QOpenGLWidget>
97
#include <QtOpenGL>
10-
#include <QImage>
11-
#include <QPainter>
12-
#include <QGLFunctions>
13-
#include "qtOperations.h"
8+
9+
#ifdef _WIN32
10+
#include <Windows.h>
11+
#include <GL/gl.h>
12+
#endif
13+
#include <GL/glu.h>
14+
1415
#include "AgglomeratesDatabase.h"
1516

16-
class CAgglomOpenGLView : public QGLWidget
17+
class CAgglomOpenGLView : public QOpenGLWidget
1718
{
1819
Q_OBJECT
1920

QTDialogs/AgglomeratesDatabaseTab/AgglomeratesDatabaseTab.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
/* Copyright (c) 2013-2020, MUSEN Development Team. All rights reserved.
2-
This file is part of MUSEN framework http://msolids.net/musen.
3-
See LICENSE file for license and warranty information. */
1+
/* Copyright (c) 2013-2020, MUSEN Development Team.
2+
* Copyright (c) 2025, DyssolTEC GmbH.
3+
* All rights reserved. This file is part of MUSEN framework. See LICENSE file for license and warranty information. */
44

55
#include "AgglomeratesDatabaseTab.h"
66

7+
#include <QFileDialog>
8+
#include <QMessageBox>
9+
710
CAgglomeratesDatabaseTab::CAgglomeratesDatabaseTab(QWidget *parent )
811
: CMusenDialog( parent )
912
{

0 commit comments

Comments
 (0)