Compare commits
3 Commits
qt6_cmake_
...
msys2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
924fe082fb | ||
|
|
ad37b0f9a5 | ||
|
|
fedc1cb092 |
@@ -45,11 +45,12 @@ endif()
|
|||||||
include(cmake/paths_compilation_installation.cmake)
|
include(cmake/paths_compilation_installation.cmake)
|
||||||
include(cmake/start_options.cmake)
|
include(cmake/start_options.cmake)
|
||||||
include(cmake/developer_options.cmake)
|
include(cmake/developer_options.cmake)
|
||||||
include(cmake/git_update_submodules.cmake)
|
#include(cmake/git_update_submodules.cmake)
|
||||||
include(cmake/git_last_commit_sha.cmake)
|
include(cmake/git_last_commit_sha.cmake)
|
||||||
include(cmake/fetch_kdeaddons.cmake)
|
include(cmake/fetch_kdeaddons.cmake)
|
||||||
include(cmake/fetch_singleapplication.cmake)
|
include(cmake/fetch_singleapplication.cmake)
|
||||||
include(cmake/fetch_pugixml.cmake)
|
include(cmake/fetch_pugixml.cmake)
|
||||||
|
include(cmake/fetch_elements.cmake)
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
@@ -57,11 +58,8 @@ set(CMAKE_AUTORCC ON)
|
|||||||
|
|
||||||
set(CMAKE_AUTOUIC_SEARCH_PATHS ${QET_DIR}/sources/ui)
|
set(CMAKE_AUTOUIC_SEARCH_PATHS ${QET_DIR}/sources/ui)
|
||||||
|
|
||||||
# als laatse
|
|
||||||
include(cmake/define_definitions.cmake)
|
include(cmake/define_definitions.cmake)
|
||||||
|
|
||||||
find_package(KF6WidgetsAddons REQUIRED)
|
|
||||||
|
|
||||||
qt_add_executable(
|
qt_add_executable(
|
||||||
${PROJECT_NAME}
|
${PROJECT_NAME}
|
||||||
${QET_RES_FILES}
|
${QET_RES_FILES}
|
||||||
@@ -89,7 +87,6 @@ target_link_libraries(
|
|||||||
SQLite::SQLite3
|
SQLite::SQLite3
|
||||||
${KF6_PRIVATE_LIBRARIES}
|
${KF6_PRIVATE_LIBRARIES}
|
||||||
${QET_PRIVATE_LIBRARIES}
|
${QET_PRIVATE_LIBRARIES}
|
||||||
KF6::WidgetsAddons
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
@@ -121,7 +118,6 @@ target_include_directories(
|
|||||||
${QET_DIR}/sources/NameList
|
${QET_DIR}/sources/NameList
|
||||||
${QET_DIR}/sources/NameList/ui
|
${QET_DIR}/sources/NameList/ui
|
||||||
${QET_DIR}/sources/utils
|
${QET_DIR}/sources/utils
|
||||||
${QET_DIR}/pugixml/src
|
|
||||||
${QET_DIR}/sources/dataBase
|
${QET_DIR}/sources/dataBase
|
||||||
${QET_DIR}/sources/dataBase/ui
|
${QET_DIR}/sources/dataBase/ui
|
||||||
${QET_DIR}/sources/factory/ui
|
${QET_DIR}/sources/factory/ui
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ Here are the technical choices made for the software development:
|
|||||||
|
|
||||||
If you wish to be informed of the latest developments, browse the [archive](https://listengine.tuxfamily.org/lists.tuxfamily.org/qet/) of the project mailing list where all commits (changes) are registered. This archive is publicly available, you don't need any account to access it.
|
If you wish to be informed of the latest developments, browse the [archive](https://listengine.tuxfamily.org/lists.tuxfamily.org/qet/) of the project mailing list where all commits (changes) are registered. This archive is publicly available, you don't need any account to access it.
|
||||||
|
|
||||||
|
### Build QElectroTech under Windows
|
||||||
|
To build QElectroTech under microsoft Windows, please follow [these instructions (french)](md/fr/fr_window_build_summary.md)
|
||||||
|
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2006 The QElectroTech Team
|
# Copyright 2006-2026 The QElectroTech Team
|
||||||
# This file is part of QElectroTech.
|
# This file is part of QElectroTech.
|
||||||
#
|
#
|
||||||
# QElectroTech is free software: you can redistribute it and/or modify
|
# QElectroTech is free software: you can redistribute it and/or modify
|
||||||
@@ -14,25 +14,22 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
# along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
message(STATUS "fetch_kdeaddons")
|
option(BUILD_KF6 "Build KF6 libraries, use system ones otherwise" OFF)
|
||||||
|
if(BUILD_KF6)
|
||||||
if(BUILD_WITH_KF6)
|
|
||||||
option(BUILD_KF6 "Build KF6 libraries, use system ones otherwise" OFF)
|
|
||||||
block(PROPAGATE KF6_GIT_TAG)
|
block(PROPAGATE KF6_GIT_TAG)
|
||||||
set(BUILD_TESTING OFF)
|
message(STATUS " - fetch_kdeaddons")
|
||||||
set(KDE_SKIP_TEST_SETTINGS ON)
|
set(KDE_SKIP_TEST_SETTINGS ON)
|
||||||
set(BUILD_DESIGNERPLUGIN OFF)
|
set(KCOREADDONS_USE_QML OFF)
|
||||||
set(KCOREADDONS_USE_QML OFF)
|
set(KWIDGETSADDONS_USE_QML OFF)
|
||||||
set(BUILD_QCH OFF)
|
set(BUILD_TESTING OFF)
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
set(BUILD_DESIGNERPLUGIN OFF)
|
||||||
find_package(ECM 6.8.0 REQUIRED NO_MODULE)
|
set(BUILD_QCH OFF)
|
||||||
list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
|
|
||||||
if(BUILD_KF6)
|
|
||||||
Include(FetchContent)
|
Include(FetchContent)
|
||||||
|
|
||||||
if(NOT DEFINED KF6_GIT_TAG)
|
if(NOT DEFINED KF6_GIT_TAG)
|
||||||
set(KF6_GIT_TAG v6.8.0)
|
set(KF6_GIT_TAG v6.22.0)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
@@ -40,21 +37,19 @@ if(BUILD_WITH_KF6)
|
|||||||
GIT_REPOSITORY https://invent.kde.org/frameworks/kcoreaddons.git
|
GIT_REPOSITORY https://invent.kde.org/frameworks/kcoreaddons.git
|
||||||
GIT_TAG ${KF6_GIT_TAG})
|
GIT_TAG ${KF6_GIT_TAG})
|
||||||
FetchContent_MakeAvailable(kcoreaddons)
|
FetchContent_MakeAvailable(kcoreaddons)
|
||||||
get_target_property(kca_version KF6::CoreAddons VERSION)
|
|
||||||
|
|
||||||
else()
|
FetchContent_Declare(
|
||||||
find_package(KF6CoreAddons REQUIRED)
|
kwidgetsaddons
|
||||||
set(kca_version ${KF6CoreAddons_VERSION})
|
GIT_REPOSITORY https://invent.kde.org/frameworks/kwidgetsaddons.git
|
||||||
endif()
|
GIT_TAG ${KF6_GIT_TAG})
|
||||||
|
FetchContent_MakeAvailable(kwidgetsaddons)
|
||||||
get_target_property(kwa_type KF6::CoreAddons TYPE)
|
|
||||||
|
|
||||||
message(NOTICE "ecm version : " ${ECM_VERSION})
|
|
||||||
message(NOTICE "kcoreaddons library : " ${kca_type})
|
|
||||||
message(NOTICE "kcoreaddons version : " ${kca_version})
|
|
||||||
endblock()
|
endblock()
|
||||||
|
else()
|
||||||
set(KF6_PRIVATE_LIBRARIES
|
find_package(KF6CoreAddons REQUIRED)
|
||||||
KF6::CoreAddons
|
find_package(KF6WidgetsAddons REQUIRED)
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(KF6_PRIVATE_LIBRARIES
|
||||||
|
KF6::CoreAddons
|
||||||
|
KF6::WidgetsAddons
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2006 The QElectroTech Team
|
# Copyright 2006-2026 The QElectroTech Team
|
||||||
# This file is part of QElectroTech.
|
# This file is part of QElectroTech.
|
||||||
#
|
#
|
||||||
# QElectroTech is free software: you can redistribute it and/or modify
|
# QElectroTech is free software: you can redistribute it and/or modify
|
||||||
@@ -14,14 +14,10 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
# along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
message(" - fetch_pugixml")
|
option(BUILD_PUGIXML "Build pugixml library, use system one otherwise" OFF)
|
||||||
|
|
||||||
Include(FetchContent)
|
|
||||||
|
|
||||||
option(BUILD_PUGIXML "Build pugixml library, use system one otherwise" YES)
|
|
||||||
|
|
||||||
if(BUILD_PUGIXML)
|
if(BUILD_PUGIXML)
|
||||||
|
Include(FetchContent)
|
||||||
|
message(" - fetch pugixml")
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
pugixml
|
pugixml
|
||||||
GIT_REPOSITORY https://github.com/zeux/pugixml.git
|
GIT_REPOSITORY https://github.com/zeux/pugixml.git
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2006 The QElectroTech Team
|
# Copyright 2006-2026 The QElectroTech Team
|
||||||
# This file is part of QElectroTech.
|
# This file is part of QElectroTech.
|
||||||
#
|
#
|
||||||
# QElectroTech is free software: you can redistribute it and/or modify
|
# QElectroTech is free software: you can redistribute it and/or modify
|
||||||
@@ -16,9 +16,6 @@
|
|||||||
|
|
||||||
message(" - fetch_singleapplication")
|
message(" - fetch_singleapplication")
|
||||||
|
|
||||||
# https://github.com/itay-grudev/SingleApplication/issues/18
|
|
||||||
#qmake
|
|
||||||
#DEFINES += QAPPLICATION_CLASS=QGuiApplication
|
|
||||||
set(QAPPLICATION_CLASS QApplication)
|
set(QAPPLICATION_CLASS QApplication)
|
||||||
|
|
||||||
Include(FetchContent)
|
Include(FetchContent)
|
||||||
@@ -26,6 +23,6 @@ Include(FetchContent)
|
|||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
SingleApplication
|
SingleApplication
|
||||||
GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication.git
|
GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication.git
|
||||||
GIT_TAG v3.2.0)
|
GIT_TAG v3.5.4)
|
||||||
|
|
||||||
FetchContent_MakeAvailable(SingleApplication)
|
FetchContent_MakeAvailable(SingleApplication)
|
||||||
|
|||||||
@@ -421,10 +421,6 @@ set(QET_SRC_FILES
|
|||||||
${QET_DIR}/sources/PropertiesEditor/propertieseditorwidget.cpp
|
${QET_DIR}/sources/PropertiesEditor/propertieseditorwidget.cpp
|
||||||
${QET_DIR}/sources/PropertiesEditor/propertieseditorwidget.h
|
${QET_DIR}/sources/PropertiesEditor/propertieseditorwidget.h
|
||||||
|
|
||||||
${QET_DIR}/pugixml/src/pugiconfig.hpp
|
|
||||||
${QET_DIR}/pugixml/src/pugixml.cpp
|
|
||||||
${QET_DIR}/pugixml/src/pugixml.hpp
|
|
||||||
|
|
||||||
${QET_DIR}/sources/qetgraphicsitem/conductor.cpp
|
${QET_DIR}/sources/qetgraphicsitem/conductor.cpp
|
||||||
${QET_DIR}/sources/qetgraphicsitem/conductor.h
|
${QET_DIR}/sources/qetgraphicsitem/conductor.h
|
||||||
${QET_DIR}/sources/qetgraphicsitem/conductortextitem.cpp
|
${QET_DIR}/sources/qetgraphicsitem/conductortextitem.cpp
|
||||||
|
|||||||
BIN
md/fr/assets/windows_msys2_setup/cmake.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
md/fr/assets/windows_msys2_setup/compiler.png
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
md/fr/assets/windows_msys2_setup/custom_install.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
md/fr/assets/windows_msys2_setup/custom_install_tree.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
md/fr/assets/windows_msys2_setup/debugger.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
md/fr/assets/windows_msys2_setup/kit.png
Normal file
|
After Width: | Height: | Size: 76 KiB |
BIN
md/fr/assets/windows_msys2_setup/qt_version.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
101
md/fr/fr_window_build_msys2.md
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
Compiler QElectroTech sous microsoft Windows 10 et 11 avec MSYS2
|
||||||
|
================================
|
||||||
|
Ce document décrit les étapes nécessaire afin de compilé QElectroTech sous Windows avec Qt6 et cmake en utilisant MSYS2.
|
||||||
|
|
||||||
|
# MSYS2
|
||||||
|
L'ensemble des outils nécessaire au développement et à la compilation de QElectroTech sous Windows sera installé par l’intermédiaire de [MSYS2](https://www.msys2.org/). Cela comprend entre autre le framework [Qt6](https://www.qt.io/development/qt-framework/qt6), les outils cmake, les dépendances ([kde framework](https://develop.kde.org/docs/), [sqlite](https://sqlite.org/), [pugixml](https://pugixml.org/)), les outils de compilation [minGW](https://www.mingw-w64.org/)...
|
||||||
|
|
||||||
|
>Il sera nécessaire d'utiliser [winget](https://learn.microsoft.com/fr-fr/windows/package-manager/winget/), celui-ci est présent par défaut sous Windows 11, dans le cas de Windows 10, winget peut necessité d'être activé manuellement
|
||||||
|
|
||||||
|
# Installer GIT et MSYS2 avec winget
|
||||||
|
Avec power shell.
|
||||||
|
```
|
||||||
|
winget install Git.Git
|
||||||
|
```
|
||||||
|
puis
|
||||||
|
```
|
||||||
|
winget install MSYS2.MSYS2
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Mise à jour de MSYS2
|
||||||
|
Lors de la première utilisation de MSYS2 il est nécessaire de mettre celui-ci à jour.
|
||||||
|
|
||||||
|
Lancer "MSYS2 MSYS" depuis le menu démarré de Windows.
|
||||||
|
Une fenêtre avec un shell s'ouvre, dans celui-ci lancer la commande :
|
||||||
|
```
|
||||||
|
pacman -Syu
|
||||||
|
```
|
||||||
|
A la fin de la mise à jour MSYS2 MSYS se fermera automatiquement. Ouvrez le à nouveau et relancé la commande
|
||||||
|
```
|
||||||
|
pacman -Syu
|
||||||
|
```
|
||||||
|
|
||||||
|
## Installation des outils de devellopement
|
||||||
|
Toujours dans le shell MSYS2 MSYS lancer la commande suivante.
|
||||||
|
```
|
||||||
|
pacman -S mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-qt6-svg mingw-w64-ucrt-x86_64-qt6-base mingw-w64-ucrt-x86_64-sqlite3 mingw-w64-ucrt-x86_64-pugixml mingw-w64-ucrt-x86_64-kcoreaddons mingw-w64-ucrt-x86_64-kwidgetsaddons mingw-w64-ucrt-x86_64-extra-cmake-modules mingw-w64-ucrt-x86_64-gdb mingw-w64-ucrt-x86_64-qt6-translations mingw-w64-ucrt-x86_64-qt6-tools
|
||||||
|
```
|
||||||
|
> La quantité de paquets à installer est conséquent, en fonction de votre connexion internet cela peut prendre plusieurs dizaine de minute
|
||||||
|
|
||||||
|
L'ensemble des outils est mantenant installé 😀
|
||||||
|
|
||||||
|
# Installer Qt creator
|
||||||
|
Télécharger [l'installateur online de Qt](https://www.qt.io/development/download-qt-installer-oss) et lancer l'installation en suivant les indications de ce dernier.
|
||||||
|
|
||||||
|
>Dans le cas où vous comptez utilisé Qt Creator uniquement pour développez QElectroTech, lors de l'installation choisissez l'option "installation personnalisée" puis dans la page suivante sélectionné uniquement Qt Creator.
|
||||||
|
|
||||||
|
## Configurer Qt creator
|
||||||
|
Ouvrir Qt creator puis rendez vous dans "édition -> préférence -> kit"
|
||||||
|
|
||||||
|
### Versions de Qt
|
||||||
|
|
||||||
|
- Cliquer sur _ajouter_
|
||||||
|
- Renseigner _Chemin de qmake_ (exemple C:\\msys64\\ucrt64\\bin\\qmake.exe).
|
||||||
|
- Dans le champ _Nom :_ ajouter (msys2).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Compilateurs
|
||||||
|
- Cliquer sur _ajouter_ puis choisir _MinGW_.
|
||||||
|
- Renseigner _Emplacement du compilateur C_ (exemple C:\\msys64\\ucrt64\\bin\\g++.exe).
|
||||||
|
- Dans le champ _Nom :_ ajouter (msys2).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Débogueurs
|
||||||
|
- Cliquer sur _ajouter_
|
||||||
|
- Renseigner _Chemin :_ (exemple C:\\msys64\\ucrt64\\bin\\gdb.exe).
|
||||||
|
- Dans le champ _Nom :_ ajouter (msys2).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### cmake
|
||||||
|
- Outils -> _Ajouter_
|
||||||
|
- Renseigner _Chemin :_ (exemple C:\\msys64\\ucrt64\\bin\\cmake.exe).
|
||||||
|
- Dans le champ _Nom :_ ajouter (msys2).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### KIT
|
||||||
|
Maintenant que tous les prérequis sont fait nous allons crée un kit utilisant les outils fournis par MSYS2. Cliquer sur _Ajouter_, un nouveau kit _manuel_ apparaît, nommer celui-ci par exemple _Qt6 msys2_ puis renseigner le compilateur, le débogueur, la version de Qt et Outils CMake en choisissant à chaque fois ceux que nous venons de créer.
|
||||||
|
puis cliquer sur _appliquer_.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Bravo 🥳🥳 vous avez terminé l'installation de la totalité des outils de développement.
|
||||||
|
|
||||||
|
# Clonez le dépôts de QElectrotech
|
||||||
|
Clonez le dépôt de QElectroTech comme vous le faite habituellement, sinon utilisez les commandes suivante dans power shell.
|
||||||
|
|
||||||
|
Crée et/ou se rendre dans le dossier dans lequel vous voulez clonez le dépôt (dans l'exemple nous allons crée un dossier QElectroTech dans C:)
|
||||||
|
|
||||||
|
```
|
||||||
|
mkdir C:\QElectroTech
|
||||||
|
cd C:\QElectroTech
|
||||||
|
|
||||||
|
git clone --recursive https://github.com/qelectrotech/qelectrotech-source-mirror.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Une fois le dépôt cloné lancer Qt creator puis choisir d'ouvrir un projet existant, en choisissant le _CMakeLists.txt_ se trouvant à la racine du projet QElectroTech, enfin dans l'assistant de création de projet choisir comme kit le kit que nous avons créer précédemment.
|
||||||
13
md/fr/fr_window_build_summary.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
Compiler QElectroTech sous microsoft Windows 10 et 11
|
||||||
|
================================
|
||||||
|
Compiler QElectroTech pour et/ou sous Windows peut être effectué avec plusieurs méthode différente.
|
||||||
|
Ce document énumère uniquement les différentes méthode possible
|
||||||
|
|
||||||
|
N'est mentionné que les étapes nécessaire afin de compilé QElectroTech sous Windows avec Qt6 et cmake. Ce document ne traite pas la compilation avec Qt5 et qmake.
|
||||||
|
|
||||||
|
>QElectroTech 0.100 est la dernière version à utiliser Qt5. Les version suivante sont développé avec Qt6 et utilise cmake au lieu de qmake.
|
||||||
|
|
||||||
|
Il existe deux méthodes pour cela :
|
||||||
|
|
||||||
|
1. [Utiliser msys2 (méthode recommandé)](fr_window_build_msys2.md)
|
||||||
|
2. Télécharger et compiler l'ensemble des dépendances (non rédigé)
|
||||||
1
pugixml
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "../NameList/nameslist.h"
|
#include "../NameList/nameslist.h"
|
||||||
#include "../diagramcontext.h"
|
#include "../diagramcontext.h"
|
||||||
#include "pugixml/src/pugixml.hpp"
|
#include "pugixml.hpp"
|
||||||
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef NAMES_LIST_H
|
#ifndef NAMES_LIST_H
|
||||||
#define NAMES_LIST_H
|
#define NAMES_LIST_H
|
||||||
#include "pugixml/src/pugixml.hpp"
|
#include "pugixml.hpp"
|
||||||
|
|
||||||
#include <QtXml>
|
#include <QtXml>
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef DIAGRAM_CONTEXT_H
|
#ifndef DIAGRAM_CONTEXT_H
|
||||||
#define DIAGRAM_CONTEXT_H
|
#define DIAGRAM_CONTEXT_H
|
||||||
#include "pugixml/src/pugixml.hpp"
|
#include "pugixml.hpp"
|
||||||
|
|
||||||
#include <QDomElement>
|
#include <QDomElement>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|||||||
@@ -190,25 +190,28 @@ ProjectPrintWindow::~ProjectPrintWindow()
|
|||||||
*/
|
*/
|
||||||
void ProjectPrintWindow::requestPaint()
|
void ProjectPrintWindow::requestPaint()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#ifdef QT_DEBUG
|
auto screen = this->screen();
|
||||||
qDebug() << "--";
|
if(screen)
|
||||||
qDebug() << "DiagramPrintDialog::print printer_->resolution() before " << m_printer->resolution();
|
{
|
||||||
qDebug() << "DiagramPrintDialog::print screennumber " << QApplication::desktop()->screenNumber();
|
#ifdef QT_DEBUG
|
||||||
#endif
|
qDebug() << "--";
|
||||||
|
qDebug() << "DiagramPrintDialog::print printer_->resolution() before " << m_printer->resolution();
|
||||||
|
qDebug() << "DiagramPrintDialog::print screennumber " << screen->name();
|
||||||
|
#endif
|
||||||
|
|
||||||
QScreen *srn = QApplication::screens().at(QApplication::desktop()->screenNumber());
|
qreal dotsPerInch = (qreal)screen->logicalDotsPerInch();
|
||||||
qreal dotsPerInch = (qreal)srn->logicalDotsPerInch();
|
m_printer->setResolution(dotsPerInch);
|
||||||
m_printer->setResolution(dotsPerInch);
|
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
qDebug() << "DiagramPrintDialog::print dotsPerInch " << dotsPerInch;
|
qDebug() << "DiagramPrintDialog::print dotsPerInch " << dotsPerInch;
|
||||||
qDebug() << "DiagramPrintDialog::print printer_->resolution() after" << m_printer->resolution();
|
qDebug() << "DiagramPrintDialog::print printer_->resolution() after" << m_printer->resolution();
|
||||||
qDebug() << "--";
|
qDebug() << "--";
|
||||||
#endif
|
#endif
|
||||||
#endif
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!m_project->diagrams().count()) {
|
if (!m_project->diagrams().count()) {
|
||||||
return;
|
return;
|
||||||
@@ -265,9 +268,9 @@ void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter
|
|||||||
#if TODO_LIST
|
#if TODO_LIST
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
#pragma message("@TODO remove code for QT 6 or later")
|
||||||
#endif
|
#endif
|
||||||
qDebug()<<"Help code for QT 6 or later";
|
qDebug()<<"Help code for QT 6 or later";
|
||||||
auto printed_rect = full_page ? printer->paperRect(QPrinter::Millimeter) :
|
auto printed_rect = full_page ? printer->paperRect(QPrinter::Millimeter) :
|
||||||
printer->pageRect(QPrinter::Millimeter);
|
printer->pageRect(QPrinter::Millimeter);
|
||||||
#endif
|
#endif
|
||||||
auto used_width = printed_rect.width();
|
auto used_width = printed_rect.width();
|
||||||
auto used_height = printed_rect.height();
|
auto used_height = printed_rect.height();
|
||||||
@@ -341,7 +344,7 @@ QRect ProjectPrintWindow::diagramRect(Diagram *diagram, const ExportProperties &
|
|||||||
diagram_rect.setHeight(diagram_rect.height() - titleblock_height);
|
diagram_rect.setHeight(diagram_rect.height() - titleblock_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Adjust the border of diagram to 1px (width of the line)
|
//Adjust the border of diagram to 1px (width of the line)
|
||||||
diagram_rect.adjust(0,0,1,1);
|
diagram_rect.adjust(0,0,1,1);
|
||||||
|
|
||||||
return (diagram_rect.toAlignedRect());
|
return (diagram_rect.toAlignedRect());
|
||||||
@@ -356,7 +359,7 @@ QRect ProjectPrintWindow::diagramRect(Diagram *diagram, const ExportProperties &
|
|||||||
* with the orientation and the paper format used by the actual printer
|
* with the orientation and the paper format used by the actual printer
|
||||||
*/
|
*/
|
||||||
int ProjectPrintWindow::horizontalPagesCount(
|
int ProjectPrintWindow::horizontalPagesCount(
|
||||||
Diagram *diagram, const ExportProperties &option, bool full_page) const
|
Diagram *diagram, const ExportProperties &option, bool full_page) const
|
||||||
{
|
{
|
||||||
QRect printable_area;
|
QRect printable_area;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
||||||
@@ -385,7 +388,7 @@ int ProjectPrintWindow::horizontalPagesCount(
|
|||||||
* with the orientation and paper format used by the actual printer
|
* with the orientation and paper format used by the actual printer
|
||||||
*/
|
*/
|
||||||
int ProjectPrintWindow::verticalPagesCount(
|
int ProjectPrintWindow::verticalPagesCount(
|
||||||
Diagram *diagram, const ExportProperties &option, bool full_page) const
|
Diagram *diagram, const ExportProperties &option, bool full_page) const
|
||||||
{
|
{
|
||||||
QRect printable_area;
|
QRect printable_area;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
||||||
@@ -511,7 +514,7 @@ void ProjectPrintWindow::loadPageSetupForCurrentPrinter()
|
|||||||
QString value = settings.value("orientation", "landscape").toString();
|
QString value = settings.value("orientation", "landscape").toString();
|
||||||
m_printer->setPageOrientation(
|
m_printer->setPageOrientation(
|
||||||
value == "landscape" ? QPageLayout::Landscape :
|
value == "landscape" ? QPageLayout::Landscape :
|
||||||
QPageLayout::Portrait);
|
QPageLayout::Portrait);
|
||||||
}
|
}
|
||||||
if (settings.contains("papersize"))
|
if (settings.contains("papersize"))
|
||||||
{
|
{
|
||||||
@@ -780,9 +783,9 @@ void ProjectPrintWindow::print()
|
|||||||
void ProjectPrintWindow::on_m_date_cb_userDateChanged(const QDate &date)
|
void ProjectPrintWindow::on_m_date_cb_userDateChanged(const QDate &date)
|
||||||
{
|
{
|
||||||
auto index = ui->m_date_from_cb->currentIndex();
|
auto index = ui->m_date_from_cb->currentIndex();
|
||||||
// 0 = all date
|
// 0 = all date
|
||||||
// 1 = from the date
|
// 1 = from the date
|
||||||
// 2 = at the date
|
// 2 = at the date
|
||||||
|
|
||||||
if (index) { on_m_uncheck_all_clicked(); }
|
if (index) { on_m_uncheck_all_clicked(); }
|
||||||
else { on_m_check_all_pb_clicked(); }
|
else { on_m_check_all_pb_clicked(); }
|
||||||
@@ -792,7 +795,7 @@ void ProjectPrintWindow::on_m_date_cb_userDateChanged(const QDate &date)
|
|||||||
{
|
{
|
||||||
auto diagram_date = diagram->border_and_titleblock.date();
|
auto diagram_date = diagram->border_and_titleblock.date();
|
||||||
if ( (index == 1 && diagram_date >= date) ||
|
if ( (index == 1 && diagram_date >= date) ||
|
||||||
(index == 2 && diagram_date == date) )
|
(index == 2 && diagram_date == date) )
|
||||||
m_diagram_list_hash.value(diagram)->setChecked(true);
|
m_diagram_list_hash.value(diagram)->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||