Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f16cf7dac8 | |||
| 471d1f2538 | |||
| dc52105868 | |||
| 1b8dc5f410 | |||
| 26d5d019cc | |||
| 6dd7c2d926 | |||
| 47796e183a | |||
| ddf5ffcd89 | |||
| 7d718bb9a0 | |||
| d949e6eb8c | |||
| dbda958261 | |||
| d691489165 | |||
| 202ea38e40 | |||
| 86dafcb576 | |||
| f416c2a97e | |||
| 2d4f968348 | |||
| 6f669e1074 | |||
| 0b91318749 | |||
| 1ba97c7e92 | |||
| cd09fc0d32 | |||
| 924fe082fb | |||
| ad37b0f9a5 | |||
| fedc1cb092 | |||
| 5f318e09c8 | |||
| 27afeaefe2 | |||
| ab2f933fdf | |||
| 7f718f672f | |||
| 9ec02bc088 |
@@ -14,12 +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/>.
|
||||||
|
|
||||||
include(cmake/hoto_update_cmake_message.cmake)
|
cmake_minimum_required(VERSION 3.5...4.2)
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.14...3.19 FATAL_ERROR)
|
|
||||||
|
|
||||||
project(qelectrotech
|
project(qelectrotech
|
||||||
VERSION 0.100.1
|
VERSION 0.100.0
|
||||||
DESCRIPTION "QET is a CAD/CAE editor focusing on schematics drawing features."
|
DESCRIPTION "QET is a CAD/CAE editor focusing on schematics drawing features."
|
||||||
HOMEPAGE_URL "https://qelectrotech.org/"
|
HOMEPAGE_URL "https://qelectrotech.org/"
|
||||||
LANGUAGES CXX)
|
LANGUAGES CXX)
|
||||||
@@ -27,9 +25,16 @@ project(qelectrotech
|
|||||||
include(cmake/copyright_message.cmake)
|
include(cmake/copyright_message.cmake)
|
||||||
|
|
||||||
set(QET_DIR ${PROJECT_SOURCE_DIR})
|
set(QET_DIR ${PROJECT_SOURCE_DIR})
|
||||||
|
include(cmake/qet_compilation_vars.cmake)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
find_package(Qt6 REQUIRED COMPONENTS ${QET_COMPONENTS})
|
||||||
|
qt_standard_project_setup()
|
||||||
|
|
||||||
# Add sub directories
|
# Add sub directories
|
||||||
option(PACKAGE_TESTS "Build the tests" ON)
|
option(PACKAGE_TESTS "Build the tests" NO)
|
||||||
if(PACKAGE_TESTS)
|
if(PACKAGE_TESTS)
|
||||||
message("Add sub directory tests")
|
message("Add sub directory tests")
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
@@ -43,63 +48,33 @@ 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/qet_compilation_vars.cmake)
|
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
set(CMAKE_AUTOMOC ON)
|
|
||||||
set(CMAKE_AUTORCC ON)
|
set(CMAKE_AUTORCC ON)
|
||||||
set(CMAKE_AUTOUIC ON)
|
|
||||||
SET(CMAKE_CXX_STANDARD 17)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
find_package(
|
|
||||||
QT
|
|
||||||
NAMES
|
|
||||||
Qt5
|
|
||||||
COMPONENTS
|
|
||||||
${QET_COMPONENTS}
|
|
||||||
REQUIRED
|
|
||||||
)
|
|
||||||
|
|
||||||
find_package(
|
|
||||||
Qt${QT_VERSION_MAJOR}
|
|
||||||
COMPONENTS
|
|
||||||
${QET_COMPONENTS}
|
|
||||||
REQUIRED)
|
|
||||||
|
|
||||||
find_package(SQLite3 REQUIRED)
|
|
||||||
|
|
||||||
set(CMAKE_AUTOUIC_SEARCH_PATHS ${QET_DIR}/sources/ui)
|
set(CMAKE_AUTOUIC_SEARCH_PATHS ${QET_DIR}/sources/ui)
|
||||||
|
|
||||||
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
|
||||||
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${QET_DIR}/lang")
|
|
||||||
qt5_add_translation(QM_FILES ${TS_FILES})
|
|
||||||
|
|
||||||
# als laatse
|
|
||||||
include(cmake/define_definitions.cmake)
|
include(cmake/define_definitions.cmake)
|
||||||
|
|
||||||
# On Windows, WIN32 sets /SUBSYSTEM:WINDOWS to suppress the console window.
|
qt_add_executable(
|
||||||
# Qt automatically links qtmain.lib which provides the WinMain entry point,
|
|
||||||
# so no source code change is needed.
|
|
||||||
if(WIN32)
|
|
||||||
add_executable(
|
|
||||||
${PROJECT_NAME}
|
${PROJECT_NAME}
|
||||||
WIN32
|
|
||||||
${QET_RES_FILES}
|
${QET_RES_FILES}
|
||||||
${QET_SRC_FILES}
|
${QET_SRC_FILES}
|
||||||
${QM_FILES}
|
${QM_FILES}
|
||||||
${QET_DIR}/qelectrotech.qrc
|
${QET_DIR}/qelectrotech.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(QMFILES_AS_RESOURCE)
|
||||||
|
qt_add_translations(${PROJECT_NAME} TS_FILES ${TS_FILES} RESOURCE_PREFIX "/lang")
|
||||||
else()
|
else()
|
||||||
add_executable(
|
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
||||||
${PROJECT_NAME}
|
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${QET_DIR}/lang")
|
||||||
${QET_RES_FILES}
|
qt_add_translation(QM_FILES ${TS_FILES})
|
||||||
${QET_SRC_FILES}
|
|
||||||
${QM_FILES}
|
|
||||||
${QET_DIR}/qelectrotech.qrc
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
find_package(SQLite3 REQUIRED)
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
${PROJECT_NAME}
|
${PROJECT_NAME}
|
||||||
PUBLIC
|
PUBLIC
|
||||||
@@ -107,7 +82,7 @@ target_link_libraries(
|
|||||||
pugixml::pugixml
|
pugixml::pugixml
|
||||||
SingleApplication::SingleApplication
|
SingleApplication::SingleApplication
|
||||||
SQLite::SQLite3
|
SQLite::SQLite3
|
||||||
${KF5_PRIVATE_LIBRARIES}
|
${KF6_PRIVATE_LIBRARIES}
|
||||||
${QET_PRIVATE_LIBRARIES}
|
${QET_PRIVATE_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -140,16 +115,16 @@ 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
|
||||||
${QET_DIR}/sources/print
|
${QET_DIR}/sources/print
|
||||||
|
${QET_DIR}/sources/svg
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS ${PROJECT_NAME})
|
install(TARGETS ${PROJECT_NAME})
|
||||||
|
|
||||||
if (NOT MINGW)
|
if (NOT MINGW)
|
||||||
|
|
||||||
install(DIRECTORY ico/breeze-icons/16x16 DESTINATION ${QET_ICONS_PATH})
|
install(DIRECTORY ico/breeze-icons/16x16 DESTINATION ${QET_ICONS_PATH})
|
||||||
install(DIRECTORY ico/breeze-icons/22x22 DESTINATION ${QET_ICONS_PATH})
|
install(DIRECTORY ico/breeze-icons/22x22 DESTINATION ${QET_ICONS_PATH})
|
||||||
install(DIRECTORY ico/breeze-icons/32x32 DESTINATION ${QET_ICONS_PATH})
|
install(DIRECTORY ico/breeze-icons/32x32 DESTINATION ${QET_ICONS_PATH})
|
||||||
@@ -164,5 +139,7 @@ if (NOT MINGW)
|
|||||||
install(FILES misc/org.qelectrotech.qelectrotech.desktop DESTINATION share/applications)
|
install(FILES misc/org.qelectrotech.qelectrotech.desktop DESTINATION share/applications)
|
||||||
install(FILES misc/qelectrotech.xml DESTINATION share/mime/packages)
|
install(FILES misc/qelectrotech.xml DESTINATION share/mime/packages)
|
||||||
install(FILES misc/qelectrotech.appdata.xml DESTINATION ${QET_APPDATA_PATH})
|
install(FILES misc/qelectrotech.appdata.xml DESTINATION ${QET_APPDATA_PATH})
|
||||||
|
if(NOT QMFILES_AS_RESOURCE)
|
||||||
install(FILES ${QM_FILES} DESTINATION ${QET_LANG_PATH})
|
install(FILES ${QM_FILES} DESTINATION ${QET_LANG_PATH})
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -62,10 +62,15 @@ message("PROJECT_SOURCE_DIR :" ${PROJECT_SOURCE_DIR})
|
|||||||
message("QET_DIR :" ${QET_DIR})
|
message("QET_DIR :" ${QET_DIR})
|
||||||
message("GIT_COMMIT_SHA :" ${GIT_COMMIT_SHA})
|
message("GIT_COMMIT_SHA :" ${GIT_COMMIT_SHA})
|
||||||
|
|
||||||
if(BUILD_WITH_KF5)
|
if(BUILD_WITH_KF6 AND BUILD_KF6)
|
||||||
message("KF5_GIT_TAG :" ${KF5_GIT_TAG})
|
message("KF6_GIT_TAG :" ${KF6_GIT_TAG})
|
||||||
else()
|
endif()
|
||||||
add_definitions(-DBUILD_WITHOUT_KF5)
|
if(NOT BUILD_WITH_KF6)
|
||||||
|
add_definitions(-DBUILD_WITHOUT_KF6)
|
||||||
endif()
|
endif()
|
||||||
message("QET_COMPONENTS :" ${QET_COMPONENTS})
|
message("QET_COMPONENTS :" ${QET_COMPONENTS})
|
||||||
message("QT_VERSION_MAJOR :" ${QT_VERSION_MAJOR})
|
message("Qt version :" ${Qt6_VERSION})
|
||||||
|
|
||||||
|
if(QMFILES_AS_RESOURCE)
|
||||||
|
add_definitions(-DQMFILES_AS_RESOURCE)
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -31,5 +31,8 @@ add_definitions(-DQT_MESSAGELOGCONTEXT)
|
|||||||
# In order to do so, uncomment the following line.
|
# In order to do so, uncomment the following line.
|
||||||
#add_definitions(-DTODO_LIST)
|
#add_definitions(-DTODO_LIST)
|
||||||
|
|
||||||
# Build with KF5
|
# Build with KF6
|
||||||
option(BUILD_WITH_KF5 "Build with KF5" ON)
|
option(BUILD_WITH_KF6 "Build with KF6" ON)
|
||||||
|
|
||||||
|
# Use translations as a Qt resource
|
||||||
|
option(QMFILES_AS_RESOURCE "Use .qm files as Qt resource" ON)
|
||||||
|
|||||||
@@ -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,54 +14,42 @@
|
|||||||
# 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_kdeaddons")
|
option(BUILD_KF6 "Build KF6 libraries, use system ones otherwise" OFF)
|
||||||
|
if(BUILD_KF6)
|
||||||
|
block(PROPAGATE KF6_GIT_TAG)
|
||||||
|
message(STATUS " - fetch_kdeaddons")
|
||||||
|
set(KDE_SKIP_TEST_SETTINGS ON)
|
||||||
|
set(KCOREADDONS_USE_QML OFF)
|
||||||
|
set(KWIDGETSADDONS_USE_QML OFF)
|
||||||
|
set(BUILD_TESTING OFF)
|
||||||
|
set(BUILD_DESIGNERPLUGIN OFF)
|
||||||
|
set(BUILD_QCH OFF)
|
||||||
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
|
|
||||||
if(DEFINED BUILD_WITH_KF5)
|
|
||||||
Include(FetchContent)
|
Include(FetchContent)
|
||||||
|
|
||||||
option(BUILD_KF5 "Build KF5 libraries, use system ones otherwise" YES)
|
if(NOT DEFINED KF6_GIT_TAG)
|
||||||
|
set(KF6_GIT_TAG v6.22.0)
|
||||||
if(BUILD_KF5)
|
|
||||||
|
|
||||||
if(NOT DEFINED KF5_GIT_TAG)
|
|
||||||
#https://qelectrotech.org/forum/viewtopic.php?pid=13924#p13924
|
|
||||||
set(KF5_GIT_TAG v5.77.0)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Fix stop the run autotests of kcoreaddons
|
|
||||||
# see
|
|
||||||
# https://invent.kde.org/frameworks/kcoreaddons/-/blob/master/CMakeLists.txt#L98
|
|
||||||
# issue:
|
|
||||||
# CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:89 (add_executable):
|
|
||||||
# Cannot find source file:
|
|
||||||
# see
|
|
||||||
# https://qelectrotech.org/forum/viewtopic.php?pid=13929#p13929
|
|
||||||
set(KDE_SKIP_TEST_SETTINGS "TRUE")
|
|
||||||
set(BUILD_TESTING "0")
|
|
||||||
FetchContent_Declare(
|
|
||||||
ecm
|
|
||||||
GIT_REPOSITORY https://invent.kde.org/frameworks/extra-cmake-modules.git
|
|
||||||
GIT_TAG ${KF5_GIT_TAG})
|
|
||||||
FetchContent_MakeAvailable(ecm)
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
kcoreaddons
|
kcoreaddons
|
||||||
GIT_REPOSITORY https://invent.kde.org/frameworks/kcoreaddons.git
|
GIT_REPOSITORY https://invent.kde.org/frameworks/kcoreaddons.git
|
||||||
GIT_TAG ${KF5_GIT_TAG})
|
GIT_TAG ${KF6_GIT_TAG})
|
||||||
FetchContent_MakeAvailable(kcoreaddons)
|
FetchContent_MakeAvailable(kcoreaddons)
|
||||||
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
kwidgetsaddons
|
kwidgetsaddons
|
||||||
GIT_REPOSITORY https://invent.kde.org/frameworks/kwidgetsaddons.git
|
GIT_REPOSITORY https://invent.kde.org/frameworks/kwidgetsaddons.git
|
||||||
GIT_TAG ${KF5_GIT_TAG})
|
GIT_TAG ${KF6_GIT_TAG})
|
||||||
FetchContent_MakeAvailable(kwidgetsaddons)
|
FetchContent_MakeAvailable(kwidgetsaddons)
|
||||||
|
endblock()
|
||||||
else()
|
else()
|
||||||
find_package(KF5CoreAddons REQUIRED)
|
find_package(KF6CoreAddons REQUIRED)
|
||||||
find_package(KF5WidgetsAddons REQUIRED)
|
find_package(KF6WidgetsAddons REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(KF5_PRIVATE_LIBRARIES
|
set(KF6_PRIVATE_LIBRARIES
|
||||||
KF5::WidgetsAddons
|
KF6::CoreAddons
|
||||||
KF5::CoreAddons
|
KF6::WidgetsAddons
|
||||||
)
|
)
|
||||||
endif()
|
|
||||||
|
|||||||
@@ -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,18 +14,14 @@
|
|||||||
# 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
|
||||||
GIT_TAG v1.11.4)
|
GIT_TAG v1.15)
|
||||||
|
|
||||||
FetchContent_MakeAvailable(pugixml)
|
FetchContent_MakeAvailable(pugixml)
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
# Copyright 2006 The QElectroTech Team
|
|
||||||
# This file is part of QElectroTech.
|
|
||||||
#
|
|
||||||
# QElectroTech is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# QElectroTech is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
if(${CMAKE_VERSION} VERSION_LESS 3.14)
|
|
||||||
message(
|
|
||||||
"_____________________________________________________________________")
|
|
||||||
message("to update Cmake on linux:")
|
|
||||||
message("https://github.com/Kitware/CMake/")
|
|
||||||
message("linux => cmake-3.19.1-Linux-x86_64.sh")
|
|
||||||
message(" sudo ./cmake.sh --prefix=/usr/local/ --exclude-subdir")
|
|
||||||
message("windows good luck :)")
|
|
||||||
endif()
|
|
||||||
@@ -17,6 +17,8 @@
|
|||||||
message(" - qet_compilation_vars")
|
message(" - qet_compilation_vars")
|
||||||
|
|
||||||
set(QET_COMPONENTS
|
set(QET_COMPONENTS
|
||||||
|
Core
|
||||||
|
Gui
|
||||||
LinguistTools
|
LinguistTools
|
||||||
PrintSupport
|
PrintSupport
|
||||||
Xml
|
Xml
|
||||||
@@ -110,6 +112,12 @@ set(QET_SRC_FILES
|
|||||||
${QET_DIR}/sources/borderproperties.h
|
${QET_DIR}/sources/borderproperties.h
|
||||||
${QET_DIR}/sources/bordertitleblock.cpp
|
${QET_DIR}/sources/bordertitleblock.cpp
|
||||||
${QET_DIR}/sources/bordertitleblock.h
|
${QET_DIR}/sources/bordertitleblock.h
|
||||||
|
# ${QET_DIR}/sources/colorbutton.cpp
|
||||||
|
# ${QET_DIR}/sources/colorbutton.h
|
||||||
|
# ${QET_DIR}/sources/colorcombobox.cpp
|
||||||
|
# ${QET_DIR}/sources/colorcombobox.h
|
||||||
|
# ${QET_DIR}/sources/colorcomboboxdelegate.cpp
|
||||||
|
# ${QET_DIR}/sources/colorcomboboxdelegate.h
|
||||||
${QET_DIR}/sources/conductorautonumerotation.cpp
|
${QET_DIR}/sources/conductorautonumerotation.cpp
|
||||||
${QET_DIR}/sources/conductorautonumerotation.h
|
${QET_DIR}/sources/conductorautonumerotation.h
|
||||||
${QET_DIR}/sources/conductornumexport.cpp
|
${QET_DIR}/sources/conductornumexport.cpp
|
||||||
@@ -418,10 +426,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
|
||||||
@@ -500,6 +504,9 @@ set(QET_SRC_FILES
|
|||||||
${QET_DIR}/sources/SearchAndReplace/ui/searchandreplacewidget.cpp
|
${QET_DIR}/sources/SearchAndReplace/ui/searchandreplacewidget.cpp
|
||||||
${QET_DIR}/sources/SearchAndReplace/ui/searchandreplacewidget.h
|
${QET_DIR}/sources/SearchAndReplace/ui/searchandreplacewidget.h
|
||||||
|
|
||||||
|
${QET_DIR}/sources/svg/qetsvg.cpp
|
||||||
|
${QET_DIR}/sources/svg/qetsvg.h
|
||||||
|
|
||||||
${QET_DIR}/sources/titleblock/dimension.cpp
|
${QET_DIR}/sources/titleblock/dimension.cpp
|
||||||
${QET_DIR}/sources/titleblock/dimension.h
|
${QET_DIR}/sources/titleblock/dimension.h
|
||||||
${QET_DIR}/sources/titleblock/dimensionwidget.cpp
|
${QET_DIR}/sources/titleblock/dimensionwidget.cpp
|
||||||
@@ -713,6 +720,8 @@ set(QET_SRC_FILES
|
|||||||
|
|
||||||
${QET_DIR}/sources/xml/terminalstripitemxml.cpp
|
${QET_DIR}/sources/xml/terminalstripitemxml.cpp
|
||||||
${QET_DIR}/sources/xml/terminalstripitemxml.h
|
${QET_DIR}/sources/xml/terminalstripitemxml.h
|
||||||
|
${QET_DIR}/sources/xml/terminalstriplayoutpatternxml.cpp
|
||||||
|
${QET_DIR}/sources/xml/terminalstriplayoutpatternxml.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(TS_FILES
|
set(TS_FILES
|
||||||
@@ -739,13 +748,11 @@ set(TS_FILES
|
|||||||
${QET_DIR}/lang/qet_pt.ts
|
${QET_DIR}/lang/qet_pt.ts
|
||||||
${QET_DIR}/lang/qet_pt_BR.ts
|
${QET_DIR}/lang/qet_pt_BR.ts
|
||||||
${QET_DIR}/lang/qet_ro.ts
|
${QET_DIR}/lang/qet_ro.ts
|
||||||
${QET_DIR}/lang/qet_rs.ts
|
|
||||||
${QET_DIR}/lang/qet_ru.ts
|
${QET_DIR}/lang/qet_ru.ts
|
||||||
${QET_DIR}/lang/qet_sk.ts
|
${QET_DIR}/lang/qet_sk.ts
|
||||||
${QET_DIR}/lang/qet_sl.ts
|
${QET_DIR}/lang/qet_sl.ts
|
||||||
${QET_DIR}/lang/qet_sr.ts
|
${QET_DIR}/lang/qet_sr.ts
|
||||||
${QET_DIR}/lang/qet_sv.ts
|
${QET_DIR}/lang/qet_sv.ts
|
||||||
${QET_DIR}/lang/qet_tr.ts
|
${QET_DIR}/lang/qet_tr.ts
|
||||||
${QET_DIR}/lang/qet_uk.ts
|
|
||||||
${QET_DIR}/lang/qet_zh.ts
|
${QET_DIR}/lang/qet_zh.ts
|
||||||
)
|
)
|
||||||
|
|||||||
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 49 KiB |
@@ -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.
|
||||||
@@ -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é)
|
||||||
@@ -26,12 +26,7 @@
|
|||||||
#include "xmlprojectelementcollectionitem.h"
|
#include "xmlprojectelementcollectionitem.h"
|
||||||
|
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
|
||||||
#include <QtConcurrentMap>
|
#include <QtConcurrentMap>
|
||||||
#else
|
|
||||||
#include <QtConcurrentRun>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief ElementsCollectionModel::ElementsCollectionModel
|
@brief ElementsCollectionModel::ElementsCollectionModel
|
||||||
Constructor
|
Constructor
|
||||||
@@ -295,13 +290,13 @@ void ElementsCollectionModel::loadCollections(bool common_collection,
|
|||||||
this, &ElementsCollectionModel::loadingProgressRangeChanged);
|
this, &ElementsCollectionModel::loadingProgressRangeChanged);
|
||||||
connect(watcher, &QFutureWatcher<void>::finished,
|
connect(watcher, &QFutureWatcher<void>::finished,
|
||||||
this, &ElementsCollectionModel::loadingFinished);
|
this, &ElementsCollectionModel::loadingFinished);
|
||||||
connect(watcher, &QFutureWatcher<void>::finished, watcher, &QFutureWatcher<void>::deleteLater);
|
connect(
|
||||||
|
watcher,
|
||||||
|
&QFutureWatcher<void>::finished,
|
||||||
|
watcher,
|
||||||
|
&QFutureWatcher<void>::deleteLater);
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
m_future = QtConcurrent::map(m_items_list_to_setUp, setUpData);
|
m_future = QtConcurrent::map(m_items_list_to_setUp, setUpData);
|
||||||
#else
|
|
||||||
qDebug() << "Help code for QT 6 or later";
|
|
||||||
#endif
|
|
||||||
watcher->setFuture(m_future);
|
watcher->setFuture(m_future);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -835,14 +835,8 @@ void ElementsCollectionWidget::search()
|
|||||||
}
|
}
|
||||||
|
|
||||||
hideCollection(true);
|
hideCollection(true);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
|
||||||
const QStringList text_list = text.split("+", QString::SkipEmptyParts);
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
|
||||||
#endif
|
|
||||||
const QStringList text_list = text.split("+", Qt::SkipEmptyParts);
|
const QStringList text_list = text.split("+", Qt::SkipEmptyParts);
|
||||||
#endif
|
|
||||||
QModelIndexList match_index;
|
QModelIndexList match_index;
|
||||||
for (QString txt : text_list) {
|
for (QString txt : text_list) {
|
||||||
match_index << m_model->match(m_showed_index.isValid()
|
match_index << m_model->match(m_showed_index.isValid()
|
||||||
|
|||||||
@@ -803,13 +803,13 @@ bool ElementsLocation::setXml(const QDomDocument &xml_document) const
|
|||||||
QString path_ = collectionPath(false);
|
QString path_ = collectionPath(false);
|
||||||
QRegularExpression rx("^(.*)/(.*\\.elmt)$");
|
QRegularExpression rx("^(.*)/(.*\\.elmt)$");
|
||||||
|
|
||||||
if (rx.exactMatch(path_))
|
if (auto regex_match = rx.match(path_); regex_match.hasMatch())
|
||||||
{
|
{
|
||||||
return project()
|
return project()
|
||||||
->embeddedElementCollection()
|
->embeddedElementCollection()
|
||||||
->addElementDefinition(
|
->addElementDefinition(
|
||||||
rx.cap(1),
|
regex_match.captured(1),
|
||||||
rx.cap(2),
|
regex_match.captured(2),
|
||||||
xml_document.documentElement());
|
xml_document.documentElement());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -87,11 +87,7 @@ void ElementsTreeView::startElementDrag(const ElementsLocation &location)
|
|||||||
{
|
{
|
||||||
if (! location.exist()) return;
|
if (! location.exist()) return;
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 0)
|
auto drag = new QDrag{this};
|
||||||
QDrag* drag = new QDrag(this);
|
|
||||||
#else
|
|
||||||
QScopedPointer<QDrag> drag(new QDrag(this));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QString location_str = location.toString();
|
QString location_str = location.toString();
|
||||||
QMimeData *mime_data = new QMimeData();
|
QMimeData *mime_data = new QMimeData();
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ void FileElementCollectionItem::setUpIcon()
|
|||||||
setIcon(QET::Icons::Folder);
|
setIcon(QET::Icons::Folder);
|
||||||
} else {
|
} else {
|
||||||
if (m_path.endsWith(".qetmak")) {
|
if (m_path.endsWith(".qetmak")) {
|
||||||
setIcon(QIcon());
|
setIcon(QET::Icons::PartRectangle);
|
||||||
} else {
|
} else {
|
||||||
ElementsLocation loc(collectionPath());
|
ElementsLocation loc(collectionPath());
|
||||||
setIcon(loc.icon());
|
setIcon(loc.icon());
|
||||||
|
|||||||
@@ -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>
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "terminalstripdrawer.h"
|
#include "terminalstripdrawer.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
namespace TerminalStripDrawer {
|
namespace TerminalStripDrawer {
|
||||||
|
|
||||||
|
|||||||
@@ -130,12 +130,7 @@ bool PhysicalTerminal::setLevelOf(const QSharedPointer<RealTerminal> &terminal,
|
|||||||
const int i = m_real_terminal.indexOf(terminal);
|
const int i = m_real_terminal.indexOf(terminal);
|
||||||
if (i >= 0)
|
if (i >= 0)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
|
m_real_terminal.swapItemsAt(i, std::min(static_cast<qsizetype>(level), m_real_terminal.size()-1));
|
||||||
m_real_terminal.swapItemsAt(i, std::min(level, m_real_terminal.size()-1));
|
|
||||||
#else
|
|
||||||
auto j = std::min(level, m_real_terminal.size()-1);
|
|
||||||
std::swap(m_real_terminal.begin()[i], m_real_terminal.begin()[j]);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -64,11 +64,8 @@ bool TerminalStripData::fromXml(const QDomElement &xml_element)
|
|||||||
"due to wrong tag name. Expected " << this->xmlTagName() << " used " << xml_element.tagName();
|
"due to wrong tag name. Expected " << this->xmlTagName() << " used " << xml_element.tagName();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
m_uuid = QUuid::fromString(xml_element.attribute(QStringLiteral("uuid")));
|
m_uuid = QUuid::fromString(xml_element.attribute(QStringLiteral("uuid")));
|
||||||
#else
|
|
||||||
m_uuid = QUuid(xml_element.attribute(QStringLiteral("uuid")));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (auto &xml_info :
|
for (auto &xml_info :
|
||||||
QETXML::findInDomElement(xml_element.firstChildElement(QStringLiteral("informations")),
|
QETXML::findInDomElement(xml_element.firstChildElement(QStringLiteral("informations")),
|
||||||
|
|||||||
@@ -35,11 +35,7 @@ TerminalStripTreeDockWidget::TerminalStripTreeDockWidget(QETProject *project, QW
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setProject(project);
|
setProject(project);
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
|
||||||
ui->m_tree_view->expandRecursively(ui->m_tree_view->rootIndex());
|
ui->m_tree_view->expandRecursively(ui->m_tree_view->rootIndex());
|
||||||
#else
|
|
||||||
ui->m_tree_view->expandAll();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TerminalStripTreeDockWidget::~TerminalStripTreeDockWidget()
|
TerminalStripTreeDockWidget::~TerminalStripTreeDockWidget()
|
||||||
@@ -93,11 +89,7 @@ void TerminalStripTreeDockWidget::reload()
|
|||||||
|
|
||||||
buildTree();
|
buildTree();
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
|
||||||
ui->m_tree_view->expandRecursively(ui->m_tree_view->rootIndex());
|
ui->m_tree_view->expandRecursively(ui->m_tree_view->rootIndex());
|
||||||
#else
|
|
||||||
ui->m_tree_view->expandAll();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Reselect the tree widget item of the current edited strip
|
//Reselect the tree widget item of the current edited strip
|
||||||
auto item = m_item_strip_H.key(current_);
|
auto item = m_item_strip_H.key(current_);
|
||||||
|
|||||||
@@ -55,11 +55,7 @@ BorderTitleBlock::BorderTitleBlock(QObject *parent) :
|
|||||||
m_titleblock_template_renderer = new TitleBlockTemplateRenderer(this);
|
m_titleblock_template_renderer = new TitleBlockTemplateRenderer(this);
|
||||||
m_titleblock_template_renderer -> setTitleBlockTemplate(QETApp::defaultTitleBlockTemplate());
|
m_titleblock_template_renderer -> setTitleBlockTemplate(QETApp::defaultTitleBlockTemplate());
|
||||||
|
|
||||||
// disable the QPicture-based cache from Qt 4.8 to avoid rendering errors and crashes
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(4, 8, 0) // ### Qt 6: remove
|
|
||||||
#else
|
|
||||||
m_titleblock_template_renderer -> setUseCache(false);
|
m_titleblock_template_renderer -> setUseCache(false);
|
||||||
#endif
|
|
||||||
|
|
||||||
// dimensions par defaut du schema
|
// dimensions par defaut du schema
|
||||||
importBorder(BorderProperties());
|
importBorder(BorderProperties());
|
||||||
|
|||||||
@@ -72,14 +72,7 @@ bool ConductorNumExport::toCsv()
|
|||||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
|
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
QTextStream stream(&file);
|
QTextStream stream(&file);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
|
||||||
stream << wiresNum() << endl;
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.15 or later")
|
|
||||||
#endif
|
|
||||||
stream << wiresNum() << &Qt::endl(stream);
|
stream << wiresNum() << &Qt::endl(stream);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -811,14 +811,7 @@ void ConductorProperties::readStyle(const QString &style_string) {
|
|||||||
if (style_string.isEmpty()) return;
|
if (style_string.isEmpty()) return;
|
||||||
|
|
||||||
// recupere la liste des couples style / valeur
|
// recupere la liste des couples style / valeur
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
|
||||||
QStringList styles = style_string.split(";", QString::SkipEmptyParts);
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code QString::SkipEmptyParts for QT 5.14 or later")
|
|
||||||
#endif
|
|
||||||
QStringList styles = style_string.split(";", Qt::SkipEmptyParts);
|
QStringList styles = style_string.split(";", Qt::SkipEmptyParts);
|
||||||
#endif
|
|
||||||
|
|
||||||
QRegularExpression Rx("^(?<name>[a-z-]+): (?<value>[a-z-]+)$");
|
QRegularExpression Rx("^(?<name>[a-z-]+): (?<value>[a-z-]+)$");
|
||||||
if (!Rx.isValid())
|
if (!Rx.isValid())
|
||||||
|
|||||||
@@ -47,14 +47,8 @@ ElementQueryWidget::ElementQueryWidget(QWidget *parent) :
|
|||||||
m_button_group.addButton(ui->m_coil_cb, 4);
|
m_button_group.addButton(ui->m_coil_cb, 4);
|
||||||
m_button_group.addButton(ui->m_protection_cb, 5);
|
m_button_group.addButton(ui->m_protection_cb, 5);
|
||||||
m_button_group.addButton(ui->m_thumbnail_cb, 6);
|
m_button_group.addButton(ui->m_thumbnail_cb, 6);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
|
||||||
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), [this](int id)
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.15 or later")
|
|
||||||
#endif
|
|
||||||
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::idClicked), [this](int id)
|
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::idClicked), [this](int id)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
auto check_box = static_cast<QCheckBox *>(m_button_group.button(0));
|
auto check_box = static_cast<QCheckBox *>(m_button_group.button(0));
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
|
|||||||
@@ -1514,14 +1514,6 @@ bool Diagram::fromXml(QDomElement &document,
|
|||||||
if (content_ptr) {
|
if (content_ptr) {
|
||||||
content_ptr -> m_elements = added_elements;
|
content_ptr -> m_elements = added_elements;
|
||||||
content_ptr -> m_conductors_to_move = added_conductors;
|
content_ptr -> m_conductors_to_move = added_conductors;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
|
||||||
content_ptr -> m_text_fields = added_texts.toSet();
|
|
||||||
content_ptr -> m_images = added_images.toSet();
|
|
||||||
content_ptr -> m_shapes = added_shapes.toSet();
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
|
||||||
#endif
|
|
||||||
content_ptr -> m_text_fields = QSet<IndependentTextItem *>(
|
content_ptr -> m_text_fields = QSet<IndependentTextItem *>(
|
||||||
added_texts.begin(),
|
added_texts.begin(),
|
||||||
added_texts.end());
|
added_texts.end());
|
||||||
@@ -1532,7 +1524,6 @@ bool Diagram::fromXml(QDomElement &document,
|
|||||||
added_shapes.begin(),
|
added_shapes.begin(),
|
||||||
added_shapes.end());
|
added_shapes.end());
|
||||||
content_ptr->m_terminal_strip.swap(added_strips);
|
content_ptr->m_terminal_strip.swap(added_strips);
|
||||||
#endif
|
|
||||||
content_ptr->m_tables.swap(added_tables);
|
content_ptr->m_tables.swap(added_tables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -210,17 +210,10 @@ void DiagramView::handleElementDrop(QDropEvent *event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointF drop_pos;
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
|
||||||
drop_pos = mapToScene(event->pos());
|
|
||||||
#else
|
|
||||||
drop_pos = event->position();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (location.path().endsWith(".qetmak")) {
|
if (location.path().endsWith(".qetmak")) {
|
||||||
diagram()->setEventInterface(new DiagramEventAddMacro(location, diagram(), drop_pos));
|
diagram()->setEventInterface(new DiagramEventAddMacro(location, diagram(), event->position()));
|
||||||
} else {
|
} else {
|
||||||
diagram()->setEventInterface(new DiagramEventAddElement(location, diagram(), drop_pos));
|
diagram()->setEventInterface(new DiagramEventAddElement(location, diagram(), event->position()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set focus to the view to get event
|
//Set focus to the view to get event
|
||||||
@@ -290,17 +283,8 @@ void DiagramView::handleTextDrop(QDropEvent *e) {
|
|||||||
iti -> setHtml (e -> mimeData() -> text());
|
iti -> setHtml (e -> mimeData() -> text());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
|
||||||
|
|
||||||
m_diagram->undoStack().push(new AddGraphicsObjectCommand(
|
|
||||||
iti, m_diagram, mapToScene(e->pos())));
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
#endif
|
|
||||||
m_diagram->undoStack().push(new AddGraphicsObjectCommand(
|
m_diagram->undoStack().push(new AddGraphicsObjectCommand(
|
||||||
iti, m_diagram, e->position()));
|
iti, m_diagram, e->position()));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -458,14 +442,7 @@ void DiagramView::mousePressEvent(QMouseEvent *e)
|
|||||||
if (m_event_interface && m_event_interface->mousePressEvent(e)) return;
|
if (m_event_interface && m_event_interface->mousePressEvent(e)) return;
|
||||||
|
|
||||||
//Start drag view when hold the middle button
|
//Start drag view when hold the middle button
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
|
||||||
if (e->button() == Qt::MidButton)
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
#endif
|
|
||||||
if (e->button() == Qt::MiddleButton)
|
if (e->button() == Qt::MiddleButton)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
m_drag_last_pos = e->pos();
|
m_drag_last_pos = e->pos();
|
||||||
viewport()->setCursor(Qt::ClosedHandCursor);
|
viewport()->setCursor(Qt::ClosedHandCursor);
|
||||||
@@ -515,14 +492,7 @@ void DiagramView::mouseMoveEvent(QMouseEvent *e)
|
|||||||
if (m_event_interface && m_event_interface->mouseMoveEvent(e)) return;
|
if (m_event_interface && m_event_interface->mouseMoveEvent(e)) return;
|
||||||
|
|
||||||
// Drag the view
|
// Drag the view
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
|
||||||
if (e->buttons() == Qt::MidButton)
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
#endif
|
|
||||||
if (e->buttons() == Qt::MiddleButton)
|
if (e->buttons() == Qt::MiddleButton)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QScrollBar *h = horizontalScrollBar();
|
QScrollBar *h = horizontalScrollBar();
|
||||||
QScrollBar *v = verticalScrollBar();
|
QScrollBar *v = verticalScrollBar();
|
||||||
@@ -583,14 +553,7 @@ void DiagramView::mouseReleaseEvent(QMouseEvent *e)
|
|||||||
if (m_event_interface && m_event_interface->mouseReleaseEvent(e)) return;
|
if (m_event_interface && m_event_interface->mouseReleaseEvent(e)) return;
|
||||||
|
|
||||||
// Stop drag view
|
// Stop drag view
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
|
||||||
if (e->button() == Qt::MidButton)
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
#endif
|
|
||||||
if (e->button() == Qt::MiddleButton)
|
if (e->button() == Qt::MiddleButton)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
viewport()->setCursor(Qt::ArrowCursor);
|
viewport()->setCursor(Qt::ArrowCursor);
|
||||||
}
|
}
|
||||||
@@ -624,14 +587,7 @@ void DiagramView::mouseReleaseEvent(QMouseEvent *e)
|
|||||||
QMenu *menu = new QMenu(this);
|
QMenu *menu = new QMenu(this);
|
||||||
menu->addAction(act);
|
menu->addAction(act);
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
|
||||||
menu->popup(e->globalPos());
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
#endif
|
|
||||||
menu->popup(e->pos());
|
menu->popup(e->pos());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_free_rubberbanding = false;
|
m_free_rubberbanding = false;
|
||||||
@@ -1355,7 +1311,6 @@ void DiagramView::createTemplateFromSelection()
|
|||||||
QFile file(full_path);
|
QFile file(full_path);
|
||||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
QTextStream out(&file);
|
QTextStream out(&file);
|
||||||
out.setCodec("UTF-8");
|
|
||||||
out << macro_doc.toString(4);
|
out << macro_doc.toString(4);
|
||||||
file.close();
|
file.close();
|
||||||
qDebug() << "Template successfully saved to:" << full_path;
|
qDebug() << "Template successfully saved to:" << full_path;
|
||||||
|
|||||||
@@ -276,14 +276,7 @@ void ChangeZValueCommand::applyRaise(const QList<QGraphicsItem *> &items_list) {
|
|||||||
for (int i = my_items_list.count() - 2 ; i >= 0 ; -- i) {
|
for (int i = my_items_list.count() - 2 ; i >= 0 ; -- i) {
|
||||||
if (my_items_list[i] -> isSelected()) {
|
if (my_items_list[i] -> isSelected()) {
|
||||||
if (!my_items_list[i +1] -> isSelected()) {
|
if (!my_items_list[i +1] -> isSelected()) {
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) // ### Qt 6: remove
|
|
||||||
my_items_list.swap(i, i + 1);
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.13 or later")
|
|
||||||
#endif
|
|
||||||
my_items_list.swapItemsAt(i, i + 1);
|
my_items_list.swapItemsAt(i, i + 1);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,14 +294,7 @@ void ChangeZValueCommand::applyLower(const QList<QGraphicsItem *> &items_list) {
|
|||||||
for (int i = 1 ; i < my_items_list.count() ; ++ i) {
|
for (int i = 1 ; i < my_items_list.count() ; ++ i) {
|
||||||
if (my_items_list[i] -> isSelected()) {
|
if (my_items_list[i] -> isSelected()) {
|
||||||
if (!my_items_list[i - 1] -> isSelected()) {
|
if (!my_items_list[i - 1] -> isSelected()) {
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) // ### Qt 6: remove
|
|
||||||
my_items_list.swap(i, i - 1);
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.13 or later")
|
|
||||||
#endif
|
|
||||||
my_items_list.swapItemsAt(i, i - 1);
|
my_items_list.swapItemsAt(i, i - 1);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,14 +372,7 @@ ElementContent ElementView::pasteWithOffset(const QDomDocument &xml_document) {
|
|||||||
*/
|
*/
|
||||||
void ElementView::mousePressEvent(QMouseEvent* e)
|
void ElementView::mousePressEvent(QMouseEvent* e)
|
||||||
{
|
{
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
|
||||||
if (e->button() == Qt::MidButton)
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
#endif
|
|
||||||
if (e->button() == Qt::MiddleButton)
|
if (e->button() == Qt::MiddleButton)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
setCursor( (Qt::ClosedHandCursor));
|
setCursor( (Qt::ClosedHandCursor));
|
||||||
reference_view_ = e->pos();
|
reference_view_ = e->pos();
|
||||||
@@ -394,14 +387,7 @@ void ElementView::mousePressEvent(QMouseEvent* e)
|
|||||||
*/
|
*/
|
||||||
void ElementView::mouseMoveEvent(QMouseEvent* e)
|
void ElementView::mouseMoveEvent(QMouseEvent* e)
|
||||||
{
|
{
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
|
||||||
if (e->buttons() == Qt::MidButton)
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
#endif
|
|
||||||
if (e->buttons() == Qt::MiddleButton)
|
if (e->buttons() == Qt::MiddleButton)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QScrollBar *h = horizontalScrollBar();
|
QScrollBar *h = horizontalScrollBar();
|
||||||
QScrollBar *v = verticalScrollBar();
|
QScrollBar *v = verticalScrollBar();
|
||||||
@@ -420,14 +406,7 @@ void ElementView::mouseMoveEvent(QMouseEvent* e)
|
|||||||
*/
|
*/
|
||||||
void ElementView::mouseReleaseEvent(QMouseEvent* e)
|
void ElementView::mouseReleaseEvent(QMouseEvent* e)
|
||||||
{
|
{
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
|
||||||
if (e->button() == Qt::MidButton)
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
#endif
|
|
||||||
if (e->button() == Qt::MiddleButton)
|
if (e->button() == Qt::MiddleButton)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
adjustSceneRect();
|
adjustSceneRect();
|
||||||
|
|||||||
@@ -519,14 +519,7 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
|
|||||||
resetStyles();
|
resetStyles();
|
||||||
|
|
||||||
//Get the list of pair style/value
|
//Get the list of pair style/value
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
|
||||||
QStringList styles = qde.attribute("style").split(";", QString::SkipEmptyParts);
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
|
||||||
#endif
|
|
||||||
QStringList styles = qde.attribute("style").split(";", Qt::SkipEmptyParts);
|
QStringList styles = qde.attribute("style").split(";", Qt::SkipEmptyParts);
|
||||||
#endif
|
|
||||||
|
|
||||||
//Check each pair of style
|
//Check each pair of style
|
||||||
QRegularExpression rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$");
|
QRegularExpression rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$");
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ void DynamicTextFieldEditor::fillInfoComboBox()
|
|||||||
QStringList strl;
|
QStringList strl;
|
||||||
auto type = elementEditor()->elementScene()->elementData().m_type;
|
auto type = elementEditor()->elementScene()->elementData().m_type;
|
||||||
|
|
||||||
if(type & ElementData::AllReport) {
|
if((type & ElementData::AllReport) || (type == ElementData::ConductorDefinition)) {
|
||||||
strl = QETInformation::folioReportInfoKeys();
|
strl = QETInformation::folioReportInfoKeys();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -365,7 +365,8 @@ void DynamicTextFieldEditor::on_m_text_from_cb_activated(int index) {
|
|||||||
void DynamicTextFieldEditor::on_m_composite_text_pb_clicked()
|
void DynamicTextFieldEditor::on_m_composite_text_pb_clicked()
|
||||||
{
|
{
|
||||||
bool isReport = false;
|
bool isReport = false;
|
||||||
if (elementEditor()->elementScene()->elementData().m_type & ElementData::AllReport) {
|
auto type = elementEditor()->elementScene()->elementData().m_type;
|
||||||
|
if ((type & ElementData::AllReport) || (type == ElementData::ConductorDefinition)) {
|
||||||
isReport = true;
|
isReport = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ void ElementPropertiesEditorWidget::setUpInterface()
|
|||||||
ui->m_base_type_cb->addItem (tr("Renvoi de folio précédent"), ElementData::PreviousReport);
|
ui->m_base_type_cb->addItem (tr("Renvoi de folio précédent"), ElementData::PreviousReport);
|
||||||
ui->m_base_type_cb->addItem (tr("Bornier"), ElementData::Terminal);
|
ui->m_base_type_cb->addItem (tr("Bornier"), ElementData::Terminal);
|
||||||
ui->m_base_type_cb->addItem (tr("Vignette"), ElementData::Thumbnail);
|
ui->m_base_type_cb->addItem (tr("Vignette"), ElementData::Thumbnail);
|
||||||
|
ui->m_base_type_cb->addItem (tr("Définition de conducteur"), ElementData::ConductorDefinition);
|
||||||
|
|
||||||
// Slave option
|
// Slave option
|
||||||
ui->m_state_cb->addItem(tr("Normalement ouvert"), ElementData::NO);
|
ui->m_state_cb->addItem(tr("Normalement ouvert"), ElementData::NO);
|
||||||
@@ -188,6 +189,9 @@ void ElementPropertiesEditorWidget::updateTree()
|
|||||||
case ElementData::PreviousReport:
|
case ElementData::PreviousReport:
|
||||||
ui->m_tree->setDisabled(true);
|
ui->m_tree->setDisabled(true);
|
||||||
break;
|
break;
|
||||||
|
case ElementData::ConductorDefinition:
|
||||||
|
ui->m_tree->setDisabled(true);
|
||||||
|
break;
|
||||||
case ElementData::Master:
|
case ElementData::Master:
|
||||||
ui->m_tree->setEnabled(true);
|
ui->m_tree->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
@@ -287,11 +291,9 @@ void ElementPropertiesEditorWidget::on_m_base_type_cb_currentIndexChanged(int in
|
|||||||
ui->m_master_gb->setVisible(master);
|
ui->m_master_gb->setVisible(master);
|
||||||
ui->m_terminal_gb->setVisible(terminal);
|
ui->m_terminal_gb->setVisible(terminal);
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
|
||||||
ui->tabWidget->setTabVisible(1,
|
ui->tabWidget->setTabVisible(1,
|
||||||
(type_ == ElementData::Simple ||
|
(type_ == ElementData::Simple ||
|
||||||
type_ == ElementData::Master));
|
type_ == ElementData::Master));
|
||||||
#endif
|
|
||||||
|
|
||||||
updateTree();
|
updateTree();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -737,9 +737,10 @@ bool QETElementEditor::checkElement()
|
|||||||
QList<QETWarning> errors;
|
QList<QETWarning> errors;
|
||||||
|
|
||||||
// Warning #1: Element haven't got terminal
|
// Warning #1: Element haven't got terminal
|
||||||
// (except for report, because report must have one terminal and this checking is do below)
|
// (except for report and conductor definition, because they must have one terminal and this checking is done below)
|
||||||
if (!m_elmt_scene -> containsTerminals() &&
|
if (!m_elmt_scene -> containsTerminals() &&
|
||||||
!(m_elmt_scene->elementData().m_type & ElementData::AllReport)) {
|
!(m_elmt_scene->elementData().m_type & ElementData::AllReport) &&
|
||||||
|
m_elmt_scene->elementData().m_type != ElementData::ConductorDefinition) {
|
||||||
warnings << qMakePair(
|
warnings << qMakePair(
|
||||||
tr("Absence de borne", "warning title"),
|
tr("Absence de borne", "warning title"),
|
||||||
tr(
|
tr(
|
||||||
@@ -771,6 +772,27 @@ bool QETElementEditor::checkElement()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check conductor definition element
|
||||||
|
if (m_elmt_scene->elementData().m_type == ElementData::ConductorDefinition)
|
||||||
|
{
|
||||||
|
int terminal =0;
|
||||||
|
|
||||||
|
for(auto qgi : m_elmt_scene -> items()) {
|
||||||
|
if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
|
||||||
|
terminal ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error: Conductor definition must have exactly one terminal
|
||||||
|
if (terminal != 1) {
|
||||||
|
errors << qMakePair (tr("Nombre de bornes incorrect"),
|
||||||
|
tr("<br><b>Erreur</b> :"
|
||||||
|
"<br>Les définitions de conducteur ne peuvent posséder qu'une seule borne."
|
||||||
|
"<br><b>Solution</b> :"
|
||||||
|
"<br>Vérifier que l'élément ne possède qu'une seule borne"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!errors.count() && !warnings.count()) {
|
if (!errors.count() && !warnings.count()) {
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ void TerminalEditor::updateForm()
|
|||||||
ui->m_y_dsb->setValue(m_part->property("y").toReal());
|
ui->m_y_dsb->setValue(m_part->property("y").toReal());
|
||||||
ui->m_orientation_cb->setCurrentIndex(ui->m_orientation_cb->findData(m_part->property("orientation")));
|
ui->m_orientation_cb->setCurrentIndex(ui->m_orientation_cb->findData(m_part->property("orientation")));
|
||||||
ui->m_name_le->setText(m_part->terminalName());
|
ui->m_name_le->setText(m_part->terminalName());
|
||||||
ui->m_type_cb->setCurrentIndex(ui->m_orientation_cb->findData(m_part->terminalType()));
|
ui->m_type_cb->setCurrentIndex(ui->m_type_cb->findData(m_part->terminalType()));
|
||||||
|
|
||||||
activeConnections(true);
|
activeConnections(true);
|
||||||
}
|
}
|
||||||
@@ -122,6 +122,9 @@ void TerminalEditor::init()
|
|||||||
ui->m_type_cb->addItem(tr("Générique"), TerminalData::Generic);
|
ui->m_type_cb->addItem(tr("Générique"), TerminalData::Generic);
|
||||||
ui->m_type_cb->addItem(tr("Bornier intérieur"), TerminalData::Inner);
|
ui->m_type_cb->addItem(tr("Bornier intérieur"), TerminalData::Inner);
|
||||||
ui->m_type_cb->addItem(tr("Bornier extérieur"), TerminalData::Outer);
|
ui->m_type_cb->addItem(tr("Bornier extérieur"), TerminalData::Outer);
|
||||||
|
ui->m_type_cb->addItem(tr("NO (contact SW)"), TerminalData::No);
|
||||||
|
ui->m_type_cb->addItem(tr("NC (contact SW)"), TerminalData::Nc);
|
||||||
|
ui->m_type_cb->addItem(tr("Commun (contact SW)"), TerminalData::Common);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -335,6 +335,7 @@ void TextEditor::setUpWidget(QWidget *parent)
|
|||||||
|
|
||||||
m_size_sb = new QSpinBox(parent);
|
m_size_sb = new QSpinBox(parent);
|
||||||
m_size_sb->setObjectName(QString::fromUtf8("m_size_sb"));
|
m_size_sb->setObjectName(QString::fromUtf8("m_size_sb"));
|
||||||
|
m_size_sb->setMinimum(4);
|
||||||
|
|
||||||
gridLayout->addWidget(m_size_sb, 2, 1, 1, 1);
|
gridLayout->addWidget(m_size_sb, 2, 1, 1, 1);
|
||||||
|
|
||||||
|
|||||||
@@ -567,14 +567,7 @@ void ElementPictureFactory::setPainterStyle(const QDomElement &dom, QPainter &pa
|
|||||||
pen.setCapStyle(Qt::SquareCap);
|
pen.setCapStyle(Qt::SquareCap);
|
||||||
|
|
||||||
//Get the couples style/value
|
//Get the couples style/value
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
|
||||||
const QStringList styles = dom.attribute("style").split(";", QString::SkipEmptyParts);
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
|
||||||
#endif
|
|
||||||
const QStringList styles = dom.attribute("style").split(";", Qt::SkipEmptyParts);
|
const QStringList styles = dom.attribute("style").split(";", Qt::SkipEmptyParts);
|
||||||
#endif
|
|
||||||
|
|
||||||
QRegularExpression rx("^(?<name>[a-z-]+):(?<value>[a-zA-Z-]+)$");
|
QRegularExpression rx("^(?<name>[a-z-]+):(?<value>[a-zA-Z-]+)$");
|
||||||
if (!rx.isValid())
|
if (!rx.isValid())
|
||||||
|
|||||||
@@ -188,11 +188,9 @@ void MachineInfo::send_info_to_debug()
|
|||||||
QDirIterator it1(QETApp::commonElementsDir().toLatin1(),nameFilters, QDir::Files, QDirIterator::Subdirectories);
|
QDirIterator it1(QETApp::commonElementsDir().toLatin1(),nameFilters, QDir::Files, QDirIterator::Subdirectories);
|
||||||
while (it1.hasNext())
|
while (it1.hasNext())
|
||||||
{
|
{
|
||||||
if(it1.next() > 0 )
|
it1.next();
|
||||||
{
|
|
||||||
commomElementsDir ++;
|
commomElementsDir ++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
qInfo()<< " Common Elements count:"<< commomElementsDir << "Elements";
|
qInfo()<< " Common Elements count:"<< commomElementsDir << "Elements";
|
||||||
|
|
||||||
|
|
||||||
@@ -200,22 +198,18 @@ void MachineInfo::send_info_to_debug()
|
|||||||
QDirIterator it2(QETApp::customElementsDir().toLatin1(), nameFilters, QDir::Files, QDirIterator::Subdirectories);
|
QDirIterator it2(QETApp::customElementsDir().toLatin1(), nameFilters, QDir::Files, QDirIterator::Subdirectories);
|
||||||
while (it2.hasNext())
|
while (it2.hasNext())
|
||||||
{
|
{
|
||||||
if(it2.next() > 0 )
|
it2.next();
|
||||||
{
|
|
||||||
customElementsDir ++;
|
customElementsDir ++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
qInfo()<< " Custom Elements count:"<< customElementsDir << "Elements";
|
qInfo()<< " Custom Elements count:"<< customElementsDir << "Elements";
|
||||||
|
|
||||||
int companyElementsDir = 0;
|
int companyElementsDir = 0;
|
||||||
QDirIterator it3(QETApp::companyElementsDir().toLatin1(), nameFilters, QDir::Files, QDirIterator::Subdirectories);
|
QDirIterator it3(QETApp::companyElementsDir().toLatin1(), nameFilters, QDir::Files, QDirIterator::Subdirectories);
|
||||||
while (it3.hasNext())
|
while (it3.hasNext())
|
||||||
{
|
{
|
||||||
if(it3.next() > 0 )
|
it3.next();
|
||||||
{
|
|
||||||
companyElementsDir ++;
|
companyElementsDir ++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
qInfo()<< " Company Elements count:"<< companyElementsDir << "Elements";
|
qInfo()<< " Company Elements count:"<< companyElementsDir << "Elements";
|
||||||
|
|
||||||
qInfo()<< "";
|
qInfo()<< "";
|
||||||
|
|||||||
@@ -174,24 +174,9 @@ int main(int argc, char **argv)
|
|||||||
QCoreApplication::setApplicationName("QElectroTech");
|
QCoreApplication::setApplicationName("QElectroTech");
|
||||||
//Creation and execution of the application
|
//Creation and execution of the application
|
||||||
//HighDPI
|
//HighDPI
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if QT_VERSION > QT_VERSION_CHECK(5, 7, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
||||||
qputenv("QT_ENABLE_HIGHDPI_SCALING", "1");
|
qputenv("QT_ENABLE_HIGHDPI_SCALING", "1");
|
||||||
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(QetSettings::hdpiScaleFactorRoundingPolicy());
|
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(QetSettings::hdpiScaleFactorRoundingPolicy());
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
SingleApplication app(argc, argv, true);
|
SingleApplication app(argc, argv, true);
|
||||||
|
|||||||
@@ -192,14 +192,16 @@ 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
|
||||||
|
auto screen = this->screen();
|
||||||
|
if(screen)
|
||||||
|
{
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
qDebug() << "--";
|
qDebug() << "--";
|
||||||
qDebug() << "DiagramPrintDialog::print printer_->resolution() before " << m_printer->resolution();
|
qDebug() << "DiagramPrintDialog::print printer_->resolution() before " << m_printer->resolution();
|
||||||
qDebug() << "DiagramPrintDialog::print screennumber " << QApplication::desktop()->screenNumber();
|
qDebug() << "DiagramPrintDialog::print screennumber " << screen->name();
|
||||||
#endif
|
#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
|
||||||
@@ -207,6 +209,7 @@ void ProjectPrintWindow::requestPaint()
|
|||||||
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
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,19 @@ bool ElementData::fromXml(const QDomElement &xml_element)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_type = typeFromString(xml_element.attribute(QStringLiteral("link_type"), QStringLiteral("simple")));
|
// --- HIER STARTET UNSER DEBUG-BLOCK ---
|
||||||
|
// Wir holen den String aus der XML und speichern ihn kurz zwischen
|
||||||
|
QString raw_type_string = xml_element.attribute(QStringLiteral("link_type"), QStringLiteral("simple"));
|
||||||
|
|
||||||
|
qDebug() << "\n=== NEUES BAUTEIL WIRD GELADEN ===";
|
||||||
|
qDebug() << "[XML Parser] Roher 'link_type' String aus der .elmt Datei:" << raw_type_string;
|
||||||
|
|
||||||
|
// Jetzt übergeben wir ihn an deine Übersetzungs-Funktion
|
||||||
|
m_type = typeFromString(raw_type_string);
|
||||||
|
|
||||||
|
qDebug() << "[XML Parser] Übersetzter ElementData-Typ:" << typeToString(m_type);
|
||||||
|
// --- HIER ENDET UNSER DEBUG-BLOCK ---
|
||||||
|
|
||||||
kindInfoFromXml(xml_element);
|
kindInfoFromXml(xml_element);
|
||||||
m_informations.fromXml(xml_element.firstChildElement(QStringLiteral("elementInformations")),
|
m_informations.fromXml(xml_element.firstChildElement(QStringLiteral("elementInformations")),
|
||||||
QStringLiteral("elementInformation"));
|
QStringLiteral("elementInformation"));
|
||||||
@@ -323,6 +335,8 @@ QString ElementData::typeToString(ElementData::Type type)
|
|||||||
return QStringLiteral("terminal");
|
return QStringLiteral("terminal");
|
||||||
case ElementData::Thumbnail:
|
case ElementData::Thumbnail:
|
||||||
return QStringLiteral("thumbnail");
|
return QStringLiteral("thumbnail");
|
||||||
|
case ElementData::ConductorDefinition:
|
||||||
|
return QStringLiteral("conductor_definition");
|
||||||
default:
|
default:
|
||||||
qDebug() << "ElementData::typeToString : type don't exist"
|
qDebug() << "ElementData::typeToString : type don't exist"
|
||||||
<< "return failsafe value 'simple'";
|
<< "return failsafe value 'simple'";
|
||||||
@@ -346,6 +360,8 @@ ElementData::Type ElementData::typeFromString(const QString &string)
|
|||||||
return ElementData::Terminal;
|
return ElementData::Terminal;
|
||||||
} else if (string == QLatin1String("thumbnail")) {
|
} else if (string == QLatin1String("thumbnail")) {
|
||||||
return ElementData::Thumbnail;
|
return ElementData::Thumbnail;
|
||||||
|
} else if (string == QLatin1String("conductor_definition")) {
|
||||||
|
return ElementData::ConductorDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return simple if nothing match
|
//Return simple if nothing match
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ class ElementData : public PropertiesInterface
|
|||||||
Master = 8,
|
Master = 8,
|
||||||
Slave = 16,
|
Slave = 16,
|
||||||
Terminal = 32,
|
Terminal = 32,
|
||||||
Thumbnail = 64};
|
Thumbnail = 64,
|
||||||
|
ConductorDefinition = 128};
|
||||||
Q_ENUM(Type)
|
Q_ENUM(Type)
|
||||||
Q_DECLARE_FLAGS(Types, Type)
|
Q_DECLARE_FLAGS(Types, Type)
|
||||||
|
|
||||||
|
|||||||
@@ -174,6 +174,12 @@ QString TerminalData::typeToString(TerminalData::Type type)
|
|||||||
return QString("Inner");
|
return QString("Inner");
|
||||||
case Outer :
|
case Outer :
|
||||||
return QString("Outer");
|
return QString("Outer");
|
||||||
|
case No :
|
||||||
|
return QString("No");
|
||||||
|
case Nc :
|
||||||
|
return QString("Nc");
|
||||||
|
case Common :
|
||||||
|
return QString("Common");
|
||||||
}
|
}
|
||||||
return QString("Generic");
|
return QString("Generic");
|
||||||
}
|
}
|
||||||
@@ -193,6 +199,12 @@ TerminalData::Type TerminalData::typeFromString(const QString &string)
|
|||||||
return TerminalData::Inner;
|
return TerminalData::Inner;
|
||||||
} else if (string == "Outer") {
|
} else if (string == "Outer") {
|
||||||
return TerminalData::Outer;
|
return TerminalData::Outer;
|
||||||
|
} else if (string == "No") {
|
||||||
|
return TerminalData::No;
|
||||||
|
} else if (string == "Nc") {
|
||||||
|
return TerminalData::Nc;
|
||||||
|
} else if (string == "Common") {
|
||||||
|
return TerminalData::Common;
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "TerminalData::typeFromString, argument string is invalid"
|
qDebug() << "TerminalData::typeFromString, argument string is invalid"
|
||||||
" failsafe type 'TerminalData::Generic' is returned";
|
" failsafe type 'TerminalData::Generic' is returned";
|
||||||
|
|||||||
@@ -41,7 +41,10 @@ class TerminalData : public PropertiesInterface
|
|||||||
enum Type {
|
enum Type {
|
||||||
Generic,
|
Generic,
|
||||||
Inner,
|
Inner,
|
||||||
Outer
|
Outer,
|
||||||
|
No, ///< Normally Open terminal (for SW contacts)
|
||||||
|
Nc, ///< Normally Closed terminal (for SW contacts)
|
||||||
|
Common ///< Common terminal (for SW contacts)
|
||||||
};
|
};
|
||||||
Q_ENUM(Type)
|
Q_ENUM(Type)
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
XRefProperties::XRefProperties()
|
XRefProperties::XRefProperties()
|
||||||
{
|
{
|
||||||
m_show_power_ctc = true;
|
m_show_power_ctc = true;
|
||||||
|
m_show_terminal_name = true;
|
||||||
m_display = Cross;
|
m_display = Cross;
|
||||||
m_snap_to = Bottom;
|
m_snap_to = Bottom;
|
||||||
m_prefix_keys << "power" << "delay" << "switch";
|
m_prefix_keys << "power" << "delay" << "switch";
|
||||||
@@ -48,6 +49,7 @@ void XRefProperties::toSettings(QSettings &settings,
|
|||||||
const QString prefix) const
|
const QString prefix) const
|
||||||
{
|
{
|
||||||
settings.setValue(prefix % "showpowerctc", m_show_power_ctc);
|
settings.setValue(prefix % "showpowerctc", m_show_power_ctc);
|
||||||
|
settings.setValue(prefix % "showterminalname", m_show_terminal_name);
|
||||||
QString display = m_display == Cross? "cross" : "contacts";
|
QString display = m_display == Cross? "cross" : "contacts";
|
||||||
settings.setValue(prefix % "displayhas", display);
|
settings.setValue(prefix % "displayhas", display);
|
||||||
QString snap = m_snap_to == Bottom? "bottom" : "label";
|
QString snap = m_snap_to == Bottom? "bottom" : "label";
|
||||||
@@ -78,6 +80,7 @@ void XRefProperties::fromSettings(const QSettings &settings,
|
|||||||
const QString prefix)
|
const QString prefix)
|
||||||
{
|
{
|
||||||
m_show_power_ctc = settings.value(prefix % "showpowerctc", true).toBool();
|
m_show_power_ctc = settings.value(prefix % "showpowerctc", true).toBool();
|
||||||
|
m_show_terminal_name = settings.value(prefix % "showterminalname", true).toBool();
|
||||||
QString display = settings.value(prefix % "displayhas", "cross").toString();
|
QString display = settings.value(prefix % "displayhas", "cross").toString();
|
||||||
display == "cross"? m_display = Cross : m_display = Contacts;
|
display == "cross"? m_display = Cross : m_display = Contacts;
|
||||||
QString snap = settings.value(prefix % "snapto", "label").toString();
|
QString snap = settings.value(prefix % "snapto", "label").toString();
|
||||||
@@ -107,6 +110,7 @@ QDomElement XRefProperties::toXml(QDomDocument &xml_document) const
|
|||||||
xml_element.setAttribute("type", m_key);
|
xml_element.setAttribute("type", m_key);
|
||||||
|
|
||||||
xml_element.setAttribute("showpowerctc", m_show_power_ctc? "true" : "false");
|
xml_element.setAttribute("showpowerctc", m_show_power_ctc? "true" : "false");
|
||||||
|
xml_element.setAttribute("showterminalname", m_show_terminal_name? "true" : "false");
|
||||||
QString display = m_display == Cross? "cross" : "contacts";
|
QString display = m_display == Cross? "cross" : "contacts";
|
||||||
xml_element.setAttribute("displayhas", display);
|
xml_element.setAttribute("displayhas", display);
|
||||||
QString snap = m_snap_to == Bottom? "bottom" : "label";
|
QString snap = m_snap_to == Bottom? "bottom" : "label";
|
||||||
@@ -137,6 +141,7 @@ QDomElement XRefProperties::toXml(QDomDocument &xml_document) const
|
|||||||
*/
|
*/
|
||||||
bool XRefProperties::fromXml(const QDomElement &xml_element) {
|
bool XRefProperties::fromXml(const QDomElement &xml_element) {
|
||||||
m_show_power_ctc = xml_element.attribute("showpowerctc") == "true";
|
m_show_power_ctc = xml_element.attribute("showpowerctc") == "true";
|
||||||
|
m_show_terminal_name = xml_element.attribute("showterminalname", "true") == "true";
|
||||||
QString display = xml_element.attribute("displayhas", "cross");
|
QString display = xml_element.attribute("displayhas", "cross");
|
||||||
display == "cross"? m_display = Cross : m_display = Contacts;
|
display == "cross"? m_display = Cross : m_display = Contacts;
|
||||||
QString snap = xml_element.attribute("snapto", "label");
|
QString snap = xml_element.attribute("snapto", "label");
|
||||||
@@ -188,6 +193,7 @@ QHash<QString, XRefProperties> XRefProperties::defaultProperties()
|
|||||||
|
|
||||||
bool XRefProperties::operator ==(const XRefProperties &xrp) const{
|
bool XRefProperties::operator ==(const XRefProperties &xrp) const{
|
||||||
return (m_show_power_ctc == xrp.m_show_power_ctc
|
return (m_show_power_ctc == xrp.m_show_power_ctc
|
||||||
|
&& m_show_terminal_name == xrp.m_show_terminal_name
|
||||||
&& m_display == xrp.m_display
|
&& m_display == xrp.m_display
|
||||||
&& m_snap_to == xrp.m_snap_to
|
&& m_snap_to == xrp.m_snap_to
|
||||||
&& m_prefix == xrp.m_prefix
|
&& m_prefix == xrp.m_prefix
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ class XRefProperties : public PropertiesInterface
|
|||||||
void setShowPowerContac (const bool a) {m_show_power_ctc = a;}
|
void setShowPowerContac (const bool a) {m_show_power_ctc = a;}
|
||||||
bool showPowerContact () const {return m_show_power_ctc;}
|
bool showPowerContact () const {return m_show_power_ctc;}
|
||||||
|
|
||||||
|
void setShowTerminalName (const bool a) {m_show_terminal_name = a;}
|
||||||
|
bool showTerminalName () const {return m_show_terminal_name;}
|
||||||
|
|
||||||
void setDisplayHas (const DisplayHas dh) {m_display = dh;}
|
void setDisplayHas (const DisplayHas dh) {m_display = dh;}
|
||||||
DisplayHas displayHas () const {return m_display;}
|
DisplayHas displayHas () const {return m_display;}
|
||||||
|
|
||||||
@@ -81,6 +84,7 @@ class XRefProperties : public PropertiesInterface
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_show_power_ctc;
|
bool m_show_power_ctc;
|
||||||
|
bool m_show_terminal_name;
|
||||||
DisplayHas m_display;
|
DisplayHas m_display;
|
||||||
SnapTo m_snap_to;
|
SnapTo m_snap_to;
|
||||||
Qt::AlignmentFlag m_xref_pos;
|
Qt::AlignmentFlag m_xref_pos;
|
||||||
|
|||||||
@@ -183,16 +183,7 @@ bool QET::orthogonalProjection(
|
|||||||
|
|
||||||
// determine le point d'intersection des deux droites = le projete orthogonal
|
// determine le point d'intersection des deux droites = le projete orthogonal
|
||||||
QPointF intersection_point;
|
QPointF intersection_point;
|
||||||
#if TODO_LIST
|
QLineF::IntersectType it = line.intersects(perpendicular_line, &intersection_point);
|
||||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
|
||||||
#endif
|
|
||||||
QLineF::IntersectType it = line.
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
|
||||||
intersect // ### Qt 6: remove
|
|
||||||
#else
|
|
||||||
intersects
|
|
||||||
#endif
|
|
||||||
(perpendicular_line, &intersection_point);
|
|
||||||
|
|
||||||
// ne devrait pas arriver (mais bon...)
|
// ne devrait pas arriver (mais bon...)
|
||||||
if (it == QLineF::NoIntersection) return(false);
|
if (it == QLineF::NoIntersection) return(false);
|
||||||
@@ -545,16 +536,8 @@ QString QET::joinWithSpaces(const QStringList &string_list) {
|
|||||||
QStringList QET::splitWithSpaces(const QString &string) {
|
QStringList QET::splitWithSpaces(const QString &string) {
|
||||||
// les chaines sont separees par des espaces non echappes
|
// les chaines sont separees par des espaces non echappes
|
||||||
// = avec un nombre nul ou pair de backslashes devant
|
// = avec un nombre nul ou pair de backslashes devant
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
|
||||||
#endif
|
|
||||||
QStringList escaped_strings = string.split(QRegularExpression("[^\\]?(?:\\\\)* "),
|
QStringList escaped_strings = string.split(QRegularExpression("[^\\]?(?:\\\\)* "),
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
Qt::SkipEmptyParts);
|
||||||
QString
|
|
||||||
#else
|
|
||||||
Qt
|
|
||||||
#endif
|
|
||||||
::SkipEmptyParts);
|
|
||||||
|
|
||||||
QStringList returned_list;
|
QStringList returned_list;
|
||||||
foreach(QString escaped_string, escaped_strings) {
|
foreach(QString escaped_string, escaped_strings) {
|
||||||
@@ -684,14 +667,7 @@ bool QET::writeXmlFile(QDomDocument &xml_doc, const QString &filepath, QString *
|
|||||||
}
|
}
|
||||||
|
|
||||||
QTextStream out(&file);
|
QTextStream out(&file);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
|
||||||
out.setCodec("UTF-8");
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
#endif
|
|
||||||
out.setEncoding(QStringConverter::Utf8);
|
out.setEncoding(QStringConverter::Utf8);
|
||||||
#endif
|
|
||||||
out.setGenerateByteOrderMark(false);
|
out.setGenerateByteOrderMark(false);
|
||||||
out << xml_doc.toString(4);
|
out << xml_doc.toString(4);
|
||||||
if (!file.commit())
|
if (!file.commit())
|
||||||
@@ -822,14 +798,7 @@ bool QET::writeToFile(QDomDocument &xml_doc, QFile *file, QString *error_message
|
|||||||
|
|
||||||
QTextStream out(file);
|
QTextStream out(file);
|
||||||
out.seek(0);
|
out.seek(0);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
|
||||||
out.setCodec("UTF-8");
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
#endif
|
|
||||||
out.setEncoding(QStringConverter::Utf8);
|
out.setEncoding(QStringConverter::Utf8);
|
||||||
#endif
|
|
||||||
out.setGenerateByteOrderMark(false);
|
out.setGenerateByteOrderMark(false);
|
||||||
out << xml_doc.toString(4);
|
out << xml_doc.toString(4);
|
||||||
if (opened_here) {
|
if (opened_here) {
|
||||||
|
|||||||
@@ -204,14 +204,7 @@ void QETApp::setLanguage(const QString &desired_language) {
|
|||||||
QString languages_path = languagesPath();
|
QString languages_path = languagesPath();
|
||||||
|
|
||||||
// load Qt library translations
|
// load Qt library translations
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
|
||||||
QString qt_l10n_path = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
#endif
|
|
||||||
QString qt_l10n_path = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
|
QString qt_l10n_path = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
|
||||||
#endif
|
|
||||||
if (!qtTranslator.load("qt_" + desired_language, qt_l10n_path))
|
if (!qtTranslator.load("qt_" + desired_language, qt_l10n_path))
|
||||||
{
|
{
|
||||||
qWarning() << "failed to load"
|
qWarning() << "failed to load"
|
||||||
|
|||||||
@@ -451,16 +451,8 @@ void GraphicsTablePropertiesEditor::setUpEditConnection()
|
|||||||
m_edit_connection << connect(ui->m_table_left_margin, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(ui->m_table_left_margin, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
m_edit_connection << connect(ui->m_table_right_margin, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(ui->m_table_right_margin, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
m_edit_connection << connect(ui->m_table_bottom_margin, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(ui->m_table_bottom_margin, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
|
||||||
m_edit_connection << connect(m_table_button_group, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &GraphicsTablePropertiesEditor::apply);
|
|
||||||
m_edit_connection << connect(m_header_button_group, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &GraphicsTablePropertiesEditor::apply);
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.15 or later")
|
|
||||||
#endif
|
|
||||||
m_edit_connection << connect(m_table_button_group, QOverload<int>::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(m_table_button_group, QOverload<int>::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
m_edit_connection << connect(m_header_button_group, QOverload<int>::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(m_header_button_group, QOverload<int>::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
#endif
|
|
||||||
m_edit_connection << connect(ui->m_display_n_row_sb, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(ui->m_display_n_row_sb, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
m_edit_connection << connect(ui->m_display_n_row_sb, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::updateInfoLabel);
|
m_edit_connection << connect(ui->m_display_n_row_sb, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::updateInfoLabel);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1725,14 +1725,7 @@ QSet<Conductor *> Conductor::relatedPotentialConductors(const bool all_diagram,
|
|||||||
for (Conductor *c : other_conductors_list_t) {
|
for (Conductor *c : other_conductors_list_t) {
|
||||||
other_conductors += c->relatedPotentialConductors(all_diagram, t_list);
|
other_conductors += c->relatedPotentialConductors(all_diagram, t_list);
|
||||||
}
|
}
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
|
||||||
other_conductors += other_conductors_list_t.toSet();
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
|
||||||
#endif
|
|
||||||
other_conductors += QSet<Conductor*>(other_conductors_list_t.begin(),other_conductors_list_t.end());
|
other_conductors += QSet<Conductor*>(other_conductors_list_t.begin(),other_conductors_list_t.end());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
#include "crossrefitem.h"
|
#include "crossrefitem.h"
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include "../autoNum/assignvariables.h"
|
#include "../autoNum/assignvariables.h"
|
||||||
#include "../diagram.h"
|
#include "../diagram.h"
|
||||||
#include "../diagramposition.h"
|
#include "../diagramposition.h"
|
||||||
@@ -222,9 +224,12 @@ void CrossRefItem::updateLabel()
|
|||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
m_bounding_rect = QRectF();
|
m_bounding_rect = QRectF();
|
||||||
|
|
||||||
//init the painter
|
// Build geometry and m_hovered_contacts_map using a QImage-backed
|
||||||
QPainter qp;
|
// painter so font metrics match the screen painter in paint().
|
||||||
qp.begin(&m_drawing);
|
// m_update_map=true allows the draw functions to populate the map;
|
||||||
|
// paint() calls them with m_update_map=false so the map is stable.
|
||||||
|
QImage dummy(1, 1, QImage::Format_ARGB32_Premultiplied);
|
||||||
|
QPainter qp(&dummy);
|
||||||
QPen pen_;
|
QPen pen_;
|
||||||
pen_.setWidthF(0.5);
|
pen_.setWidthF(0.5);
|
||||||
qp.setPen(pen_);
|
qp.setPen(pen_);
|
||||||
@@ -233,17 +238,21 @@ void CrossRefItem::updateLabel()
|
|||||||
//Draw cross or contact, only if master element is linked.
|
//Draw cross or contact, only if master element is linked.
|
||||||
if (! m_element->linkedElements().isEmpty())
|
if (! m_element->linkedElements().isEmpty())
|
||||||
{
|
{
|
||||||
|
m_update_map = true;
|
||||||
XRefProperties::DisplayHas dh = m_properties.displayHas();
|
XRefProperties::DisplayHas dh = m_properties.displayHas();
|
||||||
|
|
||||||
if (dh == XRefProperties::Cross)
|
if (dh == XRefProperties::Cross)
|
||||||
drawAsCross(qp);
|
drawAsCross(qp);
|
||||||
else if (dh == XRefProperties::Contacts)
|
else if (dh == XRefProperties::Contacts)
|
||||||
drawAsContacts(qp);
|
drawAsContacts(qp);
|
||||||
|
m_update_map = false;
|
||||||
}
|
}
|
||||||
qp.end();
|
|
||||||
|
|
||||||
autoPos();
|
autoPos();
|
||||||
update();
|
update();
|
||||||
|
// Schedule a second update after the scene has finished laying out,
|
||||||
|
// so the initial render uses the correct bounding rect.
|
||||||
|
QTimer::singleShot(0, this, [this]{ update(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -311,7 +320,26 @@ void CrossRefItem::paint(
|
|||||||
{
|
{
|
||||||
Q_UNUSED(option)
|
Q_UNUSED(option)
|
||||||
Q_UNUSED(widget)
|
Q_UNUSED(widget)
|
||||||
m_drawing.play(painter);
|
// Draw directly — no QPicture involved anywhere.
|
||||||
|
// QPicture::play() + nested drawPicture() (m_hdr_no_ctc/m_hdr_nc_ctc)
|
||||||
|
// caused a use-after-free crash (QRegion::begin, Qt5Gui+0x49af60)
|
||||||
|
// confirmed by analysis of 19+ coredumps.
|
||||||
|
// m_update_map=false: draw functions do not overwrite m_hovered_contacts_map.
|
||||||
|
if (m_element->linkedElements().isEmpty()) return;
|
||||||
|
|
||||||
|
QPen pen_;
|
||||||
|
pen_.setWidthF(0.5);
|
||||||
|
painter->save();
|
||||||
|
painter->setPen(pen_);
|
||||||
|
painter->setFont(QETApp::diagramTextsFont(5));
|
||||||
|
|
||||||
|
m_update_map = false;
|
||||||
|
XRefProperties::DisplayHas dh = m_properties.displayHas();
|
||||||
|
if (dh == XRefProperties::Cross)
|
||||||
|
drawAsCross(*painter);
|
||||||
|
else if (dh == XRefProperties::Contacts)
|
||||||
|
drawAsContacts(*painter);
|
||||||
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -321,7 +349,24 @@ void CrossRefItem::paint(
|
|||||||
void CrossRefItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
void CrossRefItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
event->accept();
|
event->accept();
|
||||||
QetGraphicsItem::showItem(m_hovered_contact);
|
|
||||||
|
// Find the element under the click position directly from the map,
|
||||||
|
// rather than relying on m_hovered_contact which may have been reset
|
||||||
|
// by hoverMoveEvent between the two clicks of the double-click.
|
||||||
|
QPointF pos = event->pos();
|
||||||
|
Element *target = m_hovered_contact;
|
||||||
|
|
||||||
|
if (!target) {
|
||||||
|
for (auto it = m_hovered_contacts_map.begin();
|
||||||
|
it != m_hovered_contacts_map.end(); ++it) {
|
||||||
|
if (it.value().contains(pos)) {
|
||||||
|
target = it.key();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QetGraphicsItem::showItem(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -433,49 +478,41 @@ void CrossRefItem::linkedChanged()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@brief CrossRefItem::buildHeaderContact
|
@brief CrossRefItem::buildHeaderContact
|
||||||
Draw the QPicture of m_hdr_no_ctc and m_hdr_nc_ctc
|
Draw NO and NC contact symbols directly onto painter.
|
||||||
|
Previously used QPicture (m_hdr_no_ctc/m_hdr_nc_ctc) which caused
|
||||||
|
use-after-free crashes via nested QPicture::play() calls.
|
||||||
*/
|
*/
|
||||||
void CrossRefItem::buildHeaderContact()
|
void CrossRefItem::buildHeaderContact(QPainter &painter, QPointF no_pos, QPointF nc_pos)
|
||||||
{
|
{
|
||||||
if (!m_hdr_no_ctc.isNull() && !m_hdr_nc_ctc.isNull()) return;
|
|
||||||
|
|
||||||
//init the painter
|
|
||||||
QPainter qp;
|
|
||||||
QPen pen_;
|
QPen pen_;
|
||||||
pen_.setWidthF(0.2);
|
pen_.setWidthF(0.2);
|
||||||
|
painter.save();
|
||||||
|
painter.setPen(pen_);
|
||||||
|
|
||||||
//draw the NO contact
|
//draw the NO contact header symbol
|
||||||
if (m_hdr_no_ctc.isNull()) {
|
painter.drawLine(no_pos.x()+0, no_pos.y()+3, no_pos.x()+5, no_pos.y()+3);
|
||||||
qp.begin(&m_hdr_no_ctc);
|
|
||||||
qp.setPen(pen_);
|
|
||||||
qp.drawLine(0, 3, 5, 3);
|
|
||||||
QPointF p1[3] = {
|
QPointF p1[3] = {
|
||||||
QPointF(5, 0),
|
QPointF(no_pos.x()+5, no_pos.y()+0),
|
||||||
QPointF(10, 3),
|
QPointF(no_pos.x()+10, no_pos.y()+3),
|
||||||
QPointF(15, 3),
|
QPointF(no_pos.x()+15, no_pos.y()+3),
|
||||||
};
|
};
|
||||||
qp.drawPolyline(p1,3);
|
painter.drawPolyline(p1, 3);
|
||||||
qp.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
//draw the NC contact
|
//draw the NC contact header symbol
|
||||||
if (m_hdr_nc_ctc.isNull()) {
|
|
||||||
qp.begin(&m_hdr_nc_ctc);
|
|
||||||
qp.setPen(pen_);
|
|
||||||
QPointF p2[3] = {
|
QPointF p2[3] = {
|
||||||
QPointF(0, 3),
|
QPointF(nc_pos.x()+0, nc_pos.y()+3),
|
||||||
QPointF(5, 3),
|
QPointF(nc_pos.x()+5, nc_pos.y()+3),
|
||||||
QPointF(5, 0)
|
QPointF(nc_pos.x()+5, nc_pos.y()+0)
|
||||||
};
|
};
|
||||||
qp.drawPolyline(p2,3);
|
painter.drawPolyline(p2, 3);
|
||||||
QPointF p3[3] = {
|
QPointF p3[3] = {
|
||||||
QPointF(4, 0),
|
QPointF(nc_pos.x()+4, nc_pos.y()+0),
|
||||||
QPointF(10, 3),
|
QPointF(nc_pos.x()+10, nc_pos.y()+3),
|
||||||
QPointF(15, 3),
|
QPointF(nc_pos.x()+15, nc_pos.y()+3),
|
||||||
};
|
};
|
||||||
qp.drawPolyline(p3,3);
|
painter.drawPolyline(p3, 3);
|
||||||
qp.end();
|
|
||||||
}
|
painter.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -493,11 +530,95 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
|
|||||||
|
|
||||||
QStringList no_str, nc_str;
|
QStringList no_str, nc_str;
|
||||||
|
|
||||||
|
// Helper lambda: build "[13-14] pos" string for an element.
|
||||||
|
// For power contacts (e.g. 3-pole contactor), all named terminals
|
||||||
|
// are collected (e.g. "[1-2-3-4-5-6] pos").
|
||||||
|
// For other contacts (NO/NC/SW), only the first 2 named terminals
|
||||||
|
// are used — users are expected to name and order their terminals
|
||||||
|
// in the element editor.
|
||||||
|
// Helper lambda: build "[13-14] pos" for an element.
|
||||||
|
// - Power: all terminals sorted numerically → "[1-2-3-4-5-6] pos"
|
||||||
|
// - SW with typed terminals: show relevant pair per column (handled below)
|
||||||
|
// - Others: first 2 named terminals
|
||||||
|
auto buildLabel = [this](Element *elmt, bool is_no_col) -> QString {
|
||||||
|
const bool is_power =
|
||||||
|
elmt->kindInformations()["type"].toString() == "power";
|
||||||
|
const bool is_sw =
|
||||||
|
elmt->kindInformations()["state"].toString() == "SW";
|
||||||
|
|
||||||
|
QStringList tnames;
|
||||||
|
|
||||||
|
if (is_sw) {
|
||||||
|
// Check if terminals have explicit No/Nc/Common types
|
||||||
|
bool has_typed = false;
|
||||||
|
for (Terminal *t : elmt->terminals()) {
|
||||||
|
if (!t) continue;
|
||||||
|
if (t->terminalType() == TerminalData::No ||
|
||||||
|
t->terminalType() == TerminalData::Nc ||
|
||||||
|
t->terminalType() == TerminalData::Common) {
|
||||||
|
has_typed = true; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (has_typed) {
|
||||||
|
QString no_name, nc_name, common_name;
|
||||||
|
for (Terminal *t : elmt->terminals()) {
|
||||||
|
if (!t) continue;
|
||||||
|
if (!t->name().isEmpty()) {
|
||||||
|
if (t->terminalType() == TerminalData::No) no_name = t->name();
|
||||||
|
else if (t->terminalType() == TerminalData::Nc) nc_name = t->name();
|
||||||
|
else if (t->terminalType() == TerminalData::Common) common_name = t->name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// NO column: show NO+Common pair; NC column: show NC+Common pair
|
||||||
|
if (is_no_col)
|
||||||
|
tnames << no_name << common_name;
|
||||||
|
else
|
||||||
|
tnames << nc_name << common_name;
|
||||||
|
} else {
|
||||||
|
// Fallback: first 2 named terminals
|
||||||
|
for (Terminal *t : elmt->terminals()) {
|
||||||
|
if (!t) continue;
|
||||||
|
const QString tn = t->name();
|
||||||
|
if (!tn.isEmpty()) { tnames << tn; if (tnames.size() >= 2) break; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (Terminal *t : elmt->terminals()) {
|
||||||
|
if (!t) continue;
|
||||||
|
const QString tn = t->name();
|
||||||
|
if (!tn.isEmpty()) {
|
||||||
|
tnames << tn;
|
||||||
|
if (!is_power && tnames.size() >= 2) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_power) {
|
||||||
|
std::sort(tnames.begin(), tnames.end(),
|
||||||
|
[](const QString &a, const QString &b){
|
||||||
|
int i_a = a.size();
|
||||||
|
while (i_a > 0 && a[i_a-1].isDigit()) --i_a;
|
||||||
|
int i_b = b.size();
|
||||||
|
while (i_b > 0 && b[i_b-1].isDigit()) --i_b;
|
||||||
|
bool a_ok = false, b_ok = false;
|
||||||
|
int ai = a.mid(i_a).toInt(&a_ok);
|
||||||
|
int bi = b.mid(i_b).toInt(&b_ok);
|
||||||
|
if (a_ok && b_ok && a.left(i_a) == b.left(i_b))
|
||||||
|
return ai < bi;
|
||||||
|
return a < b;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString pos = elementPositionText(elmt, true);
|
||||||
|
if (!tnames.isEmpty() && m_properties.showTerminalName())
|
||||||
|
return QStringLiteral("[") + tnames.join("-") + QStringLiteral("] ") + pos;
|
||||||
|
return pos;
|
||||||
|
};
|
||||||
|
|
||||||
for (auto elmt : NOElements()) {
|
for (auto elmt : NOElements()) {
|
||||||
no_str.append(elementPositionText(elmt, true));
|
no_str.append(buildLabel(elmt, true));
|
||||||
}
|
}
|
||||||
for (auto elmt : NCElements()) {
|
for (auto elmt : NCElements()) {
|
||||||
nc_str.append(elementPositionText(elmt, true));
|
nc_str.append(buildLabel(elmt, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
//There is no string to display, we return now
|
//There is no string to display, we return now
|
||||||
@@ -510,9 +631,10 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
|
|||||||
QRectF no_bounding;
|
QRectF no_bounding;
|
||||||
for (auto str : no_str)
|
for (auto str : no_str)
|
||||||
{
|
{
|
||||||
QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str);
|
QRectF bounding = painter.boundingRect(QRectF(0, 0, 500, 20), Qt::AlignLeft, str);
|
||||||
no_bounding = no_bounding.united(bounding);
|
|
||||||
no_bounding.setHeight(no_bounding.height() + bounding.height());
|
no_bounding.setHeight(no_bounding.height() + bounding.height());
|
||||||
|
if (bounding.width() > no_bounding.width())
|
||||||
|
no_bounding.setWidth(bounding.width());
|
||||||
}
|
}
|
||||||
//Adjust according to the NO
|
//Adjust according to the NO
|
||||||
if (no_bounding.height() > default_bounding.height() - header)
|
if (no_bounding.height() > default_bounding.height() - header)
|
||||||
@@ -524,9 +646,10 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
|
|||||||
QRectF nc_bounding;
|
QRectF nc_bounding;
|
||||||
for (auto str : nc_str)
|
for (auto str : nc_str)
|
||||||
{
|
{
|
||||||
QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str);
|
QRectF bounding = painter.boundingRect(QRectF(0, 0, 500, 20), Qt::AlignLeft, str);
|
||||||
nc_bounding = nc_bounding.united(bounding);
|
|
||||||
nc_bounding.setHeight(nc_bounding.height() + bounding.height());
|
nc_bounding.setHeight(nc_bounding.height() + bounding.height());
|
||||||
|
if (bounding.width() > nc_bounding.width())
|
||||||
|
nc_bounding.setWidth(bounding.width());
|
||||||
}
|
}
|
||||||
//Adjust according to the NC
|
//Adjust according to the NC
|
||||||
if (nc_bounding.height() > default_bounding.height() - header)
|
if (nc_bounding.height() > default_bounding.height() - header)
|
||||||
@@ -550,7 +673,8 @@ void CrossRefItem::drawAsCross(QPainter &painter)
|
|||||||
{
|
{
|
||||||
//calculate the size of the cross
|
//calculate the size of the cross
|
||||||
setUpCrossBoundingRect(painter);
|
setUpCrossBoundingRect(painter);
|
||||||
m_hovered_contacts_map.clear();
|
m_drawed_contacts = 0;
|
||||||
|
if (m_update_map) m_hovered_contacts_map.clear();
|
||||||
|
|
||||||
//Bounding rect is empty that mean there's no contact to draw
|
//Bounding rect is empty that mean there's no contact to draw
|
||||||
if (boundingRect().isEmpty()) return;
|
if (boundingRect().isEmpty()) return;
|
||||||
@@ -560,12 +684,11 @@ void CrossRefItem::drawAsCross(QPainter &painter)
|
|||||||
painter.drawLine(br.width()/2, 0, br.width()/2, br.height()); //vertical line
|
painter.drawLine(br.width()/2, 0, br.width()/2, br.height()); //vertical line
|
||||||
painter.drawLine(0, header, br.width(), header); //horizontal line
|
painter.drawLine(0, header, br.width(), header); //horizontal line
|
||||||
|
|
||||||
//Add the symbolic contacts
|
//Add the symbolic contacts (drawn directly, no QPicture)
|
||||||
buildHeaderContact();
|
static const qreal hdr_symbol_width = 15.0;
|
||||||
QPointF p((m_bounding_rect.width()/4) - (m_hdr_no_ctc.width()/2), 0);
|
QPointF no_pos((m_bounding_rect.width()/4) - (hdr_symbol_width/2), 0);
|
||||||
painter.drawPicture (p, m_hdr_no_ctc);
|
QPointF nc_pos((m_bounding_rect.width() * 3/4) - (hdr_symbol_width/2), 0);
|
||||||
p.setX((m_bounding_rect.width() * 3/4) - (m_hdr_nc_ctc.width()/2));
|
buildHeaderContact(painter, no_pos, nc_pos);
|
||||||
painter.drawPicture (p, m_hdr_nc_ctc);
|
|
||||||
|
|
||||||
//and fill it
|
//and fill it
|
||||||
fillCrossRef(painter);
|
fillCrossRef(painter);
|
||||||
@@ -582,7 +705,7 @@ void CrossRefItem::drawAsContacts(QPainter &painter)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_drawed_contacts = 0;
|
m_drawed_contacts = 0;
|
||||||
m_hovered_contacts_map.clear();
|
if (m_update_map) m_hovered_contacts_map.clear();
|
||||||
QRectF bounding_rect;
|
QRectF bounding_rect;
|
||||||
|
|
||||||
//Draw each linked contact
|
//Draw each linked contact
|
||||||
@@ -606,7 +729,7 @@ void CrossRefItem::drawAsContacts(QPainter &painter)
|
|||||||
else if (type == "delayOff") option += DelayOff;
|
else if (type == "delayOff") option += DelayOff;
|
||||||
else if (type == "delayOnOff") option += DelayOnOff;
|
else if (type == "delayOnOff") option += DelayOnOff;
|
||||||
|
|
||||||
QRectF br = drawContact(painter, option, elmt);
|
QRectF br = drawContact(painter, option, elmt, i);
|
||||||
bounding_rect = bounding_rect.united(br);
|
bounding_rect = bounding_rect.united(br);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -625,19 +748,81 @@ void CrossRefItem::drawAsContacts(QPainter &painter)
|
|||||||
@param elmt : the element to display text (the position of the contact)
|
@param elmt : the element to display text (the position of the contact)
|
||||||
@return The bounding rect of the draw (contact + text)
|
@return The bounding rect of the draw (contact + text)
|
||||||
*/
|
*/
|
||||||
QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
|
QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt, int pole_index)
|
||||||
{
|
{
|
||||||
QString str = elementPositionText(elmt);
|
QString str = elementPositionText(elmt);
|
||||||
|
|
||||||
// Collect terminal names from the element definition (.elmt)
|
// Collect terminal names from the element definition (.elmt)
|
||||||
// e.g. name="13" and name="14" on each terminal
|
// e.g. name="13" and name="14" on each terminal
|
||||||
|
// For power contacts, sort numerically and pick the pair for pole_index.
|
||||||
|
// For SW contacts with typed terminals (No/Nc/Common), filter by role.
|
||||||
QStringList terminal_names;
|
QStringList terminal_names;
|
||||||
|
const bool is_power_ctc =
|
||||||
|
elmt->kindInformations()["type"].toString() == "power";
|
||||||
|
const bool is_sw = (flags & SW) && !(flags & NOC);
|
||||||
|
|
||||||
|
// Check if SW terminals have explicit No/Nc/Common types
|
||||||
|
bool sw_has_typed_terminals = false;
|
||||||
|
if (is_sw) {
|
||||||
for (Terminal *t : elmt->terminals()) {
|
for (Terminal *t : elmt->terminals()) {
|
||||||
|
if (!t) continue;
|
||||||
|
if (t->terminalType() == TerminalData::No ||
|
||||||
|
t->terminalType() == TerminalData::Nc ||
|
||||||
|
t->terminalType() == TerminalData::Common) {
|
||||||
|
sw_has_typed_terminals = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Terminal *t : elmt->terminals()) {
|
||||||
|
if (!t) continue;
|
||||||
const QString tname = t->name();
|
const QString tname = t->name();
|
||||||
if (!tname.isEmpty())
|
if (!tname.isEmpty())
|
||||||
terminal_names << tname;
|
terminal_names << tname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_power_ctc) {
|
||||||
|
// Sort terminals alphanumerically so names like "R1","R2"... or "1","2"...
|
||||||
|
// are ordered correctly. Extract trailing digits for numeric comparison;
|
||||||
|
// fall back to full string comparison when no digits are found.
|
||||||
|
std::sort(terminal_names.begin(), terminal_names.end(),
|
||||||
|
[](const QString &a, const QString &b){
|
||||||
|
// Extract trailing numeric part
|
||||||
|
int i_a = a.size();
|
||||||
|
while (i_a > 0 && a[i_a-1].isDigit()) --i_a;
|
||||||
|
int i_b = b.size();
|
||||||
|
while (i_b > 0 && b[i_b-1].isDigit()) --i_b;
|
||||||
|
bool a_ok = false, b_ok = false;
|
||||||
|
int ai = a.mid(i_a).toInt(&a_ok);
|
||||||
|
int bi = b.mid(i_b).toInt(&b_ok);
|
||||||
|
if (a_ok && b_ok && a.left(i_a) == b.left(i_b))
|
||||||
|
return ai < bi;
|
||||||
|
return a < b;
|
||||||
|
});
|
||||||
|
// Pick the pair for this pole: pole 0 → [0,1], pole 1 → [2,3], etc.
|
||||||
|
int idx = pole_index * 2;
|
||||||
|
if (idx + 1 < terminal_names.size())
|
||||||
|
terminal_names = QStringList() << terminal_names[idx] << terminal_names[idx+1];
|
||||||
|
else
|
||||||
|
terminal_names.clear();
|
||||||
|
} else if (is_sw && sw_has_typed_terminals) {
|
||||||
|
// Build [NO_name, Common_name, NC_name] from typed terminals
|
||||||
|
QString no_name, nc_name, common_name;
|
||||||
|
for (Terminal *t : elmt->terminals()) {
|
||||||
|
if (!t) continue;
|
||||||
|
if (!t->name().isEmpty()) {
|
||||||
|
if (t->terminalType() == TerminalData::No) no_name = t->name();
|
||||||
|
else if (t->terminalType() == TerminalData::Nc) nc_name = t->name();
|
||||||
|
else if (t->terminalType() == TerminalData::Common) common_name = t->name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// drawText expects: [0]=NC, [1]=NO, [2]=Common
|
||||||
|
// (drawText uses [1] for NO top-left, [0] for NC bottom-left, [2] for Common right)
|
||||||
|
terminal_names.clear();
|
||||||
|
terminal_names << nc_name << no_name << common_name;
|
||||||
|
}
|
||||||
|
|
||||||
int offset = m_drawed_contacts*10;
|
int offset = m_drawed_contacts*10;
|
||||||
QRectF bounding_rect = QRectF(0, offset, 24, 10);
|
QRectF bounding_rect = QRectF(0, offset, 24, 10);
|
||||||
|
|
||||||
@@ -656,10 +841,8 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
|
|||||||
|
|
||||||
// Draw terminal names on each side of the contact symbol
|
// Draw terminal names on each side of the contact symbol
|
||||||
// terminal_names[0] on the left, terminal_names[1] on the right
|
// terminal_names[0] on the left, terminal_names[1] on the right
|
||||||
if (!terminal_names.isEmpty()) {
|
if (!terminal_names.isEmpty() && m_properties.showTerminalName()) {
|
||||||
QFont font = QETApp::diagramTextsFont(4);
|
painter.setFont(QETApp::diagramTextsFont(4));
|
||||||
font.setBold(true);
|
|
||||||
painter.setFont(font);
|
|
||||||
QRectF bt(0, offset, 24, 10);
|
QRectF bt(0, offset, 24, 10);
|
||||||
if (terminal_names.size() >= 1)
|
if (terminal_names.size() >= 1)
|
||||||
painter.drawText(bt, Qt::AlignLeft|Qt::AlignTop, terminal_names[0]);
|
painter.drawText(bt, Qt::AlignLeft|Qt::AlignTop, terminal_names[0]);
|
||||||
@@ -744,14 +927,8 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
|
|||||||
painter.drawText(text_rect, Qt::AlignLeft | Qt::AlignVCenter, str);
|
painter.drawText(text_rect, Qt::AlignLeft | Qt::AlignVCenter, str);
|
||||||
bounding_rect = bounding_rect.united(text_rect);
|
bounding_rect = bounding_rect.united(text_rect);
|
||||||
|
|
||||||
if (m_hovered_contacts_map.contains(elmt))
|
if (m_update_map)
|
||||||
{
|
|
||||||
m_hovered_contacts_map.insert(elmt, bounding_rect);
|
m_hovered_contacts_map.insert(elmt, bounding_rect);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_hovered_contacts_map.insert(elmt, bounding_rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
++m_drawed_contacts;
|
++m_drawed_contacts;
|
||||||
}
|
}
|
||||||
@@ -787,21 +964,19 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
|
|||||||
// terminal_names[0] = NO side (top left)
|
// terminal_names[0] = NO side (top left)
|
||||||
// terminal_names[1] = NC side (bottom left)
|
// terminal_names[1] = NC side (bottom left)
|
||||||
// terminal_names[2] = common side (right)
|
// terminal_names[2] = common side (right)
|
||||||
if (!terminal_names.isEmpty()) {
|
if (!terminal_names.isEmpty() && m_properties.showTerminalName()) {
|
||||||
QFont font = QETApp::diagramTextsFont(4);
|
painter.setFont(QETApp::diagramTextsFont(4));
|
||||||
font.setBold(true);
|
|
||||||
painter.setFont(font);
|
|
||||||
// Sort order from parseTerminal (top->bottom, left->right):
|
// Sort order from parseTerminal (top->bottom, left->right):
|
||||||
// [0]=12 (NO, top-left), [1]=14 (common, top-center), [2]=13 (NC, bottom-center)
|
// [0]=12 (NO, top-left), [1]=14 (common, top-center), [2]=13 (NC, bottom-center)
|
||||||
if (terminal_names.size() >= 1)
|
if (terminal_names.size() >= 1)
|
||||||
painter.drawText(QRectF(0, offset, 8, 8),
|
painter.drawText(QRectF(0, offset, 8, 8),
|
||||||
Qt::AlignLeft|Qt::AlignTop, terminal_names[0]); // 12 NO left
|
Qt::AlignLeft|Qt::AlignTop, terminal_names[1]); // 12 NO left
|
||||||
if (terminal_names.size() >= 2)
|
if (terminal_names.size() >= 2)
|
||||||
painter.drawText(QRectF(16, offset+4, 8, 6),
|
painter.drawText(QRectF(16, offset+4, 8, 6),
|
||||||
Qt::AlignRight|Qt::AlignTop, terminal_names[1]); // 14 common right
|
Qt::AlignRight|Qt::AlignTop, terminal_names[2]); // 14 common right
|
||||||
if (terminal_names.size() >= 3)
|
if (terminal_names.size() >= 3)
|
||||||
painter.drawText(QRectF(0, offset+9, 8, 6),
|
painter.drawText(QRectF(0, offset+9, 8, 6),
|
||||||
Qt::AlignLeft|Qt::AlignTop, terminal_names[2]); // 13 NC left-bottom
|
Qt::AlignLeft|Qt::AlignTop, terminal_names[0]); // 13 NC left-bottom
|
||||||
painter.setFont(QETApp::diagramTextsFont(5));
|
painter.setFont(QETApp::diagramTextsFont(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -836,12 +1011,8 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
|
|||||||
str);
|
str);
|
||||||
bounding_rect = bounding_rect.united(text_rect);
|
bounding_rect = bounding_rect.united(text_rect);
|
||||||
|
|
||||||
if (m_hovered_contacts_map.contains(elmt)) {
|
if (m_update_map)
|
||||||
m_hovered_contacts_map.insert(elmt, bounding_rect);
|
m_hovered_contacts_map.insert(elmt, bounding_rect);
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_hovered_contacts_map.insert(elmt, bounding_rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
//a switch contact take place of two normal contact
|
//a switch contact take place of two normal contact
|
||||||
m_drawed_contacts += 2;
|
m_drawed_contacts += 2;
|
||||||
@@ -872,12 +1043,8 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
|
|||||||
str);
|
str);
|
||||||
bounding_rect = bounding_rect.united(text_rect);
|
bounding_rect = bounding_rect.united(text_rect);
|
||||||
|
|
||||||
if (m_hovered_contacts_map.contains(elmt)) {
|
if (m_update_map)
|
||||||
m_hovered_contacts_map.insert(elmt, bounding_rect);
|
m_hovered_contacts_map.insert(elmt, bounding_rect);
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_hovered_contacts_map.insert(elmt, bounding_rect);
|
|
||||||
}
|
|
||||||
++m_drawed_contacts;
|
++m_drawed_contacts;
|
||||||
}
|
}
|
||||||
return bounding_rect;
|
return bounding_rect;
|
||||||
@@ -903,7 +1070,60 @@ void CrossRefItem::fillCrossRef(QPainter &painter)
|
|||||||
m_hovered_contact == elmt ? pen.setColor(Qt::blue) :pen.setColor(Qt::black);
|
m_hovered_contact == elmt ? pen.setColor(Qt::blue) :pen.setColor(Qt::black);
|
||||||
painter.setPen(pen);
|
painter.setPen(pen);
|
||||||
|
|
||||||
|
// Collect terminal names for NO column.
|
||||||
|
// Power: all terminals sorted numerically.
|
||||||
|
// SW with typed terminals: NO+Common pair.
|
||||||
|
// Others: first 2 named terminals.
|
||||||
|
const bool is_power_no =
|
||||||
|
elmt->kindInformations()["type"].toString() == "power";
|
||||||
|
const bool is_sw_no =
|
||||||
|
elmt->kindInformations()["state"].toString() == "SW";
|
||||||
|
QStringList tnames;
|
||||||
|
if (is_sw_no) {
|
||||||
|
bool has_typed = false;
|
||||||
|
for (Terminal *t : elmt->terminals()) {
|
||||||
|
if (!t) continue;
|
||||||
|
if (t->terminalType() == TerminalData::No ||
|
||||||
|
t->terminalType() == TerminalData::Nc ||
|
||||||
|
t->terminalType() == TerminalData::Common) {
|
||||||
|
has_typed = true; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (has_typed) {
|
||||||
|
QString no_name, common_name;
|
||||||
|
for (Terminal *t : elmt->terminals()) {
|
||||||
|
if (!t) continue;
|
||||||
|
if (!t->name().isEmpty()) {
|
||||||
|
if (t->terminalType() == TerminalData::No) no_name = t->name();
|
||||||
|
else if (t->terminalType() == TerminalData::Common) common_name = t->name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tnames << no_name << common_name;
|
||||||
|
} else {
|
||||||
|
for (Terminal *t : elmt->terminals()) {
|
||||||
|
if (!t) continue;
|
||||||
|
const QString tn = t->name();
|
||||||
|
if (!tn.isEmpty()) { tnames << tn; if (tnames.size() >= 2) break; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (Terminal *t : elmt->terminals()) {
|
||||||
|
if (!t) continue;
|
||||||
|
const QString tn = t->name();
|
||||||
|
if (!tn.isEmpty()) {
|
||||||
|
tnames << tn;
|
||||||
|
if (!is_power_no && tnames.size() >= 2) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QString terminal_label;
|
||||||
|
if (!tnames.isEmpty() && m_properties.showTerminalName())
|
||||||
|
terminal_label = QStringLiteral("[") + tnames.join("-") + QStringLiteral("]");
|
||||||
|
|
||||||
QString str = elementPositionText(elmt, true);
|
QString str = elementPositionText(elmt, true);
|
||||||
|
if (!terminal_label.isEmpty())
|
||||||
|
str = terminal_label + QStringLiteral(" ") + str;
|
||||||
|
|
||||||
QRectF bounding = painter.boundingRect(
|
QRectF bounding = painter.boundingRect(
|
||||||
QRectF(no_top_left,
|
QRectF(no_top_left,
|
||||||
QSize(middle_cross, 1)),
|
QSize(middle_cross, 1)),
|
||||||
@@ -911,13 +1131,11 @@ void CrossRefItem::fillCrossRef(QPainter &painter)
|
|||||||
str);
|
str);
|
||||||
painter.drawText(bounding, Qt::AlignLeft, str);
|
painter.drawText(bounding, Qt::AlignLeft, str);
|
||||||
|
|
||||||
if (m_hovered_contacts_map.contains(elmt))
|
if (m_update_map) {
|
||||||
{
|
QString pos_str = elementPositionText(elmt, true);
|
||||||
m_hovered_contacts_map.insert(elmt, bounding);
|
QRectF pos_rect = painter.boundingRect(bounding, Qt::AlignRight, pos_str);
|
||||||
}
|
pos_rect.adjust(-2, -1, 2, 1); // extend hit area slightly
|
||||||
else
|
m_hovered_contacts_map.insert(elmt, pos_rect);
|
||||||
{
|
|
||||||
m_hovered_contacts_map.insert(elmt, bounding);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
no_top_left.ry() += bounding.height();
|
no_top_left.ry() += bounding.height();
|
||||||
@@ -932,7 +1150,60 @@ void CrossRefItem::fillCrossRef(QPainter &painter)
|
|||||||
:pen.setColor(Qt::black);
|
:pen.setColor(Qt::black);
|
||||||
painter.setPen(pen);
|
painter.setPen(pen);
|
||||||
|
|
||||||
|
// Collect terminal names for NC column.
|
||||||
|
// Power: all terminals sorted numerically.
|
||||||
|
// SW with typed terminals: NC+Common pair.
|
||||||
|
// Others: first 2 named terminals.
|
||||||
|
const bool is_power_nc =
|
||||||
|
elmt->kindInformations()["type"].toString() == "power";
|
||||||
|
const bool is_sw_nc =
|
||||||
|
elmt->kindInformations()["state"].toString() == "SW";
|
||||||
|
QStringList tnames_nc;
|
||||||
|
if (is_sw_nc) {
|
||||||
|
bool has_typed = false;
|
||||||
|
for (Terminal *t : elmt->terminals()) {
|
||||||
|
if (!t) continue;
|
||||||
|
if (t->terminalType() == TerminalData::No ||
|
||||||
|
t->terminalType() == TerminalData::Nc ||
|
||||||
|
t->terminalType() == TerminalData::Common) {
|
||||||
|
has_typed = true; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (has_typed) {
|
||||||
|
QString nc_name, common_name;
|
||||||
|
for (Terminal *t : elmt->terminals()) {
|
||||||
|
if (!t) continue;
|
||||||
|
if (!t->name().isEmpty()) {
|
||||||
|
if (t->terminalType() == TerminalData::Nc) nc_name = t->name();
|
||||||
|
else if (t->terminalType() == TerminalData::Common) common_name = t->name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tnames_nc << nc_name << common_name;
|
||||||
|
} else {
|
||||||
|
for (Terminal *t : elmt->terminals()) {
|
||||||
|
if (!t) continue;
|
||||||
|
const QString tn = t->name();
|
||||||
|
if (!tn.isEmpty()) { tnames_nc << tn; if (tnames_nc.size() >= 2) break; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (Terminal *t : elmt->terminals()) {
|
||||||
|
if (!t) continue;
|
||||||
|
const QString tn = t->name();
|
||||||
|
if (!tn.isEmpty()) {
|
||||||
|
tnames_nc << tn;
|
||||||
|
if (!is_power_nc && tnames_nc.size() >= 2) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QString terminal_label;
|
||||||
|
if (!tnames_nc.isEmpty() && m_properties.showTerminalName())
|
||||||
|
terminal_label = QStringLiteral("[") + tnames_nc.join("-") + QStringLiteral("]");
|
||||||
|
|
||||||
QString str = elementPositionText(elmt, true);
|
QString str = elementPositionText(elmt, true);
|
||||||
|
if (!terminal_label.isEmpty())
|
||||||
|
str = terminal_label + QStringLiteral(" ") + str;
|
||||||
|
|
||||||
QRectF bounding = painter.boundingRect(
|
QRectF bounding = painter.boundingRect(
|
||||||
QRectF(nc_top_left,
|
QRectF(nc_top_left,
|
||||||
QSize(middle_cross, 1)),
|
QSize(middle_cross, 1)),
|
||||||
@@ -940,13 +1211,11 @@ void CrossRefItem::fillCrossRef(QPainter &painter)
|
|||||||
str);
|
str);
|
||||||
painter.drawText(bounding, Qt::AlignRight, str);
|
painter.drawText(bounding, Qt::AlignRight, str);
|
||||||
|
|
||||||
if (m_hovered_contacts_map.contains(elmt))
|
if (m_update_map) {
|
||||||
{
|
QString pos_str = elementPositionText(elmt, true);
|
||||||
m_hovered_contacts_map.insert(elmt, bounding);
|
QRectF pos_rect = painter.boundingRect(bounding, Qt::AlignRight, pos_str);
|
||||||
}
|
pos_rect.adjust(-2, -1, 2, 1); // extend hit area slightly
|
||||||
else
|
m_hovered_contacts_map.insert(elmt, pos_rect);
|
||||||
{
|
|
||||||
m_hovered_contacts_map.insert(elmt, bounding);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nc_top_left.ry() += bounding.height();
|
nc_top_left.ry() += bounding.height();
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include <QGraphicsObject>
|
#include <QGraphicsObject>
|
||||||
#include <QMultiMap>
|
#include <QMultiMap>
|
||||||
#include <QPicture>
|
|
||||||
|
|
||||||
class Element;
|
class Element;
|
||||||
class DynamicElementTextItem;
|
class DynamicElementTextItem;
|
||||||
@@ -103,11 +102,11 @@ class CrossRefItem : public QGraphicsObject
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void linkedChanged();
|
void linkedChanged();
|
||||||
void buildHeaderContact();
|
void buildHeaderContact(QPainter &painter, QPointF no_pos, QPointF nc_pos);
|
||||||
void setUpCrossBoundingRect(QPainter &painter);
|
void setUpCrossBoundingRect(QPainter &painter);
|
||||||
void drawAsCross(QPainter &painter);
|
void drawAsCross(QPainter &painter);
|
||||||
void drawAsContacts(QPainter &painter);
|
void drawAsContacts(QPainter &painter);
|
||||||
QRectF drawContact(QPainter &painter, int flags, Element *elmt);
|
QRectF drawContact(QPainter &painter, int flags, Element *elmt, int pole_index = 0);
|
||||||
void fillCrossRef(QPainter &painter);
|
void fillCrossRef(QPainter &painter);
|
||||||
void AddExtraInfo(QPainter &painter, const QString&);
|
void AddExtraInfo(QPainter &painter, const QString&);
|
||||||
QList<Element *> NOElements() const;
|
QList<Element *> NOElements() const;
|
||||||
@@ -117,10 +116,10 @@ class CrossRefItem : public QGraphicsObject
|
|||||||
private:
|
private:
|
||||||
Element *m_element; //element to display the cross reference
|
Element *m_element; //element to display the cross reference
|
||||||
QRectF m_bounding_rect;
|
QRectF m_bounding_rect;
|
||||||
QPicture m_drawing, m_hdr_no_ctc, m_hdr_nc_ctc;
|
|
||||||
QPainterPath m_shape_path;
|
QPainterPath m_shape_path;
|
||||||
XRefProperties m_properties;
|
XRefProperties m_properties;
|
||||||
int m_drawed_contacts;
|
int m_drawed_contacts;
|
||||||
|
bool m_update_map = false;
|
||||||
QMultiMap <Element *, QRectF> m_hovered_contacts_map;
|
QMultiMap <Element *, QRectF> m_hovered_contacts_map;
|
||||||
Element *m_hovered_contact = nullptr;
|
Element *m_hovered_contact = nullptr;
|
||||||
DynamicElementTextItem *m_text = nullptr;
|
DynamicElementTextItem *m_text = nullptr;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include "crossrefitem.h"
|
#include "crossrefitem.h"
|
||||||
#include "element.h"
|
#include "element.h"
|
||||||
#include "elementtextitemgroup.h"
|
#include "elementtextitemgroup.h"
|
||||||
|
#include <QTimer>
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
#include <QDomElement>
|
#include <QDomElement>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
@@ -302,7 +302,8 @@ void DynamicElementTextItem::refreshLabelConnection()
|
|||||||
if ((m_text_from == ElementInfo && m_info_name == "label") ||
|
if ((m_text_from == ElementInfo && m_info_name == "label") ||
|
||||||
(m_text_from == CompositeText && m_composite_text.contains("%{label}")))
|
(m_text_from == CompositeText && m_composite_text.contains("%{label}")))
|
||||||
{
|
{
|
||||||
if(m_parent_element.data()->linkType() & Element::AllReport)
|
if((m_parent_element.data()->linkType() & Element::AllReport) ||
|
||||||
|
m_parent_element.data()->linkType() == Element::ConductorDefinition)
|
||||||
{
|
{
|
||||||
updateReportFormulaConnection();
|
updateReportFormulaConnection();
|
||||||
updateReportText();
|
updateReportText();
|
||||||
@@ -418,7 +419,8 @@ void DynamicElementTextItem::setInfoName(const QString &info_name)
|
|||||||
updateXref();
|
updateXref();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_parent_element && (m_parent_element.data()->linkType() & Element::AllReport)) //special treatment for report
|
if (m_parent_element && ((m_parent_element.data()->linkType() & Element::AllReport) ||
|
||||||
|
m_parent_element.data()->linkType() == Element::ConductorDefinition)) //special treatment for report
|
||||||
{
|
{
|
||||||
if(old_info_name != info_name)
|
if(old_info_name != info_name)
|
||||||
{
|
{
|
||||||
@@ -472,7 +474,8 @@ void DynamicElementTextItem::setCompositeText(const QString &text)
|
|||||||
updateXref();
|
updateXref();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_parent_element && (m_parent_element.data()->linkType() & Element::AllReport)) //special treatment for report
|
if (m_parent_element && ((m_parent_element.data()->linkType() & Element::AllReport) ||
|
||||||
|
m_parent_element.data()->linkType() == Element::ConductorDefinition)) //special treatment for report
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* May be in some case the old and new composite text both have the var %{label},
|
* May be in some case the old and new composite text both have the var %{label},
|
||||||
@@ -726,7 +729,8 @@ QVariant DynamicElementTextItem::itemChange(QGraphicsItem::GraphicsItemChange ch
|
|||||||
if(!m_parent_element.data()->linkedElements().isEmpty())
|
if(!m_parent_element.data()->linkedElements().isEmpty())
|
||||||
masterChanged();
|
masterChanged();
|
||||||
}
|
}
|
||||||
else if(m_parent_element.data()->linkType() & Element::AllReport)
|
else if((m_parent_element.data()->linkType() & Element::AllReport) ||
|
||||||
|
m_parent_element.data()->linkType() == Element::ConductorDefinition)
|
||||||
{
|
{
|
||||||
//Get the report formula, and add connection to keep up to date the formula.
|
//Get the report formula, and add connection to keep up to date the formula.
|
||||||
if (m_parent_element.data()->diagram() && m_parent_element.data()->diagram()->project())
|
if (m_parent_element.data()->diagram() && m_parent_element.data()->diagram()->project())
|
||||||
@@ -1027,7 +1031,8 @@ void DynamicElementTextItem::clearFormulaConnection()
|
|||||||
|
|
||||||
void DynamicElementTextItem::updateReportFormulaConnection()
|
void DynamicElementTextItem::updateReportFormulaConnection()
|
||||||
{
|
{
|
||||||
if(!(m_parent_element.data()->linkType() & Element::AllReport))
|
if(!(m_parent_element.data()->linkType() & Element::AllReport) &&
|
||||||
|
m_parent_element.data()->linkType() != Element::ConductorDefinition)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
removeConnectionForReportFormula(m_report_formula);
|
removeConnectionForReportFormula(m_report_formula);
|
||||||
@@ -1041,7 +1046,8 @@ void DynamicElementTextItem::updateReportFormulaConnection()
|
|||||||
*/
|
*/
|
||||||
void DynamicElementTextItem::updateReportText()
|
void DynamicElementTextItem::updateReportText()
|
||||||
{
|
{
|
||||||
if(!(m_parent_element.data()->linkType() & Element::AllReport))
|
if(!(m_parent_element.data()->linkType() & Element::AllReport) &&
|
||||||
|
m_parent_element.data()->linkType() != Element::ConductorDefinition)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_text_from == ElementInfo && m_info_name == "label")
|
if (m_text_from == ElementInfo && m_info_name == "label")
|
||||||
@@ -1098,7 +1104,10 @@ void DynamicElementTextItem::updateLabel()
|
|||||||
void DynamicElementTextItem::conductorWasAdded(Conductor *conductor)
|
void DynamicElementTextItem::conductorWasAdded(Conductor *conductor)
|
||||||
{
|
{
|
||||||
Q_UNUSED(conductor)
|
Q_UNUSED(conductor)
|
||||||
|
QTimer::singleShot(100, this, [this]() {
|
||||||
setPotentialConductor();
|
setPotentialConductor();
|
||||||
|
conductorPropertiesChanged();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1123,7 +1132,8 @@ void DynamicElementTextItem::conductorWasRemoved(Conductor *conductor)
|
|||||||
*/
|
*/
|
||||||
void DynamicElementTextItem::setPotentialConductor()
|
void DynamicElementTextItem::setPotentialConductor()
|
||||||
{
|
{
|
||||||
if(parentElement() && (parentElement()->linkType() & Element::AllReport))
|
if(parentElement() && ((parentElement()->linkType() & Element::AllReport) || (parentElement()->linkType() == Element::ConductorDefinition) ||
|
||||||
|
parentElement()->linkType() == Element::ConductorDefinition))
|
||||||
{
|
{
|
||||||
if(parentElement()->terminals().isEmpty())
|
if(parentElement()->terminals().isEmpty())
|
||||||
return;
|
return;
|
||||||
@@ -1156,6 +1166,7 @@ void DynamicElementTextItem::setPotentialConductor()
|
|||||||
connect(m_watched_conductor.data(), &Conductor::propertiesChange, this, &DynamicElementTextItem::conductorPropertiesChanged);
|
connect(m_watched_conductor.data(), &Conductor::propertiesChange, this, &DynamicElementTextItem::conductorPropertiesChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
conductorPropertiesChanged();
|
||||||
}
|
}
|
||||||
else //This text haven't got a parent element, then ther isn't a conductor in the potential
|
else //This text haven't got a parent element, then ther isn't a conductor in the potential
|
||||||
{
|
{
|
||||||
@@ -1172,7 +1183,8 @@ void DynamicElementTextItem::setPotentialConductor()
|
|||||||
*/
|
*/
|
||||||
void DynamicElementTextItem::conductorPropertiesChanged()
|
void DynamicElementTextItem::conductorPropertiesChanged()
|
||||||
{
|
{
|
||||||
if(m_parent_element && (m_parent_element.data()->linkType() & Element::AllReport))
|
if(m_parent_element && ((m_parent_element.data()->linkType() & Element::AllReport) || (m_parent_element.data()->linkType() == Element::ConductorDefinition) ||
|
||||||
|
m_parent_element.data()->linkType() == Element::ConductorDefinition))
|
||||||
{
|
{
|
||||||
if(m_text_from == ElementInfo)
|
if(m_text_from == ElementInfo)
|
||||||
{
|
{
|
||||||
@@ -1201,7 +1213,8 @@ QString DynamicElementTextItem::reportReplacedCompositeText() const
|
|||||||
{
|
{
|
||||||
QString string;
|
QString string;
|
||||||
|
|
||||||
if(m_parent_element.data()->linkType() & Element::AllReport)
|
if((m_parent_element.data()->linkType() & Element::AllReport) || (m_parent_element.data()->linkType() == Element::ConductorDefinition) ||
|
||||||
|
m_parent_element.data()->linkType() == Element::ConductorDefinition)
|
||||||
{
|
{
|
||||||
string = m_composite_text;
|
string = m_composite_text;
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include "../qetxml.h"
|
#include "../qetxml.h"
|
||||||
#include "../qetversion.h"
|
#include "../qetversion.h"
|
||||||
#include "qgraphicsitemutility.h"
|
#include "qgraphicsitemutility.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include <QDomElement>
|
#include <QDomElement>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@@ -431,6 +432,11 @@ bool Element::buildFromXml(const QDomElement &xml_def_elmt, int *state)
|
|||||||
m_data.fromXml(xml_def_elmt);
|
m_data.fromXml(xml_def_elmt);
|
||||||
setToolTip(name());
|
setToolTip(name());
|
||||||
|
|
||||||
|
QString my_type_str = xml_def_elmt.attribute(QStringLiteral("link_type"), QStringLiteral("simple"));
|
||||||
|
if (my_type_str == QLatin1String("conductor_definition")) {
|
||||||
|
m_link_type = Element::ConductorDefinition;
|
||||||
|
}
|
||||||
|
|
||||||
//load kind informations
|
//load kind informations
|
||||||
m_kind_informations.fromXml(
|
m_kind_informations.fromXml(
|
||||||
xml_def_elmt.firstChildElement(QStringLiteral("kindInformations")),
|
xml_def_elmt.firstChildElement(QStringLiteral("kindInformations")),
|
||||||
@@ -627,6 +633,9 @@ Terminal *Element::parseTerminal(const QDomElement &dom_element)
|
|||||||
Terminal *new_terminal = new Terminal(data, this);
|
Terminal *new_terminal = new Terminal(data, this);
|
||||||
m_terminals << new_terminal;
|
m_terminals << new_terminal;
|
||||||
|
|
||||||
|
connect(new_terminal, &Terminal::conductorWasAdded, this, &Element::updateConductorTexts);
|
||||||
|
connect(new_terminal, &Terminal::conductorWasRemoved, this, &Element::updateConductorTexts);
|
||||||
|
|
||||||
//Sort from top to bottom and left to right
|
//Sort from top to bottom and left to right
|
||||||
std::sort(m_terminals.begin(),
|
std::sort(m_terminals.begin(),
|
||||||
m_terminals.end(),
|
m_terminals.end(),
|
||||||
@@ -1288,6 +1297,8 @@ QString Element::linkTypeToString() const
|
|||||||
return QStringLiteral("Terminale");
|
return QStringLiteral("Terminale");
|
||||||
case Thumbnail:
|
case Thumbnail:
|
||||||
return QStringLiteral("Thumbnail");
|
return QStringLiteral("Thumbnail");
|
||||||
|
case ConductorDefinition:
|
||||||
|
return QStringLiteral("ConductorDefinition");
|
||||||
default:
|
default:
|
||||||
return QStringLiteral("Unknown");
|
return QStringLiteral("Unknown");
|
||||||
}
|
}
|
||||||
@@ -1555,3 +1566,25 @@ ElementsLocation Element::location() const
|
|||||||
{
|
{
|
||||||
return m_location;
|
return m_location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Element::updateConductorTexts
|
||||||
|
*Slot that is triggered when a cable is *
|
||||||
|
*connected to or disconnected from a terminal on this component.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @brief Element::updateConductorTexts
|
||||||
|
*/
|
||||||
|
void Element::updateConductorTexts()
|
||||||
|
{
|
||||||
|
if (m_link_type != Element::ConductorDefinition) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (DynamicElementTextItem *deti : m_dynamic_text_list) {
|
||||||
|
if (deti) {
|
||||||
|
deti->setPotentialConductor();
|
||||||
|
deti->updateLabel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ class Element : public QetGraphicsItem
|
|||||||
Master = 8,
|
Master = 8,
|
||||||
Slave = 16,
|
Slave = 16,
|
||||||
Terminale = 32,
|
Terminale = 32,
|
||||||
Thumbnail = 64};
|
Thumbnail = 64,
|
||||||
|
ConductorDefinition = 128};
|
||||||
|
|
||||||
Element(const ElementsLocation &location,
|
Element(const ElementsLocation &location,
|
||||||
QGraphicsItem * = nullptr,
|
QGraphicsItem * = nullptr,
|
||||||
@@ -95,6 +96,8 @@ class Element : public QetGraphicsItem
|
|||||||
DynamicElementTextItem *text,
|
DynamicElementTextItem *text,
|
||||||
ElementTextItemGroup *group);
|
ElementTextItemGroup *group);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void updateConductorTexts();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QList<Terminal *> terminals() const;
|
QList<Terminal *> terminals() const;
|
||||||
|
|||||||
@@ -753,6 +753,15 @@ QString Terminal::name() const
|
|||||||
return d->m_name;
|
return d->m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Terminal::terminalType
|
||||||
|
@return the type of this terminal (Generic, Inner, Outer, No, Nc, Common)
|
||||||
|
*/
|
||||||
|
TerminalData::Type Terminal::terminalType() const
|
||||||
|
{
|
||||||
|
return d->m_type;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Conductor::relatedPotentialTerminal
|
@brief Conductor::relatedPotentialTerminal
|
||||||
Return terminal at the same potential from the same
|
Return terminal at the same potential from the same
|
||||||
|
|||||||