Skip to content

Commit

Permalink
deps : Qt5 -> Qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaslepoix committed Mar 6, 2024
1 parent 4f81c41 commit 705c828
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 45 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test-codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ jobs:
run: |
sudo apt update
sudo apt install -y \
qt5-default \
libqt5opengl5-dev
qt6-base-dev \
libqt6opengl6-dev \
libopengl-dev
- name: Checkout
uses: actions/checkout@v3
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test-sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ jobs:
run: |
sudo apt update
sudo apt install -y \
qt5-default \
libqt5opengl5-dev
qt6-base-dev \
libqt6opengl6-dev \
libopengl-dev
# texlive-xetex
# gcovr

Expand Down
18 changes: 10 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ set( CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS

find_package( OpenGL REQUIRED )

find_package( Qt5
find_package( Qt6
COMPONENTS
Core REQUIRED
Widgets REQUIRED
Gui REQUIRED
OpenGL REQUIRED
Core REQUIRED
Gui REQUIRED
OpenGLWidgets REQUIRED
Widgets REQUIRED
)

set( CMAKE_INCLUDE_CURRENT_DIR ON )
Expand Down Expand Up @@ -188,9 +188,11 @@ target_include_directories( ${PROJECT_NAME}
)

target_link_libraries( ${PROJECT_NAME}
Qt5::Core
Qt5::Gui
Qt5::OpenGL
PRIVATE
Qt6::Core
Qt6::Gui
Qt6::OpenGLWidgets
Qt6::Widgets
)

set_target_properties( ${PROJECT_NAME} PROPERTIES
Expand Down
16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,12 @@ This software is a part of the [Open-RFlab](https://github.com/Open-RFlab/Open-R

- [Qucs](https://github.com/Qucs/qucs) is needed (even if you want to convert QucsStudio files), be sure it is installed and accessible from your `PATH` variable.
- OpenEMS scripts dependencies :
- [OpenEMS](https://openems.de/index.php/OpenEMS#Installation) (`octave-openems` package available on Debian 10 based distros, `octave-openEMS` on openSUSE)
- [OpenEMS](https://openems.de/index.php/OpenEMS#Installation) (`octave-openems` package available on Debian based distros, `octave-openEMS` on openSUSE)
- [ImageMagick](https://imagemagick.org/script/download.php) (packages available on most distros)

### Package installation

- For Debian based distributions, a [repository](https://software.opensuse.org/download.html?project=home:thomaslepoix:open-rflab&package=qucsrflayout) is available :

```sh
DEBIAN=Debian_10 # Use the underlying Debian version of your Debian-based distro

echo "deb http://download.opensuse.org/repositories/home:/thomaslepoix:/open-rflab/${DEBIAN}/ /" | sudo tee /etc/apt/sources.list.d/home:thomaslepoix:open-rflab.list
curl -fsSL https://download.opensuse.org/repositories/home:thomaslepoix:open-rflab/${DEBIAN}/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_thomaslepoix_open-rflab.gpg > /dev/null

sudo apt update
sudo apt install qucsrflayout
```
- For Debian based distributions, a repository is available [here](https://software.opensuse.org/download.html?project=home:thomaslepoix:open-rflab&package=qucsrflayout).

- For RPM based distributions and Windows, you can download packages [here](https://github.com/thomaslepoix/Qucs-RFlayout/releases).

Expand All @@ -120,7 +110,7 @@ nix profile install --impure 'github:thomaslepoix/Qucs-RFlayout#qucsrflayoutNixG

The build-time dependencies are the following on Debian, check equivalents on your own (reports are welcome) for non Debian-based distros :

`qt5-default`, `libqt5opengl5-dev`, `texlive-xetex`, `fonts-lato`
`qt6-base-dev`, `libqt6opengl6-dev`, `texlive-xetex`, `fonts-lato`

```sh
Qucs-RFlayout $
Expand Down
4 changes: 0 additions & 4 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ stdenv.mkDerivation {
qtbase
];

cmakeFlags = [
"-DCPM_DISABLE=ON"
];

postBuild = lib.optionals withDoc ''
export XDG_CACHE_HOME=$TMPDIR
make doc
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
'';
};

this-package = pkgs.libsForQt5.callPackage ./default.nix {};
this-package = pkgs.qt6.callPackage ./default.nix {};

in {
packages = rec {
Expand Down
24 changes: 12 additions & 12 deletions src/preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using namespace std;

//******************************************************************************
Preview::Preview(QWidget* parent) : QGLWidget(parent), QOpenGLFunctions_2_0() {
Preview::Preview(QWidget* parent) : QOpenGLWidget(parent), QOpenGLFunctions_2_0() {
}

//******************************************************************************
Expand Down Expand Up @@ -87,7 +87,7 @@ void Preview::setXRotation(int angle) {
qNormalizeAngle(angle);
if (angle != xRot) {
xRot = angle;
updateGL();
update();
}
}

Expand All @@ -96,7 +96,7 @@ void Preview::setYRotation(int angle) {
qNormalizeAngle(angle);
if (angle != yRot) {
yRot = angle;
updateGL();
update();
}
}

Expand All @@ -105,19 +105,19 @@ void Preview::setZRotation(int angle) {
qNormalizeAngle(angle);
if (angle != zRot) {
zRot = angle;
updateGL();
update();
}
}

//******************************************************************************
void Preview::mousePressEvent(QMouseEvent* event) {
lastPos = event->pos();
lastPos = event->position();
}

//******************************************************************************
void Preview::mouseMoveEvent(QMouseEvent* event) {
int dx = event->x() - lastPos.x();
int dy = event->y() - lastPos.y();
int dx = event->position().x() - lastPos.x();
int dy = event->position().y() - lastPos.y();

if (event->buttons() & Qt::LeftButton) {
setXRotation(xRot + 8 * dy);
Expand All @@ -143,14 +143,14 @@ void Preview::mouseMoveEvent(QMouseEvent* event) {
//******************************************************************************
void Preview::wheelEvent(QWheelEvent* event) {
if(flag_ctrl) {
factor+=(long double)event->delta()/240*fit_factor;
factor+=(long double)event->angleDelta().y()/240*fit_factor;
if(factor<0.0) factor=0.0;
} else if(flag_shift) {
x_offset-=(long double)event->delta()/240*fit_x_offset;
x_offset-=(long double)event->angleDelta().y()/240*fit_x_offset;
} else {
y_offset-=(long double)event->delta()/240*fit_y_offset;
y_offset-=(long double)event->angleDelta().y()/240*fit_y_offset;
}
updateGL();
update();
}

//******************************************************************************
Expand All @@ -173,7 +173,7 @@ void Preview::resetView() {
factor=fit_factor;
x_offset=fit_x_offset;
y_offset=fit_y_offset;
updateGL();
update();
}

//******************************************************************************
Expand Down
6 changes: 3 additions & 3 deletions src/preview.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define PREVIEW_HPP

#include <QtWidgets>
#include <QGLWidget>
#include <QOpenGLWidget>
#include <QOpenGLFunctions_2_0>

#include <array>
Expand All @@ -29,7 +29,7 @@
#include "microstrip/element.hpp"

//******************************************************************************
class Preview : public QGLWidget, protected QOpenGLFunctions_2_0 {
class Preview : public QOpenGLWidget, protected QOpenGLFunctions_2_0 {
Q_OBJECT
public :
explicit Preview(QWidget* parent=0);
Expand Down Expand Up @@ -66,7 +66,7 @@ public :
int xRot=0;
int yRot=0;
int zRot=0;
QPoint lastPos;
QPointF lastPos;

std::vector<std::shared_ptr<Element>> tab_all;
long double factor=1;
Expand Down

0 comments on commit 705c828

Please sign in to comment.