Skip to content

Commit 25a512d

Browse files
committed
Port to Qt6
1 parent f480db8 commit 25a512d

11 files changed

+44
-42
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- name: Install Qt
6969
uses: jurplel/install-qt-action@v4
7070
with:
71-
version: 5.15.*
71+
version: 6.8.*
7272

7373
- name: Make vcpkg only build release builds
7474
run: |

CMakeLists.txt

+8-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ project(PoMiDAQ
88
VERSION 0.5.3
99
)
1010

11-
set(CMAKE_CXX_STANDARD 17)
11+
set(CMAKE_CXX_STANDARD 20)
1212
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1313
enable_testing()
1414

@@ -67,20 +67,21 @@ endif()
6767
#
6868
include(GNUInstallDirs)
6969
find_package(Threads)
70-
find_package(Qt5Core 5.12 REQUIRED)
71-
find_package(Qt5Concurrent 5.12 REQUIRED)
70+
find_package(Qt6Core 6.4 REQUIRED)
71+
find_package(Qt6Concurrent 6.4 REQUIRED)
7272
if (GUI)
73-
find_package(Qt5Widgets 5.12 REQUIRED)
74-
find_package(Qt5Svg 5.12 REQUIRED)
73+
find_package(Qt6Widgets 6.4 REQUIRED)
74+
find_package(Qt6OpenGLWidgets 6.4 REQUIRED)
75+
find_package(Qt6Svg 6.4 REQUIRED)
7576
endif()
7677

7778
find_package(OpenCV 4.2 REQUIRED)
7879
find_package(OpenGL REQUIRED)
7980
find_package(FFmpeg 58.35 REQUIRED COMPONENTS avcodec avutil avformat swscale)
8081

8182
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
82-
find_package(KF5ConfigWidgets)
83-
set(KF5_ConfigWidgets KF5::ConfigWidgets)
83+
find_package(KF6ConfigWidgets)
84+
set(KF6_ConfigWidgets KF6::ConfigWidgets)
8485
endif()
8586

8687

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ If you want to cite PoMiDAQ, please use its Zenodo DOI:
7272
### Dependencies
7373

7474
* CMake (>= 3.16)
75-
* Qt5 (>= 5.12)
75+
* Qt6 (>= 6.4)
7676
* FFmpeg (>= 4.1)
7777
* OpenCV (>= 4.1)
7878
* KF5ConfigWidgets (on Linux)
@@ -83,8 +83,8 @@ You should then be able to build the software after configuring the build with c
8383

8484
On Debian-based Linux systems, all dependencies can be installed from the package repositories with this command:
8585
```bash
86-
sudo apt install build-essential cmake ninja-build qtbase5-dev libqt5opengl5-dev \
87-
libkf5configwidgets-dev libopencv-dev libavcodec-dev libavformat-dev libswscale-dev \
86+
sudo apt install build-essential cmake ninja-build qt6-base-dev qt6-svg-dev \
87+
libkf6configwidgets-dev libopencv-dev libavcodec-dev libavformat-dev libswscale-dev \
8888
pybind11-dev python3-dev python3-numpy
8989
```
9090
The software can then be built like this, for an optimized release build with debug infos included:

contrib/ci/Dockerfile-debian

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# Docker file for PoMiDAQ CI
33
#
4-
FROM debian:bookworm
4+
FROM debian:trixie
55

66
# prepare
77
RUN apt-get update -qq
@@ -22,10 +22,9 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata apt-get install -yq --no-install-re
2222
cmake \
2323
ninja-build \
2424
appstream \
25-
qtbase5-dev \
26-
libqt5svg5-dev \
27-
libqt5opengl5-dev \
28-
libkf5configwidgets-dev \
25+
qt6-base-dev \
26+
qt6-svg-dev \
27+
libkf6configwidgets-dev \
2928
libopencv-dev \
3029
libavcodec-dev \
3130
libavformat-dev \

contrib/ci/Dockerfile-ubuntu

+6-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ FROM ubuntu:noble
55

66
# prepare
77
RUN apt-get update -qq
8-
RUN apt-get install -yq eatmydata
8+
RUN apt-get install -yq --no-install-recommends eatmydata software-properties-common
9+
RUN add-apt-repository -y ppa:ximion/syntalos
10+
RUN apt-get update -qq
911

1012
# install build essentials
1113
RUN DEBIAN_FRONTEND=noninteractive eatmydata apt-get install -yq \
@@ -22,10 +24,9 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata apt-get install -yq --no-install-re
2224
cmake \
2325
ninja-build \
2426
appstream \
25-
qtbase5-dev \
26-
libqt5svg5-dev \
27-
libqt5opengl5-dev \
28-
libkf5configwidgets-dev \
27+
qt6-base-dev \
28+
qt6-svg-dev \
29+
libkf6configwidgets-dev \
2930
libopencv-dev \
3031
libavcodec-dev \
3132
libavformat-dev \

contrib/debian/control

+5-6
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@ Source: pomidaq
22
Section: science
33
Priority: optional
44
Maintainer: Matthias Klumpp <[email protected]>
5-
Build-Depends: appstream,
5+
Build-Depends: debhelper-compat (= 13),
6+
appstream,
67
cmake,
7-
debhelper-compat (= 13),
88
libavcodec-dev,
99
libavformat-dev,
10-
libkf5configwidgets-dev,
10+
libkf6configwidgets-dev,
1111
libopencv-dev,
12-
libqt5opengl5-dev,
13-
libqt5svg5-dev,
1412
libswscale-dev,
1513
ninja-build,
1614
pybind11-dev,
1715
python3-dev,
1816
python3-numpy,
19-
qtbase5-dev
17+
qt6-base-dev,
18+
qt6-svg-dev
2019
Standards-Version: 4.6.2
2120

2221
Package: pomidaq

libminiscope/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ set(LIBMINISCOPE_HEADERS
1919
mediatypes.h
2020
)
2121

22-
qt5_add_resources(LIBMINISCOPE_RES_SRC mscopelr.qrc)
22+
qt6_add_resources(LIBMINISCOPE_RES_SRC mscopelr.qrc)
2323

2424
add_library(miniscope
2525
${LIBMINISCOPE_SRC}
@@ -42,8 +42,8 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/miniscope.pc DESTINATION "${CMAKE_INST
4242

4343
target_link_libraries(miniscope
4444
${CMAKE_THREAD_LIBS_INIT}
45-
Qt5::Core
46-
Qt5::Concurrent
45+
Qt6::Core
46+
Qt6::Concurrent
4747
${OpenCV_LIBS}
4848
${OPENGL_LIBRARIES}
4949
${FFMPEG_LIBRARIES}

py/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# CMakeLists for PoMiDAQ Python module
22

3+
set(PYBIND11_FINDPYTHON ON)
34
find_package(pybind11 REQUIRED)
45
find_package(NumPy REQUIRED)
56

src/CMakeLists.txt

+6-5
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ set(POMIDAQ_UI
2222
mainwindow.ui
2323
)
2424

25-
qt5_wrap_ui(POMIDAQ_UI_SRC ${POMIDAQ_UI})
25+
qt6_wrap_ui(POMIDAQ_UI_SRC ${POMIDAQ_UI})
2626

27-
qt5_add_resources(POMIDAQ_RES_SRC ../data/resources.qrc)
27+
qt6_add_resources(POMIDAQ_RES_SRC ../data/resources.qrc)
2828

2929
add_executable(pomidaq
3030
${GUI_TYPE}
@@ -35,9 +35,10 @@ add_executable(pomidaq
3535

3636
target_link_libraries(pomidaq
3737
${CMAKE_DL_LIBS}
38-
Qt5::Widgets
39-
Qt5::Svg
40-
${KF5_ConfigWidgets}
38+
Qt6::Widgets
39+
Qt6::OpenGLWidgets
40+
Qt6::Svg
41+
${KF6_ConfigWidgets}
4142
${OpenCV_LIBS}
4243
${OPENGL_LIBRARIES}
4344
miniscope

src/mainwindow.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ MainWindow::MainWindow(QWidget *parent)
214214

215215
// Miniscope controls
216216
m_controlsLayout = new QVBoxLayout(ui->gbDeviceCtls);
217-
m_controlsLayout->setMargin(2);
217+
m_controlsLayout->setContentsMargins(2, 2, 2, 2);
218218
m_controlsLayout->setSpacing(4);
219219
ui->gbDeviceCtls->setLayout(m_controlsLayout);
220220
m_controlsLayout->addStretch();
@@ -381,7 +381,7 @@ void MainWindow::queueLogMessage(const QString &msg)
381381
{
382382
QMetaObject::invokeMethod(
383383
this,
384-
[=]() {
384+
[this, msg]() {
385385
writeLogMessage(msg);
386386
},
387387
Qt::QueuedConnection);
@@ -429,7 +429,7 @@ void MainWindow::setUseUnixTimestamps(bool useUnixTimestamp)
429429
void MainWindow::on_deviceTypeComboBox_currentIndexChanged(const QString &arg1)
430430
{
431431
// clear previous controls
432-
for (const auto &control : qAsConst(m_controls))
432+
for (const auto &control : std::as_const(m_controls))
433433
delete control;
434434
m_controls.clear();
435435

@@ -546,7 +546,7 @@ void MainWindow::on_btnDevConnect_clicked()
546546
m_mscope->setUseUnixTimestamps(m_useUnixTimestamps);
547547

548548
// reflect currently active control values in the UI
549-
for (const auto &w : qAsConst(m_controls))
549+
for (const auto &w : std::as_const(m_controls))
550550
w->setValue(m_mscope->controlValue(w->controlId()));
551551

552552
// run and display images

src/mscontrolwidget.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ MSControlWidget::MSControlWidget(const MScope::ControlDefinition &ctlDef, QWidge
3232
m_controlId = ctlDef.id;
3333

3434
const auto layout = new QVBoxLayout(this);
35-
layout->setMargin(2);
35+
layout->setContentsMargins(2, 2, 2, 2);
3636
layout->setSpacing(2);
3737

3838
auto lblTitle = new QLabel(this);
@@ -44,7 +44,7 @@ MSControlWidget::MSControlWidget(const MScope::ControlDefinition &ctlDef, QWidge
4444
const auto selLayout = new QGridLayout(sc);
4545
const auto valuesCount = ctlDef.labels.length();
4646
m_slider = new QSlider(Qt::Horizontal, sc);
47-
selLayout->setMargin(0);
47+
selLayout->setContentsMargins(0, 0, 0, 0);
4848
selLayout->setSpacing(2);
4949

5050
m_slider->setRange(ctlDef.valueMin, ctlDef.valueMax);
@@ -68,7 +68,7 @@ MSControlWidget::MSControlWidget(const MScope::ControlDefinition &ctlDef, QWidge
6868
} else {
6969
const auto slw = new QWidget(this);
7070
auto slLayout = new QHBoxLayout(slw);
71-
slLayout->setMargin(0);
71+
slLayout->setContentsMargins(0, 0, 0, 0);
7272
slLayout->setSpacing(2);
7373

7474
m_slider = new QSlider(Qt::Horizontal, slw);

0 commit comments

Comments
 (0)