Compare commits

..

73 Commits

Author SHA1 Message Date
Laurent Trinques
8307008daa Update packaging_script_AppImage_aarch64.sh
Some checks failed
Auto-build doxygen docs / doxygen (push) Has been cancelled
Auto-build doxygen docs / deploy (push) Has been cancelled
2026-01-11 14:00:26 +01:00
Laurent Trinques
a9b30ff71e Update packaging_script_AppImage_aarch64.sh 2026-01-11 10:28:14 +01:00
Laurent Trinques
87c2480ebc Update packaging_script_AppImage_aarch64.sh 2026-01-11 10:26:41 +01:00
Laurent Trinques
5e41ec415e Update aboutqetdialog.cpp
Some checks failed
Auto-build doxygen docs / doxygen (push) Has been cancelled
Auto-build doxygen docs / deploy (push) Has been cancelled
2026-01-08 11:03:33 +01:00
Laurent Trinques
fa6e3d31eb Update dxftoelmt.cpp 2026-01-08 11:01:29 +01:00
Int-Circuit
47d391c26b fix incorrect token in workflow
Some checks failed
Auto-build doxygen docs / doxygen (push) Has been cancelled
Auto-build doxygen docs / deploy (push) Has been cancelled
Fixed error in doxygen workflow, see https://github.com/qelectrotech/qelectrotech-source-mirror/issues/414#issue-3781358507
2026-01-05 13:58:56 +01:00
Laurent Trinques
033c92257e Update ChangeLog 2026-01-05 13:41:18 +01:00
Laurent Trinques
2b18d93d43 Update auto-doxygen.yml 2026-01-05 13:31:11 +01:00
Laurent Trinques
36463542ab Merge pull request #389 from Int-Circuit/doxygen
Added updated automatic doxygen build on push +  theme to make it fit with docs page
2026-01-05 13:15:31 +01:00
Int-Circuit
152b20899c Merge branch 'qelectrotech:master' into doxygen 2026-01-02 10:45:18 +01:00
Laurent Trinques
765f0087fc git submodule update --remote elements 2026-01-01 12:11:34 +01:00
Laurent Trinques
42037f7f9a Merge pull request #412 from Int-Circuit/doc-cleanup
Delete outdated QET docs
2025-12-31 20:14:09 +01:00
Int-Circuit
7df37ab9b5 remove old docs 2025-12-31 13:03:57 +01:00
Int-Circuit
f47143dd6f Merge branch 'qelectrotech:master' into doxygen 2025-12-28 17:43:17 +01:00
Int-Circuit
0d5373d640 restrict action to master 2025-12-28 17:42:27 +01:00
Int-Circuit
506565489f cleaned location of doxygen html theme
fix branch
2025-12-28 17:42:27 +01:00
Int-Circuit
8a2e0a585c Doxygen mr (#9)
Contribute QT help file with a MR
2025-12-28 17:42:27 +01:00
Int-Circuit
40744ba41a remove test branch 2025-12-28 17:42:27 +01:00
Int-Circuit
94269afc76 push QCH file only if MR is accepted
fix errors due to github conflict editor being crappy
2025-12-28 17:42:27 +01:00
Int-Circuit
73e673ef8a adding Auto Push support (#2)
* added deb build CI/CD + setup gitignore on local build/ dir

* added exception for test on branch

* fix image selection

* added XML option to Doxyfile + artifact output

* updated doxygen version

* added ci for doxygen

* added diff + fix action directory

* remove working dir option

* switch to atest doxygen version

* added  aterfact upload

* added deployment step in ci + doxygen theme

* separated setup and doxygen step

* added correct path for dox build

* switch to docker action

* return to binary package

* dummy commit for pages

* swithced to upload-pages-artifact

* fixed typo not fetching submodules + pointing to correct doxygen theme as changes to it are in repo

* separate deb build to ci/cd branch for future MR

* remove debug log

* changed location of generation of .qch file

* adding sync

* collapse sync in one file

* added auto MR CI

* using checkout to push

* added test to downloaded dir

* fix add path

* check if file is marked as modified

* added path info

* drop artifact method

* fix path

* removed checkout clearing the repo

* force to pass gitignore filter

* setting up git lfs

* Push updated QCH file

* removed branch testing

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

fixed action error due to rebasing
2025-12-28 17:42:27 +01:00
Int-Circuit
fb41b50e37 Merge branch 'qelectrotech:master' into doxygen 2025-12-28 17:42:27 +01:00
Int-Circuit
2ebc3a6054 changed location of generation of .qch file 2025-12-28 17:42:27 +01:00
Int-Circuit
bb74f822d7 swithced to upload-pages-artifact
fixed typo not fetching submodules + pointing to correct doxygen theme as changes to it are in repo

remove debug log
2025-12-28 17:42:27 +01:00
Int-Circuit
70dbc9cbad added correct path for dox build
switch to docker action

return to binary package

dummy commit for pages
2025-12-28 17:42:24 +01:00
Int-Circuit
bd5f4f4f96 separated setup and doxygen step 2025-12-28 17:39:35 +01:00
Int-Circuit
179a9db0cb added deployment step in ci + doxygen theme 2025-12-28 17:39:35 +01:00
Int-Circuit
34ee4ebf49 added aterfact upload 2025-12-28 17:39:35 +01:00
Int-Circuit
da661b0d4f switch to atest doxygen version 2025-12-28 17:39:35 +01:00
Int-Circuit
1625692ddd added ci for doxygen
added diff + fix action directory

remove working dir option
2025-12-28 17:39:33 +01:00
Int-Circuit
4fc2ce8d9e updated doxygen version 2025-12-28 10:48:50 +01:00
plc-user
0663aa55e8 find an appropriate font-family if selected font is not available 2025-12-17 09:56:53 +01:00
plc-user
67185f173e also limit size of generalconfig-dialog 2025-12-17 09:46:53 +01:00
plc-user
2c5e5c6b78 improve maximum config-dialog-size (no QT5 version-check needed) 2025-12-15 22:28:40 +01:00
plc-user
689b101c55 better solution for maximum config-dialog-size 2025-12-15 15:29:47 +01:00
plc-user
3aa760e3cd enlarge icons in config-page only for screen-sizes larger than Full-HD 2025-12-14 19:27:28 +01:00
plc-user
82f3167d40 unify code-style a bit 2025-12-14 19:26:29 +01:00
plc-user
5b2c861d02 reduce maximum size of config-dialog 2025-12-14 19:26:02 +01:00
Laurent Trinques
ca8f4650a3 revert snapcraft.yaml
Installing build-snaps
Failed to install or refresh snap 'kde-qt5-core22-sdk'.
'kde-qt5-core22-sdk' does not exist or is not available on channel 'latest/stable'.
Use `snap info kde-qt5-core22-sdk` to get a list of channels the snap is available on.
Full execution log: '/root/.local/state/snapcraft/log/snapcraft-20251214-140707.644603.log'
Build failed
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lpbuildd/target/build_snap.py", line 322, in run
    self.pull()
  File "/usr/lib/python3/dist-packages/lpbuildd/target/build_snap.py", line 249, in pull
    self.run_build_command(
  File "/usr/lib/python3/dist-packages/lpbuildd/target/operation.py", line 70, in run_build_command
    return self.backend.run(args, cwd=cwd, env=full_env, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/lpbuildd/target/lxd.py", line 736, in run
    subprocess.check_call(cmd, **kwargs)
  File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
2025-12-14 15:14:07 +01:00
Laurent Trinques
e7f55ee843 Try to fix snapcraft amr64 build on https://snapcraft.io/ 2025-12-14 14:54:38 +01:00
Laurent Trinques
cdc747548d git submodule update --remote elements 2025-12-12 16:46:31 +01:00
Laurent Trinques
6038db5c40 Update Catalan translations, thanks Antoni 2025-12-12 12:22:12 +01:00
joshua
a9632600b6 fix [diagram editor] : fix crash on search and replace widget
Qet crash when double click on an element/text/conductor in the tree
widget of the search and replace widget and the item is deleted from
diagram. (Call of Diagram::showme to a nullptr).
2025-12-01 12:23:22 +01:00
joshua
4e695de914 chore : Add message box for advise use hpdi round factor is unsafe
Add a message box to advise user that use a hdpi round factor can cause
strange render according to :
1 - the selected value
2 - the dpi of the screen
3 - Edit the project on another computer and/or screen who don't have
the same parameters as point 1 and 2.
2025-11-14 21:23:29 +01:00
plc-user
3803834d6d re-add deleted paragraph and sort language entries alphabetically 2025-11-04 21:17:23 +01:00
Laurent Trinques
78a26f9175 Update Catalan Translation, thanks Antoni 2025-11-04 15:06:07 +01:00
Laurent Trinques
a990daaf9e Update Catalan translation, thanks Antoni 2025-10-31 10:04:18 +01:00
plc-user
3b7a8a17e4 update "osifont.ttf" from upstream 2025-10-30 18:26:03 +01:00
Laurent Trinques
9e78dc56a8 git submodule update --remote elements 2025-10-28 13:25:44 +01:00
joshua
3cf9095899 refactor[diagram editor] close bug.
Close bug report #324
https://qelectrotech.org/bugtracker/view.php?id=324

See commit #1b671990ee8435616725afdffba438fdfcd18069
2025-10-20 23:31:48 +02:00
joshua
3a1398d752 refactor[diagram editor]: remove unused include 2025-10-20 23:09:03 +02:00
joshua
67a7d277f4 refactor(diagram editor) : remove unused code 2025-10-20 23:02:52 +02:00
joshua
e26f7fdaaa refactor[deiagram editor]: mutualize code.
The features used to jump to linked element and xref now use the same
function.
2025-10-20 22:58:12 +02:00
joshua
f74fed9f3f refactor(diagram editor): remove unused checkbox
Remove the checkbox "export terminal in nomenclature" in the general
configuration page because it's a dead code.
2025-10-20 22:10:39 +02:00
plc-user
410c9293d1 adjust variable-names and comments; minor change in length-compare of conductor-segments 2025-10-19 15:48:03 +02:00
plc-user
07c34d7358 add and correct English comments 2025-10-19 15:37:07 +02:00
plc-user
6d7d1ea23b NamesList: Set empty string for name, when no name is set
This should fix an issue with empty fields in titleblocks.
2025-10-19 15:09:24 +02:00
Laurent Trinques
58339f9016 Fix copyright years 2025-10-17 09:58:39 +02:00
joshua
f83a5b3a79 Merge branch 'terminal_strip' 2025-10-15 23:30:54 +02:00
joshua
7e5d41b474 Terminal strip Xref is clickable
When user hover the Xref string of a terminal, the string color change
to blue to advise user the xref is clickable. Double click on the blue
Xref go the folio of the terminal and zoom the view to the terminal.
2025-10-14 22:12:38 +02:00
joshua
f0ec416a91 Terminal strip graphic item can display Xref of terminal 2025-10-03 21:49:21 +02:00
joshua
f6ba47277d Minor : revamp
Use QGIUtility::drawBoundingRectSelection for draw the selection rect
of element instead of a method of the element itself.
Less code.
2025-10-02 21:52:40 +02:00
joshua
74b55f3bf5 Disable deletion if a terminal can't be deleted.
In case of user try to delete a terminal element who is bridged
or belong to a physical terminal with more than one level, the deletion
is aborted to avoid mistake in the terminal strip parent of the terminal
element. A dialog is opened when the deletion can't be to explain to
user what to do for enable the deletion.
2025-07-24 22:24:15 +02:00
joshua
a121fbe530 Add undo / redo command
The undo/redo command of diagram editor is
shared to the terminal strip editor.
2025-07-01 23:37:16 +02:00
joshua
a2ae8255ac Minor fix
During the development, we saved some terminal strip with "phantom"
terminal (terminal added to the strip and after the terminal was removed
from the project but keep in the terminal strip data) and this mistake
was saved in the xml. When we open this project the phantom terminal
don't appear in the layout but the empty physical terminal is still here
in the terminal strip data because the position of the terminals in the
strip is wrong (sometime bigger than the size of the strip, sometime
with a gap, sometime don't start at 0). This commit fix this mistake
when we open a project.
2025-07-01 22:46:18 +02:00
joshua
d711d8fb4a Terminal strip editor can now edit multiple project.
Before this this commit the terminal strip editor couldn't only work on
the first project opened into this editor, all other project opened
after couldn't be edited.
This is now past, terminal strip editor can now edit every project open
in QElectroTech.
2025-06-11 22:43:41 +02:00
joshua
3a6b4807db Fix crash.
Fix crash when :
1°-Open a project with terminal strip and open the terminal strip editor
2°-Close the terminal strip editor and the project (keep qelectrotech
open).
3°-redo step 1 and click on an item in the tree at left of the window,
qet crash.

Qet don't crash anymore but the terminal strip editor continue to work
with the terminal strip of the first opening (exactly the pointer of the
terminal strip) who don't exist anymore. Need more work.
2025-06-09 21:35:00 +02:00
joshua
d699faf501 Change some int to qreal
Made this change to be more compliant with svg
2025-06-08 21:40:32 +02:00
joshua
95e401a266 Class TerminalStripLayoutPattern can be save/load from xml
Add a new class TerminalStripLayoutPatternXml used to
save / load a TerminalStripLayoutPattern class into a xml.

Also create the namespace QETSVG used to read/write some
svg element / attribute to xml. This class is used by the
class TerminalStripLayoutPatternXml.
2025-06-05 23:04:56 +02:00
joshua
2c1b840f9c Use same properties for every terminal level
Initially it was planned to have separate text configuration for every
terminal level. It's not useful, use same properties for every level is
sufficient and visually more consistent.
By consequent every QVector related to these properties was replaced by
a single value.
2025-03-12 21:48:18 +01:00
joshua
2d89d70682 Add possibility to adjust terminal text position
The bounding rectangle used to define the position of the terminal text
can be edited. The y position and height can now be edited. The width is
not editable because is always the width of the rectangle of the of the
terminal.
2025-03-12 21:10:16 +01:00
joshua
7747223dfa Terminal strip item font is editable
The font used in the terminal strip item can be edited
trough the terminal strip layout editor widget
2025-03-12 19:22:30 +01:00
joshua
ae5e188866 Add converter for dpi to pixel font size
Add a little function used to convert if needed the size of a font set
in dpi to pixel. Because the conversion from pdi to pixel can't
be exactly identical, the text size in the diagram can be a little
different, in the other side the switch between screens with different
dpi is no more a problem.
2025-03-12 19:14:45 +01:00
joshua
4ca0bbf682 Minor
Add more help line for the preview of terminal strip configurator
2024-11-07 18:48:53 +01:00
107 changed files with 10037 additions and 3605 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
*.qch filter=lfs diff=lfs merge=lfs -text

68
.github/workflows/auto-doxygen.yml vendored Normal file
View File

@@ -0,0 +1,68 @@
name: Auto-build doxygen docs
on:
push:
branches:
- master
jobs:
doxygen:
permissions:
contents: write
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
show-progress: ''
- name: Setup and run doxygen
run: sudo apt install doxygen graphviz qhelpgenerator-qt5 -y
- name: Set up Git LFS
run: |
git lfs install
git lfs track "*.qch"
- name: Run doxygen
run: doxygen Doxyfile
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.MR_TOKEN }}
commit-message: update QCH file
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
title: Update QCH Help file
body: |
- Updating QT Help file following commit ${{ github.sha }}.
- Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
branch: update-qch
labels: |
qch
cicd
delete-branch: true
add-paths: doc/*.qch
- uses: actions/upload-pages-artifact@v3
with:
path: ${{ github.workspace }}/doc/html/
deploy:
# Add a dependency to the build job
needs: doxygen
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action

4
.gitignore vendored
View File

@@ -3,5 +3,7 @@
# Qt build output
*.user
# doxygen Doxyfile output
doc/
doc/*
!doc/QElectroTech.qch
QElectroTech.tag
!doc/doc-utils

3
.gitmodules vendored
View File

@@ -8,3 +8,6 @@
path = elements
url = https://github.com/qelectrotech/qelectrotech-elements.git
[submodule "doxygen-awesome-css"]
path = doxygen-awesome-css
url = https://github.com/jothepro/doxygen-awesome-css.git

30
CREDIT
View File

@@ -1,3 +1,33 @@
[ca]
Gràcies a Qt Software per la biblioteca Qt ( http://www.qtsoftware.com/ ), amb llicència GNU/GPL.
Gràcies al projecte KDE ( http://www.kde.org/ ).
Gràcies a Loic per les seves explicacions d'ordre matemàtic.
Gràcies a Remi Collet pels paquets Fedora.
Gràcies a Laurent Trinques pels paquets Debian.
Gràcies a `trem' pels paquets Mandriva.
Gràcies a TuxFamily ( http://tuxfamily.org/ ) per a l'allotjament del projecte.
Gràcies a `Nishiki' pels seus elements i el seu suport suport.
Gràcies a qtcentre.org per la seva classe SingleApplication.
Gràcies a Alfredo Carreto per les seves traduccions i correccions al castellà ( http://electronicosmx.net )
Gràcies a 'Dr.Slump' et Sivio pour leurs traductions a l'italià
Gràcies a Jose Carlos Martins per les seves traduccions al portuguès
Gràcies a Pavel Fric per les seves traduccions al txec
Gràcies a Pawel Smiech per les seves traduccions al polonès
Gràcies a Yuriy Litkevich per les seves traduccions al rus
Gràcies a Youssef Ouamalkran i Antoni Mirabete per les seves traduccions al català
Gràcies a Gabi Mandoc per les seves traduccions al romanès
Gràcies a Markus Budde i Jonas Stein et Noah Braden per les seves traduccions a l'alemany
Gràcies a Mohamed Souabni per les seves traduccions a l'àrab
Gràcies a Uroš Platiše per les seves traduccions a l'eslovè
Gràcies a Antun Marakovic per les seves traduccions al croat
Gràcies a Nikos Papadopoylos && Yannis Gyftomitros per les seves traduccions al grec
Gràcies a Markos Chandras pels paquets Gentoo
Gràcies a David pels paquets Slackware
Gràcies a Chipsterjulien pels paquets Archlinux AUR
Gràcies a Elbert de NL pels paquets OS/2
Gràcies a Zloidemon pels paquets (port GCC)
Gràcies a Mrbit per ebuild els paquets Gentoo
[en]
Thanks to Qt Software for their Qt library ( http://www.qtsoftware.com/ ), licensed under GNU/GPL.
Thanks to the KDE project ( http://www.kde.org/ ).

125
ChangeLog
View File

@@ -1,3 +1,128 @@
# QElectroTech - CHANGELOG
## Version 0.100
_Compiled from provided commit logs and contributor notes._
## Overview
This release (v0.100) collects a large set of new features, UI and editor improvements, element and symbol updates, build and packaging fixes, dependency upgrades, translations, and a broad set of bug fixes and stability improvements. It is intended as a stable, feature-rich stepping stone toward the next major workflows for symbol editing, terminal/strip handling and export improvements.
## Highlights / Key Features
- **Terminal Strip / Terminal Strip Editor**
- New TerminalStripItem type and related editor workflow added.
- Support for drawing and displaying terminal bridges and links in the editor.
- Full editor support (layout preview, save/load into .qet files) and undo support for terminal strip operations.
- **New Example Projects**
- Several new example projects included, notably photovoltaic (PV) examples to help users getting started with PV designs.
- **Improved Export / Print Handling**
- Export limits adjusted and better handling of QPainter/printing boundaries to avoid export artefacts and out-of-range errors.
- Export dialog updated to allow larger pixel limits where appropriate.
- **Element & Symbol Additions**
- New elements and symbols added (including vendor-specific elements and additional sensors/Arduino components).
- Improvements to element import & metadata handling.
- **Packaging & Multi-arch Support**
- Updated packaging scripts for AppImage, Flatpak, Snap and macOS deployment. Improved aarch64/arm64 support.
## Detailed Changes
### Editor & UX
- Better handling for **rotation, flip and mirror** operations in the element editor:
- Primitives and text rotation behavior improved.
- Finer rotation increments and predictable text orientation after flips/rotations.
- **Wiring and conductor behavior**:
- More robust creation and movement of wires and conductor bundles.
- Improved text attachment and positioning for wires and improved stability while editing complex conductor networks.
- **TerminalStrip editor**: see Highlights - includes drawing, preview, layout editing, persistent storage in the project file and undo support.
- **Element Editor & Symbol Trim/Sort**:
- Improved trimming/normalization of element metadata.
- Better sorting and error handling for element imports (DXF and other formats).
- Small UI improvements: About dialog updates, autosave spinbox ranges, improved tooltips and mouse-hover help for dynamic texts.
### New & Updated Elements
- New elements added for industrial and automation workflows (including Siemens-related elements, logic elements, sensors and Arduino components).
- Symbol library additions and cleanup; improved defaults for newly added symbols.
- Element meta-data cleanup: article numbers, descriptions, and manufacturer fields were normalized and trimmed on import.
### Export / Printing / PDF
- Adjusted internal export limits to avoid hitting QPainter size restrictions; users can now export larger, high-resolution images/prints in more cases.
- Better handling of page sizes and printer-related geometry using QRectF improvements.
- PDF export improvements to increase reliability of exported vector content.
### Build, Dependencies, Packaging
- Upgrades of core test and build dependencies:
- Catch2 upgraded to v2.13.10.
- googletest upgraded to v1.17.0.
- CMake fixes and i18n handling corrected for nl_BE and other locales.
- Packaging scripts updated across platforms (AppImage/Flatpak/Snap/macOS deploy) including fixes for aarch64/arm64.
- Submodule updates (e.g., qelectrotech-elements, pugixml, SingleApplication) synchronized where needed.
### Internationalization & Translations
- Large translation updates across many languages: German (DE), French (FR), Dutch (NL, including nl_BE), Swedish (SV), Italian (IT), Polish (PL), Portuguese-BR (PT-BR), Serbian (SR), Chinese (Simplified) and others.
- Fixes and corrections for many UI strings and localized resources.
### Tests, QA & Logging
- Improved logging and machine/config-path reporting; Git revision display refined to only show a revision when available.
- Unit test updates and fixes to align with updated testing frameworks.
## Bug Fixes (selected)
- Fixed crashes and various null pointer access issues discovered by static and dynamic testing.
- Resolved multiple reported bugs that caused build failures on some platforms (FTBFS fixes for macOS and others).
- Fixed issues with automatic conductor/strand numbering in several edge cases (referenced Bug 293 in the commit logs).
- Resolved text/summary headline issues in the German-language summary generator.
- Fixes for a number of visually incorrect renderings and layout corner-cases during element transformation (rotate/flip/mirror).
- Fixed issues that affected export sizes and caused export artifacts (referenced fixes for bug IDs around #329/#330 in commit notes).
## Developer & Contributor Notes
- Reworked parts of the codebase to use QRectF consistently for better compatibility with QPrinter and export pipelines.
- Code-style cleanups and comment improvements applied throughout the project.
- Expanded test coverage and dependency refresh to keep CI builds stable.
## Contributors (selected)
Thanks to the many contributors who made this release possible. Selected contributors mentioned in the commit logs include:
- Laurent Trinques
- joshua
- plc-user
- Achim
- Pascal Sander
- Andre Rummler
- Magnus Hellströmer
- Martin Marmsoler
- Remi Collet
(See the full commit history for the complete contributor list.)
## Upgrade / Migration Notes
- No database or project file format breaking changes were reported in the provided logs. As always, back up projects before opening them with a new version.
- If you rely on custom element libraries or third-party submodules, verify submodule synchronization after upgrading.
- If you are using custom packaging pipelines, review the updated packaging scripts for any changes required by new dependency versions, especially on aarch64/arm64.
## Known Issues & Limitations
- Some very large exports may still be limited by platform-specific rendering restrictions; the export dialog now allows larger pixel limits but extreme sizes may still hit system-level limits.
- If you use niche element-import workflows (DXF → element import), occasionally metadata normalization may alter whitespace/trim rules - verify newly imported elements in the element editor.
## How to get help / report bugs
- Use the project issue tracker (see repository) to report regressions or new bugs with detailed reproduction steps and example .qet files where possible.
- Include the output of Help → About (application version and Git revision) when reporting build/packaging issues.
====== ChangeLog from 0.8 to 0.9 ======

1193
Doxyfile

File diff suppressed because it is too large Load Diff

2535
Doxyfile.bak Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -163,6 +163,7 @@ http://creativecommons.org/licenses/by/3.0/ ή στείλτε μια επιστ
Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
[nl]
De elementen collectie voorzien, samen met QElectroTech wordt geleverd als en
zonder enige garantie van geschiktheid voor uw doel of werk.
Het gebruik, de wijziging en de integratie van de elementen in elektrische
@@ -177,7 +178,8 @@ http://creativecommons.org/licenses/by/3.0/ of stuur een brief naar Creative
Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
[be]
De elementen collectie welke samen met QElectroTech wordt geleverd zonder enige garantie
De elementen collectie welke samen met QElectroTech wordt geleverd zonder enige garantie
of deze geschikt zijn voor uw doel of de werking.
Het gebruik, wijzigen en integratie van de elementen in uw elektrische
schema's wordt toegestaan zonder enige voorwaarden, ongeacht wat de uiteindelijke

22
INSTALL
View File

@@ -1,3 +1,14 @@
[ca]
Dependències:
libQt5 (paquets libqt5*)
cupsys-bsd per imprimir
Com compilar:
$ qmake (qmake-qt5 pels sistemes basats en Debian)
$ make
# umask 0022
# make install
[en]
Requirements :
libQt5 (see packages libqt5*)
@@ -64,17 +75,6 @@ $ make
# umask 0022
# make install
[ca]
Dependències:
libQt5 (paquets libqt5*)
cupsys-bsd per imprimir
Com compilar:
$ qmake (qmake-qt5 pels sistemes basats en Debian)
$ make
# umask 0022
# make install
[cs]
Požadavky :
libQt5 (viz balíček libqt5*)

4
README
View File

@@ -1,3 +1,7 @@
[ca]
QElectroTech és una aplicació Qt5 per crear esquemes elèctrics.
QET utilitza el format XML per als seus elements i esquemes i inclou un editor d'esquemes, un editor d'elements i un editor de caixetins.
[en]
QElectroTech is a Qt5 application to design electric diagrams.
It uses XML files for elements and diagrams, and includes both a diagram editor, a element editor, and an titleblock editor.

View File

@@ -1,3 +1,6 @@
[ca]
Col·lecció d'elements per a QElectroTech.
[fr]
Collection d'éléments pour QElectroTech.
@@ -10,6 +13,7 @@ Bauteilsammlung für QElectroTech.
[es]
Collección de elementos para QElectroTech.
[pt]
Colecção de elementos para QElectroTech.

3
doc/QElectroTech.qch Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:56debcb415a5c3662b26ff8765daed9cd53a4c00f0b679a50160ac20d690fcfb
size 528789504

1841
doc/doc-utils/delete_me.css Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
<!-- HTML footer for doxygen 1.12.0-->
<!-- start footer part -->
<!--BEGIN GENERATE_TREEVIEW-->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
$navpath
<li class="footer">$generatedby <a href="https://www.doxygen.org/index.html"><img class="footer" src="$relpath^doxygen.svg" width="104" height="31" alt="doxygen"/></a> $doxygenversion </li>
</ul>
</div>
<!--END GENERATE_TREEVIEW-->
<!--BEGIN !GENERATE_TREEVIEW-->
<hr class="footer"/><address class="footer"><small>
$generatedby&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="$relpath^doxygen.svg" width="104" height="31" alt="doxygen"/></a> $doxygenversion
</small></address>
</div><!-- doc-content -->
<!--END !GENERATE_TREEVIEW-->
</body>
</html>

88
doc/doc-utils/header.html Normal file
View File

@@ -0,0 +1,88 @@
<!-- HTML header for doxygen 1.12.0-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="$langISO">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen $doxygenversion"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
<!--BEGIN PROJECT_ICON-->
<link rel="icon" href="$relpath^$projecticon" type="image/x-icon" />
<!--END PROJECT_ICON-->
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
<!--BEGIN DISABLE_INDEX-->
<!--BEGIN FULL_SIDEBAR-->
<script type="text/javascript">var page_layout=1;</script>
<!--END FULL_SIDEBAR-->
<!--END DISABLE_INDEX-->
<script type="text/javascript" src="$relpath^jquery.js"></script>
<script type="text/javascript" src="$relpath^dynsections.js"></script>
<!--BEGIN COPY_CLIPBOARD-->
<script type="text/javascript" src="$relpath^clipboard.js"></script>
<!--END COPY_CLIPBOARD-->
$treeview
$search
$mathjax
$darkmode
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
$extrastylesheet
<script type="text/javascript" src="$relpath^doxygen-awesome-darkmode-toggle.js"></script>
<script type="text/javascript">
DoxygenAwesomeDarkModeToggle.init()
</script>
<script type="text/javascript" src="$relpath^doxygen-awesome-fragment-copy-button.js"></script>
<script type="text/javascript">
DoxygenAwesomeFragmentCopyButton.init()
</script>
</head>
<body>
<!--BEGIN DISABLE_INDEX-->
<!--BEGIN FULL_SIDEBAR-->
<div id="side-nav" class="ui-resizable side-nav-resizable"><!-- do not remove this div, it is closed by doxygen! -->
<!--END FULL_SIDEBAR-->
<!--END DISABLE_INDEX-->
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!--BEGIN TITLEAREA-->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<!--BEGIN PROJECT_LOGO-->
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"$logosize/></td>
<!--END PROJECT_LOGO-->
<!--BEGIN PROJECT_NAME-->
<td id="projectalign">
<div id="projectname">$projectname<!--BEGIN PROJECT_NUMBER--><span id="projectnumber">&#160;$projectnumber</span><!--END PROJECT_NUMBER-->
</div>
<!--BEGIN PROJECT_BRIEF--><div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->
</td>
<!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME-->
<!--BEGIN PROJECT_BRIEF-->
<td>
<div id="projectbrief">$projectbrief</div>
</td>
<!--END PROJECT_BRIEF-->
<!--END !PROJECT_NAME-->
<!--BEGIN DISABLE_INDEX-->
<!--BEGIN SEARCHENGINE-->
<!--BEGIN !FULL_SIDEBAR-->
<td>$searchbox</td>
<!--END !FULL_SIDEBAR-->
<!--END SEARCHENGINE-->
<!--END DISABLE_INDEX-->
</tr>
<!--BEGIN SEARCHENGINE-->
<!--BEGIN FULL_SIDEBAR-->
<tr><td colspan="2">$searchbox</td></tr>
<!--END FULL_SIDEBAR-->
<!--END SEARCHENGINE-->
</tbody>
</table>
</div>
<!--END TITLEAREA-->
<!-- end header part -->

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

1
doxygen-awesome-css Submodule

Submodule doxygen-awesome-css added at 568f56cde6

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -12,7 +12,7 @@ Keywords=Graphics;Science;Electricity;Engineering;
Comment=Edit electrical diagrams.
Comment[ar]=تحرير مخططات كهربائية
Comment[be]=Bewerken elektrisch schema.
Comment[ca]=Editar esquemes elèctrics.
Comment[ca]=Edita esquemes elèctrics.
Comment[cs]=Editor výkresů elektrických obvodů
Comment[da]=Rediger elektriske diagrammer.
Comment[de]=Elektroschaltpläne erstellen und bearbeiten.
@@ -30,6 +30,7 @@ Comment[sk]=Úprava elektrických schém.
GenericName=Electrical diagram editor
GenericName[ar]=مُحرّر مخططات كهربائية
GenericName[be]=Elektrische schema editor
GenericName[ca]=Editor d'esquemes elèctrics
GenericName[cs]=Editor výkresů elektrických obvodů
GenericName[da]=Elektrisk diagram redigering
GenericName[de]=Schaltplaneditor

View File

@@ -7,20 +7,21 @@
<name>QElectroTech</name>
<summary>Electrical diagram editor</summary>
<summary xml:lang="ar">مُحرّر مخططات كهربائية</summary>
<summary xml:lang="be">Elektrische schema editor</summary>
<summary xml:lang="ca">Editor d'esquemes elèctrics</summary>
<summary xml:lang="cs">Editor výkresů elektrických obvodů</summary>
<summary xml:lang="da">Elektrisk diagram redigering</summary>
<summary xml:lang="de">Zeichenprogramm für Schaltpläne</summary>
<summary xml:lang="el">Επεξεργαστής ηλεκτρικών διαγραμμάτων</summary>
<summary xml:lang="ex">Editor de esquemas eléctricos</summary>
<summary xml:lang="fr">Éditeur de schémas électriques</summary>
<summary xml:lang="hr">Editor elektro sheme</summary>
<summary xml:lang="it">Programma per disegnare schemi elettrici</summary>
<summary xml:lang="ja">電気回路図エディタ</summary>
<summary xml:lang="nl">Elektrische schema bewerker</summary>
<summary xml:lang="pl">Edytor schematów elektrycznych</summary>
<summary xml:lang="pt">Editor de esquemas eléctricos</summary>
<summary xml:lang="ru">Редактор электрических схем</summary>
<summary xml:lang="nl">Elektrische schema bewerker</summary>
<summary xml:lang="be">Elektrische schema editor</summary>
<summary xml:lang="da">Elektrisk diagram redigering</summary>
<summary xml:lang="ja">電気回路図エディタ</summary>
<content_rating type="oars-1.1"/>
<releases>
<release version="0.9-dev" date="2021-02-21"/>
@@ -30,10 +31,22 @@
QElectroTech is a Qt5 application to design electric diagrams.
It uses XML files for elements and diagrams, and includes both a diagram editor, an element editor, and a titleblock editor.
</p>
<p xml:lang="be">
QElectroTech is een Qt5 applicatie om elektrische schema's te ontwerpen.
Het maakt gebruik van XML-bestanden voor elementen en diagrammen, en omvat zowel een diagram bewerker, een element bewerker, en ook een tielbloksjabloon bewerker.
</p>
<p xml:lang="ca">
QElectroTech és una aplicació Qt5 per crear esquemes elèctrics.
QET utilitza el format XML per als seus elements i esquemes i inclou un editor d'esquemes, un editor d'elements i un editor de caixetins.
</p>
<p xml:lang="cs">
QElectroTech je aplikací Qt5 určenou pro návrh nákresů elektrických obvodů.
Pro prvky a nákresy používá soubory XML, a zahrnuje v sobě jak editor nákresů, tak editor prvků.
</p>
<p xml:lang="da">
QElectroTech er et Qt5 program til at redigere elektriske diagrammer.
Det bruger XML filer for symboler og diagrammer og inkluderer diagram, symbol og titelblok redigering.
</p>
<p xml:lang="de">
QElectroTech ist eine Qt5-Anwendung zum Entwerfen von Schaltplänen.
Die Anwendung verwendet XML-Dateien zum Speichern von Projekten und Elementbibliotheken. Neben dem Schaltplaneditor enthält die Anwendung auch Elementeditoren und einen Blattvorlageneditor.
@@ -54,9 +67,13 @@
QElectroTech è una applicazione fatta in Qt5 per disegnare schemi elettrici.
QET usa il formato XML per i suoi elementi e schemi, includendo anche un editor per gli stessi.
</p>
<p xml:lang="ru">
QElectroTech - приложение написанное на Qt5 и предназначено для разработки электрических схем.
Приложение использует для хранения проектов и библиотек элементов файлы в XML формате. Приложение помимо редактора электричесих схем, содержит также редакторы элементов и редактор шаблонов листов.
<p xml:lang="ja">
QElectroTech は電気回路図を作成する Qt5 アプリケーションです。
QET は要素と回路図に XML 形式を利用し、回路図エディタ、要素エディタ、表題欄エディタを含みます。
</p>
<p xml:lang="nl">
QElectroTech is een Qt5 applicatie om elektrische schema's te ontwerpen.
Het maakt gebruik van XML-bestanden voor elementen en diagrammen, en omvat zowel een diagram bewerker, een element bewerker, en een bloksjabloon bewerker.
</p>
<p xml:lang="pl">
QElectroTech to aplikacja napisana w Qt5, przeznaczona do tworzenia schematów elektrycznych.
@@ -66,22 +83,10 @@
QElectroTech é uma aplicação baseada em Qt5 para desenhar esquemas eléctricos.
QET utiliza ficheiros XML para os elementos e para os esquemas e inclui um editor de esquemas e um editor de elementos.
</p>
<p xml:lang="nl">
QElectroTech is een Qt5 applicatie om elektrische schema's te ontwerpen.
Het maakt gebruik van XML-bestanden voor elementen en diagrammen, en omvat zowel een diagram bewerker, een element bewerker, en een bloksjabloon bewerker.
</p>
<p xml:lang="be">
QElectroTech is een Qt5 applicatie om elektrische schema's te ontwerpen.
Het maakt gebruik van XML-bestanden voor elementen en diagrammen, en omvat zowel een diagram bewerker, een element bewerker, en ook een tielbloksjabloon bewerker.
</p>
<p xml:lang="da">
QElectroTech er et Qt5 program til at redigere elektriske diagrammer.
Det bruger XML filer for symboler og diagrammer og inkluderer diagram, symbol og titelblok redigering.
</p>
<p xml:lang="ja">
QElectroTech は電気回路図を作成する Qt5 アプリケーションです。
QET は要素と回路図に XML 形式を利用し、回路図エディタ、要素エディタ、表題欄エディタを含みます。
</p>
<p xml:lang="ru">
QElectroTech - приложение написанное на Qt5 и предназначено для разработки электрических схем.
Приложение использует для хранения проектов и библиотек элементов файлы в XML формате. Приложение помимо редактора электричесих схем, содержит также редакторы элементов и редактор шаблонов листов.
</p>
</description>
<url type="homepage">http://qelectrotech.org</url>
<screenshots>

View File

@@ -1,63 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-qet-project">
<sub-class-of type="text/xml"/>
<comment>QElectroTech project file</comment>
<comment xml:lang="de">QElectroTech Projektdatei</comment>
<comment xml:lang="fr">Fichier projet QElectroTech</comment>
<comment xml:lang="ar">QElectrotech ملف مشروع</comment>
<comment xml:lang="es">Fichero proyecto QElectroTech</comment>
<comment xml:lang="ca">Fitxer projecte QElectroTech</comment>
<comment xml:lang="ru">Файл проекта QElectroTech</comment>
<comment xml:lang="pt">Ficheiro de projecto QElectroTech</comment>
<comment xml:lang="cs">Soubor s projektem pro QElectroTech</comment>
<comment xml:lang="pl">Plik projektu QElectrotech</comment>
<comment xml:lang="it">File del progetto QElectroTech</comment>
<comment xml:lang="el">Αρχείο έργου του QElectroTech</comment>
<comment xml:lang="nl">QElectroTech project bestand</comment>
<comment xml:lang="be">QElectroTech project bestand</comment>
<comment xml:lang="da">QElectroTech projekt fil</comment>
<comment xml:lang="ja">QElectroTech プロジェクト・ファイル</comment>
<glob pattern="*.qet" />
</mime-type>
<mime-type type="application/x-qet-element">
<sub-class-of type="text/xml"/>
<comment>QElectroTech element file</comment>
<comment xml:lang="de">QElectroTech Bauteildatei</comment>
<comment xml:lang="fr">Fichier élément QElectroTech</comment>
<comment xml:lang="ar">QElectrotech ملف مشروع</comment>
<comment xml:lang="ru">Файл элемента QElectroTech</comment>
<comment xml:lang="es">Fichero elemento QElectroTech</comment>
<comment xml:lang="ca">Fitxer símbol QElectroTech</comment>
<comment xml:lang="pt">Ficheiro de projecto QElectroTech</comment>
<comment xml:lang="cs">Soubor s prvkem pro QElectroTech</comment>
<comment xml:lang="pl">Plik elementu QElectroTech</comment>
<comment xml:lang="it">File del progetto QElectroTech</comment>
<comment xml:lang="el">Αρχείο στοιχείου του QElectroTech</comment>
<comment xml:lang="nl">QElectroTech element bestand</comment>
<comment xml:lang="be">QElectroTech element bestand</comment>
<comment xml:lang="da">QElectroTech symbol fil</comment>
<comment xml:lang="ja">QElectroTech 要素ファイル</comment>
<glob pattern="*.elmt" />
</mime-type>
<mime-type type="application/x-qet-titleblock">
<sub-class-of type="text/xml"/>
<comment>QElectroTech title block template file</comment>
<comment xml:lang="de">QElectroTech Schriftfeld Vorlagedatei</comment>
<comment xml:lang="fr">Modèle de cartouche QElectroTech</comment>
<comment xml:lang="ar">QElectrotech نموذج إطار تعريف</comment>
<comment xml:lang="ru">Файл шаблона основной надписи листа QElectroTech</comment>
<comment xml:lang="pl">Szablon tabliczki rysunkowej QElectroTech</comment>
<comment xml:lang="es">Modelo de cartucho QElectroTech</comment>
<comment xml:lang="ca">Model de bloc de títol QElectroTech</comment>
<comment xml:lang="cs">Vzor záhlaví výkresu pro QElectroTech</comment>
<comment xml:lang="pt">Modelo de moldura QElectroTech</comment>
<comment xml:lang="it">Modello di cartiglio per QElectroTech</comment>
<comment xml:lang="el">Πρότυπο πινακίδας του QElectroTech</comment>
<comment xml:lang="nl">QElectroTech titel bloksjabloon</comment>
<comment xml:lang="be">QElectroTech titel bloksjabloon</comment>
<comment xml:lang="da">QElectroTech titelblok skabelon</comment>
<comment xml:lang="ja">QElectroTech 表題欄テンプレート</comment>
<glob pattern="*.titleblock" />
</mime-type>
</mime-info>
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-qet-project">
<sub-class-of type="text/xml"/>
<comment>QElectroTech project file</comment>
<comment xml:lang="ar">QElectrotech ملف مشروع</comment>
<comment xml:lang="be">QElectroTech project bestand</comment>
<comment xml:lang="ca">Fitxer de projecte QElectroTech</comment>
<comment xml:lang="cs">Soubor s projektem pro QElectroTech</comment>
<comment xml:lang="da">QElectroTech projekt fil</comment>
<comment xml:lang="de">QElectroTech Projektdatei</comment>
<comment xml:lang="el">Αρχείο έργου του QElectroTech</comment>
<comment xml:lang="es">Fichero proyecto QElectroTech</comment>
<comment xml:lang="fr">Fichier projet QElectroTech</comment>
<comment xml:lang="it">File del progetto QElectroTech</comment>
<comment xml:lang="ja">QElectroTech プロジェクト・ファイル</comment>
<comment xml:lang="nl">QElectroTech project bestand</comment>
<comment xml:lang="pl">Plik projektu QElectrotech</comment>
<comment xml:lang="pt">Ficheiro de projecto QElectroTech</comment>
<comment xml:lang="ru">Файл проекта QElectroTech</comment>
<glob pattern="*.qet" />
</mime-type>
<mime-type type="application/x-qet-element">
<sub-class-of type="text/xml"/>
<comment>QElectroTech element file</comment>
<comment xml:lang="ar">QElectrotech ملف مشروع</comment>
<comment xml:lang="be">QElectroTech element bestand</comment>
<comment xml:lang="ca">Fitxer d'element QElectroTech</comment>
<comment xml:lang="cs">Soubor s prvkem pro QElectroTech</comment>
<comment xml:lang="da">QElectroTech symbol fil</comment>
<comment xml:lang="de">QElectroTech Bauteildatei</comment>
<comment xml:lang="el">Αρχείο στοιχείου του QElectroTech</comment>
<comment xml:lang="es">Fichero elemento QElectroTech</comment>
<comment xml:lang="fr">Fichier élément QElectroTech</comment>
<comment xml:lang="it">File del progetto QElectroTech</comment>
<comment xml:lang="ja">QElectroTech 要素ファイル</comment>
<comment xml:lang="nl">QElectroTech element bestand</comment>
<comment xml:lang="pl">Plik elementu QElectroTech</comment>
<comment xml:lang="pt">Ficheiro de projecto QElectroTech</comment>
<comment xml:lang="ru">Файл элемента QElectroTech</comment>
<glob pattern="*.elmt" />
</mime-type>
<mime-type type="application/x-qet-titleblock">
<sub-class-of type="text/xml"/>
<comment>QElectroTech title block template file</comment>
<comment xml:lang="ar">QElectrotech نموذج إطار تعريف</comment>
<comment xml:lang="be">QElectroTech titel bloksjabloon</comment>
<comment xml:lang="ca">Model de caixetí QElectroTech</comment>
<comment xml:lang="cs">Vzor záhlaví výkresu pro QElectroTech</comment>
<comment xml:lang="da">QElectroTech titelblok skabelon</comment>
<comment xml:lang="de">QElectroTech Schriftfeld Vorlagedatei</comment>
<comment xml:lang="el">Πρότυπο πινακίδας του QElectroTech</comment>
<comment xml:lang="es">Modelo de cartucho QElectroTech</comment>
<comment xml:lang="fr">Modèle de cartouche QElectroTech</comment>
<comment xml:lang="it">Modello di cartiglio per QElectroTech</comment>
<comment xml:lang="ja">QElectroTech 表題欄テンプレート</comment>
<comment xml:lang="nl">QElectroTech titel bloksjabloon</comment>
<comment xml:lang="pl">Szablon tabliczki rysunkowej QElectroTech</comment>
<comment xml:lang="pt">Modelo de moldura QElectroTech</comment>
<comment xml:lang="ru">Файл шаблона основной надписи листа QElectroTech</comment>
<glob pattern="*.titleblock" />
</mime-type>
</mime-info>

View File

@@ -1,6 +1,6 @@
#!/bin/bash
#Based on raspberry pi 5 8 Gb bookworm
#Based on raspberry pi 5 8 Gb Trixie
#sudo apt install git ssh rsync libqt5svg5-dev qt5-qmake qtbase5-dev libkf5widgetsaddons-dev libkf5coreaddons-dev libsqlite3-dev pkgconf libqt5waylandclient5-dev libqt5waylandcompositor5-dev g++ make
#mkdir -p AppImage/0.100.0/aarch64
# Get GIT sources
@@ -71,12 +71,12 @@ chmod +x AppDir/qelectrotech/AppRun
# Get 64-bit ARM version of go-appimage appimagetool
#wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimagetool-.*-aarch64.AppImage" | head -n 1 | cut -d '"' -f 2)
#chmod +x appimagetool-*.AppImage
VERSION=$tagName-r$HEAD ./appimagetool-8*.AppImage ./AppDir/qelectrotech/
VERSION=$tagName-r$HEAD ./appimagetool-9*.AppImage ./AppDir/qelectrotech/
chmod -x QElectroTech-*.AppImage
shasum -a 256 QElectroTech-$tagName-r$HEAD-aarch64.AppImage > QElectroTech-$tagName-r$HEAD-aarch64.AppImage-SHA256.txt
mv QElectroTech-$tagName-r$HEAD-aarch64.AppImage* ./AppImage/0.100.0/aarch64
mv QElectroTech-$tagName-r$HEAD-aarch64.AppImage* ./AppImage/0.100.0/aarch64/trixie
cd ..
#rsync to server
echo -e "\033[1;31mWould you like to RSYNC Appimage to server n/Y?.\033[m"

View File

@@ -170,7 +170,8 @@ HEADERS += $$files(sources/*.h) \
$$files(sources/TerminalStrip/GraphicsItem/properties/*.h) \
$$files(sources/xml/*.h) \
$$files(sources/dxf/*.h) \
$$files(sources/qet_elementscaler/*.h)
$$files(sources/qet_elementscaler/*.h) \
$$files(sources/svg/*.h)
SOURCES += $$files(sources/*.cpp) \
$$files(sources/editor/*.cpp) \
@@ -213,7 +214,8 @@ SOURCES += $$files(sources/*.cpp) \
$$files(sources/TerminalStrip/GraphicsItem/properties/*.cpp) \
$$files(sources/xml/*.cpp) \
$$files(sources/dxf/*.cpp) \
$$files(sources/qet_elementscaler/*.cpp)
$$files(sources/qet_elementscaler/*.cpp) \
$$files(sources/svg/*.cpp)
# Needed for use promote QTreeWidget in terminalstripeditor.ui
INCLUDEPATH += sources/TerminalStrip/ui

View File

@@ -174,11 +174,9 @@ void NamesList::fromXml(const pugi::xml_node &xml_element, const QHash<QString,
/**
Exports the list of names to an XML element.
Make sure that the list of names is not empty before exporting.
If list is empty, set name to "en" / "NoName"
French:
Exporte la liste des noms vers un element XML. Veillez a verifier que la
liste de noms n'est pas vide avant de l'exporter.
Si la liste est vide, le nom sera "en" / "NoName".
@param xml_document Le document XML dans lequel l'element XML sera insere
@param xml_options A set of options related to XML parsing.
@return L'element XML correspondant a la section "names"
@@ -192,7 +190,7 @@ QDomElement NamesList::toXml(QDomDocument &xml_document, const QHash<QString, QS
qInfo() << " NamesList of element is empty - add default: [" << "en" << "] = " << "NoName" << "";
QDomElement name_elmt = xml_document.createElement(xml_opt["TagName"]);
name_elmt.setAttribute(xml_opt["LanguageAttribute"], "en");
name_elmt.appendChild(xml_document.createTextNode("NoName"));
name_elmt.appendChild(xml_document.createTextNode(" "));
names_elmt.appendChild(name_elmt);
} else {
QMapIterator<QString, QString> names_iterator(map_names);

View File

@@ -961,21 +961,21 @@ void SearchAndReplaceWidget::on_m_tree_widget_itemDoubleClicked(
else if (m_element_hash.keys().contains(item))
{
QPointer<Element> elmt = m_element_hash.value(item);
if (elmt) {
if (elmt && elmt->diagram()) {
elmt.data()->diagram()->showMe();
}
}
else if (m_text_hash.keys().contains(item))
{
QPointer<IndependentTextItem> text = m_text_hash.value(item);
if (text) {
if (text && text->diagram()) {
text.data()->diagram()->showMe();
}
}
else if (m_conductor_hash.keys().contains(item))
{
QPointer<Conductor> cond = m_conductor_hash.value(item);
if (cond) {
if (cond && cond->diagram()) {
cond.data()->diagram()->showMe();
}
}

View File

@@ -35,13 +35,14 @@ namespace TerminalStripDrawer
const QUuid m_uuid;
};
class DemoRealTerminal : public AbstractRealTerminalInterface
{
public:
DemoRealTerminal(const QString &label, const QUuid &bridge) :
class DemoRealTerminal : public AbstractRealTerminalInterface
{
public:
DemoRealTerminal(const QString &label, const QString &xref, const QUuid &bridge) :
m_label { label },
m_xref{ xref },
m_bridge { bridge }
{}
{}
QString label() const override {
return m_label;
@@ -55,10 +56,14 @@ namespace TerminalStripDrawer
return new DemoBridge { m_bridge };
}
private:
QString m_label;
QUuid m_bridge;
};
QString xref() const override {
return m_xref;
}
private:
QString m_label, m_xref;
QUuid m_bridge;
};
class DemoPhysicalTerminal : public AbstractPhysicalTerminalInterface
{
@@ -102,51 +107,63 @@ namespace TerminalStripDrawer
QVector <QSharedPointer<AbstractRealTerminalInterface>> real_terminals_vector;
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
new DemoRealTerminal( QStringLiteral("24vdc"),
lvl_1)};
new DemoRealTerminal( QStringLiteral("24vdc"),
QStringLiteral("1_A1"),
lvl_1)};
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
new DemoRealTerminal( QStringLiteral("0vdc"),
lvl_2)};
new DemoRealTerminal( QStringLiteral("0vdc"),
QStringLiteral("1_A2"),
lvl_2)};
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
new DemoRealTerminal( QStringLiteral("signal"),
lvl_3)};
new DemoRealTerminal( QStringLiteral("signal"),
QStringLiteral("1_A3"),
lvl_3)};
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
new DemoRealTerminal( QStringLiteral("teach"),
lvl_4)};
new DemoRealTerminal( QStringLiteral("teach"),
QStringLiteral("1_A4"),
lvl_4)};
m_physical_terminal << QSharedPointer<AbstractPhysicalTerminalInterface> {
new DemoPhysicalTerminal {real_terminals_vector}};
new DemoPhysicalTerminal {real_terminals_vector}};
real_terminals_vector.clear();
real_terminals_vector.clear();
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
new DemoRealTerminal( QStringLiteral("24vdc"),
lvl_1)};
new DemoRealTerminal( QStringLiteral("24vdc"),
QStringLiteral("2_A1"),
lvl_1)};
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
new DemoRealTerminal( QStringLiteral("0vdc"),
lvl_2)};
new DemoRealTerminal( QStringLiteral("0vdc"),
QStringLiteral("2_A2"),
lvl_2)};
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
new DemoRealTerminal( QStringLiteral("signal"),
lvl_3)};
new DemoRealTerminal( QStringLiteral("signal"),
QStringLiteral("2_A3"),
lvl_3)};
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
new DemoRealTerminal( QStringLiteral("teach"),
lvl_4)};
new DemoRealTerminal( QStringLiteral("teach"),
QStringLiteral("2_A4"),
lvl_4)};
m_physical_terminal << QSharedPointer<AbstractPhysicalTerminalInterface> {
new DemoPhysicalTerminal {real_terminals_vector}};
new DemoPhysicalTerminal {real_terminals_vector}};
real_terminals_vector.clear();
real_terminals_vector.clear();
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
new DemoRealTerminal( QStringLiteral("24vdc"),
lvl_1)};
new DemoRealTerminal( QStringLiteral("24vdc"),
QStringLiteral("3_A1"),
lvl_1)};
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
new DemoRealTerminal( QStringLiteral("0vdc"),
lvl_2)};
new DemoRealTerminal( QStringLiteral("0vdc"),
QStringLiteral("3_A2"),
lvl_2)};
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
new DemoRealTerminal( QStringLiteral("signal"),
lvl_3)};
new DemoRealTerminal( QStringLiteral("signal"),
QStringLiteral("3_A3"),
lvl_3)};
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
new DemoRealTerminal( QStringLiteral("teach"),
lvl_4)};
new DemoRealTerminal( QStringLiteral("teach"),
QStringLiteral("3_A4"),
lvl_4)};
m_physical_terminal << QSharedPointer<AbstractPhysicalTerminalInterface> {
new DemoPhysicalTerminal {real_terminals_vector}};
}
new DemoPhysicalTerminal {real_terminals_vector}};
}
}

View File

@@ -1,5 +1,5 @@
/*
Copyright 2006-2022 The QElectroTech Team
Copyright 2006-2025 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
@@ -16,16 +16,24 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "terminalstriplayoutpattern.h"
#include <QDebug>
#include "../../../utils/qetutils.h"
TerminalStripLayoutPattern::TerminalStripLayoutPattern()
{
m_font.setPixelSize(15);
updateHeaderTextOption();
updateTerminalsTextOption();
}
/**
* @brief TerminalStripLayoutPattern::setHeaderTextAlignment
* Set text alignment to @param alignment. If alignment have no
* flag this function do nothing
* @param alignment
*/
void TerminalStripLayoutPattern::setHeaderTextAlignment(const Qt::Alignment &alignment)
{
if (!alignment) return;
m_header_text_alignment = alignment;
updateHeaderTextOption();
}
@@ -39,22 +47,61 @@ QTextOption TerminalStripLayoutPattern::headerTextOption() const {
return m_header_text_option;
}
void TerminalStripLayoutPattern::setTerminalsTextAlignment(const QVector<Qt::Alignment> &alignment)
QFont TerminalStripLayoutPattern::font() const {
return m_font;
}
void TerminalStripLayoutPattern::setFont(const QFont &font) {
m_font = font;
QETUtils::pixelSizedFont(m_font);
}
/**
* @brief TerminalStripLayoutPattern::setTerminalsTextAlignment
* Set text alignment to @param alignment. If alignment have no
* flag this function do nothing
* @param alignment
*/
void TerminalStripLayoutPattern::setTerminalsTextAlignment(const Qt::Alignment &alignment)
{
if (!alignment) return;
m_terminals_text_alignment = alignment;
updateTerminalsTextOption();
}
QVector<Qt::Alignment> TerminalStripLayoutPattern::terminalsTextAlignment() const
Qt::Alignment TerminalStripLayoutPattern::terminalsTextAlignment() const
{
return m_terminals_text_alignment;
}
QVector<QTextOption> TerminalStripLayoutPattern::terminalsTextOption() const
QTextOption TerminalStripLayoutPattern::terminalsTextOption() const
{
return m_terminals_text_option;
}
/**
* @brief TerminalStripLayoutPattern::setXrefTextAlignment
* Set text alignment to @param alignment. If alignment have no
* flag this function do nothing
* @param alignment
*/
void TerminalStripLayoutPattern::setXrefTextAlignment(const Qt::Alignment &alignment)
{
if (!alignment) return;
m_xref_text_alignment = alignment;
updateTerminalsTextOption();
}
Qt::Alignment TerminalStripLayoutPattern::xrefTextAlignment() const
{
return m_xref_text_alignment;
}
QTextOption TerminalStripLayoutPattern::xrefTextOption() const
{
return m_xref_text_option;
}
void TerminalStripLayoutPattern::updateHeaderTextOption()
{
m_header_text_option.setAlignment(m_header_text_alignment);
@@ -63,16 +110,9 @@ void TerminalStripLayoutPattern::updateHeaderTextOption()
void TerminalStripLayoutPattern::updateTerminalsTextOption()
{
if (m_terminals_text_option.size() ==
m_terminals_text_alignment.size())
{
for (auto i = 0 ; i<m_terminals_text_option.size() ; ++i)
{
m_terminals_text_option[i].setAlignment(m_terminals_text_alignment.at(i));
m_terminals_text_option[i].setWrapMode(QTextOption::WordWrap);
}
}
else {
qDebug() << "TerminalStripLayoutPattern::updateTerminalsTextOption() : Wrong vector size";
}
m_terminals_text_option.setAlignment(m_terminals_text_alignment);
m_terminals_text_option.setWrapMode(QTextOption::WordWrap);
m_xref_text_option.setAlignment(m_xref_text_alignment);
m_xref_text_option.setWrapMode(QTextOption::WordWrap);
}

View File

@@ -1,5 +1,5 @@
/*
Copyright 2006-2022 The QElectroTech Team
Copyright 2006-2025 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
@@ -18,6 +18,7 @@
#ifndef TERMINALSTRIPLAYOUTPATTERN_H
#define TERMINALSTRIPLAYOUTPATTERN_H
#include <QFont>
#include <QRect>
#include <QSize>
#include <QTextOption>
@@ -43,45 +44,46 @@ class TerminalStripLayoutPattern
TerminalStripLayoutPattern();
//Header of terminal strip
QRect m_header_rect{0,30,50,130};
QRectF m_header_rect{0,30,50,130};
Qt::Orientation m_header_text_orientation{Qt::Horizontal};
void setHeaderTextAlignment(const Qt::Alignment &alignment);
Qt::Alignment headerTextAlignment() const;
QTextOption headerTextOption() const;
//Spacer between the header and the terminals
QRect m_spacer_rect{0, 50, 10, 90};
QRectF m_spacer_rect{0, 50, 10, 90};
//Font
QFont font() const;
void setFont (const QFont &font);
//Terminals
QVector<QRect> m_terminal_rect
QVector<QRectF> m_terminal_rect
{
QRect{0, 0, 20, 190},
QRect{0, 10, 20, 170},
QRect{0, 20, 20, 150},
QRect{0, 30, 20, 130}
QRectF{0, 0, 20, 190},
QRectF{0, 10, 20, 170},
QRectF{0, 20, 20, 150},
QRectF{0, 30, 20, 130}
};
void setTerminalsTextAlignment(const QVector<Qt::Alignment> &alignment);
QVector<Qt::Alignment> terminalsTextAlignment() const;
QVector<QTextOption> terminalsTextOption() const;
//Terminal text
void setTerminalsTextAlignment(const Qt::Alignment &alignment);
Qt::Alignment terminalsTextAlignment() const;
QTextOption terminalsTextOption() const;
qreal m_terminals_text_height{50};
qreal m_terminals_text_y{35};
Qt::Orientation m_terminals_text_orientation {Qt::Vertical};
QVector<QRect> m_terminals_text_rect
{
QRect{0,35,20,50},
QRect{0,35,20,50},
QRect{0,35,20,50},
QRect{0,35,20,50}
};
QVector<Qt::Orientation> m_terminals_text_orientation
{
Qt::Vertical,
Qt::Vertical,
Qt::Vertical,
Qt::Vertical
};
//Xref text
void setXrefTextAlignment(const Qt::Alignment &alignment);
Qt::Alignment xrefTextAlignment() const;
QTextOption xrefTextOption() const;
qreal m_xref_text_height{60};
qreal m_xref_text_y{95};
Qt::Orientation m_xref_text_orientation {Qt::Vertical};
int m_bridge_point_d{5};
QVector<int> m_bridge_point_y_offset{50,70,90,110};
qreal m_bridge_point_d{5};
QVector<qreal> m_bridge_point_y_offset{50,70,90,110};
QUuid m_uuid{QUuid::createUuid()};
QString m_name;
@@ -90,24 +92,17 @@ class TerminalStripLayoutPattern
void updateHeaderTextOption();
void updateTerminalsTextOption();
private:
private:
QFont m_font;
Qt::Alignment m_header_text_alignment{Qt::AlignCenter};
QTextOption m_header_text_option;
QVector<Qt::Alignment> m_terminals_text_alignment
{
Qt::AlignRight | Qt::AlignVCenter,
Qt::AlignRight | Qt::AlignVCenter,
Qt::AlignRight | Qt::AlignVCenter,
Qt::AlignRight | Qt::AlignVCenter
};
QVector<QTextOption> m_terminals_text_option
{
QTextOption(),
QTextOption(),
QTextOption(),
QTextOption()
};
Qt::Alignment
m_terminals_text_alignment {Qt::AlignRight | Qt::AlignVCenter},
m_xref_text_alignment {Qt::AlignLeft | Qt::AlignVCenter};
QTextOption
m_terminals_text_option{QTextOption()},
m_xref_text_option{QTextOption()};
};
#endif // TERMINALSTRIPLAYOUTPATTERN_H

View File

@@ -16,6 +16,7 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "terminalstripdrawer.h"
#include <QPainter>
namespace TerminalStripDrawer {
@@ -42,12 +43,13 @@ void TerminalStripDrawer::setStrip(QSharedPointer<AbstractTerminalStripInterface
*/
void TerminalStripDrawer::paint(QPainter *painter)
{
if (m_strip && m_pattern)
{
//To draw text, QPainter need a Qrect. Instead of create an instance
//for each text, we re-use the same instance of QRect.
QRect text_rect;
painter->save();
if (m_strip && m_pattern)
{
m_united_xref_text_rect = QRectF();
//To draw text, QPainter need a Qrect. Instead of create an instance
//for each text, we re-use the same instance of QRect.
QRect text_rect;
painter->save();
auto pen_{painter->pen()};
pen_.setColor(Qt::black);
@@ -56,16 +58,20 @@ void TerminalStripDrawer::paint(QPainter *painter)
auto brush_ = painter->brush();
brush_.setColor(Qt::white);
painter->setPen(pen_);
painter->setBrush(brush_);
painter->setFont(m_pattern->font());
if (m_preview_draw)
{
painter->save();
painter->setPen(Qt::blue);
painter->drawRect(boundingRect());
painter->restore();
}
painter->setPen(pen_);
painter->setBrush(brush_);
if (m_preview_draw)
{
painter->save();
painter->setPen(Qt::blue);
painter->drawRect(boundingRect());
painter->drawLine(QPointF{boundingRect().left(), boundingRect().center().y()},
QPointF{boundingRect().right(), boundingRect().center().y()});
painter->restore();
}
//Draw header
painter->drawRect(m_pattern->m_header_rect);
@@ -84,14 +90,13 @@ void TerminalStripDrawer::paint(QPainter *painter)
text_rect.setRect(0,0,m_pattern->m_header_rect.height(),m_pattern->m_header_rect.width());
}
const auto text_{m_strip->installation() + " " + m_strip->location() + " " + m_strip->name()};
painter->drawText(text_rect, text_, m_pattern->headerTextOption());
const auto text_{m_strip->installation() + " " + m_strip->location() + " " + m_strip->name()};
painter->drawText(text_rect, text_, m_pattern->headerTextOption());
painter->restore();
//Move painter pos to next drawing
painter->translate(m_pattern->m_header_rect.width(),0);
int x_offset{m_pattern->m_header_rect.width()};
//Move painter pos to next drawing
painter->translate(m_pattern->m_header_rect.width(),0);
qreal x_offset{m_pattern->m_header_rect.width()};
//Draw spacer
painter->drawRect(m_pattern->m_spacer_rect);
@@ -99,22 +104,30 @@ void TerminalStripDrawer::paint(QPainter *painter)
painter->translate(m_pattern->m_spacer_rect.width(),0);
x_offset += m_pattern->m_spacer_rect.width();
//Draw terminals
const auto terminals_text_orientation{m_pattern->m_terminals_text_orientation};
const auto terminals_text_option{m_pattern->terminalsTextOption()};
const auto terminals_text_height{m_pattern->m_terminals_text_height};
const auto terminals_text_y{m_pattern->m_terminals_text_y};
QRectF terminal_rect;
//Draw terminals
const auto terminals_text_rect{m_pattern->m_terminals_text_rect};
const auto terminals_text_orientation{m_pattern->m_terminals_text_orientation};
const auto terminals_text_option{m_pattern->terminalsTextOption()};
QRect terminal_rect;
const auto xref_text_orientation{m_pattern->m_xref_text_orientation};
const auto xref_text_option{m_pattern->xrefTextOption()};
const auto xref_text_height{m_pattern->m_xref_text_height};
const auto xref_text_y{m_pattern->m_xref_text_y};
QRectF xref_rect;
QHash<QUuid, QVector<QPointF>> bridges_anchor_points;
//Loop over physical terminals
for (const auto &physical_t : m_strip->physicalTerminal())
{
//Get the good offset according to how many level have the current physical terminal
const QVector<QSharedPointer<AbstractRealTerminalInterface>> real_terminal_vector{physical_t->realTerminals()};
const auto real_t_count{real_terminal_vector.size()};
const auto offset_{4 - real_t_count};
m_hovered_xref = hoverTerminal{};
int physical_index = 0;
//Loop over physical terminals
for (const auto &physical_t : m_strip->physicalTerminal())
{
//Get the good offset according to how many level have the current physical terminal
const QVector<QSharedPointer<AbstractRealTerminalInterface>> real_terminal_vector{physical_t->realTerminals()};
const auto real_t_count{real_terminal_vector.size()};
const auto offset_{4 - real_t_count};
//Loop over real terminals
for (auto i=0 ; i<real_t_count ; ++i)
@@ -124,45 +137,50 @@ void TerminalStripDrawer::paint(QPainter *painter)
break;
}
terminal_rect = m_pattern->m_terminal_rect[index_];
//Draw terminal rect
painter->drawRect(terminal_rect);
//Draw a stronger line if the current terminal have level
//and the current level is the first
if (real_t_count > 1 && i == 0)
{
painter->save();
pen_ = painter->pen();
pen_.setWidth(4);
pen_.setCapStyle(Qt::FlatCap);
painter->setPen(pen_);
const auto p1 { terminal_rect.topLeft() };
//We can't use terminal_rect.bottomLeft for p2 because
//the returned value deviate from the true value
//(see Qt documentation about QRect)
const QPoint p2 { p1.x(), p1.y() + terminal_rect.height() };
painter->drawLine(p1, p2);
painter->restore();
terminal_rect = m_pattern->m_terminal_rect[index_];
//Draw terminal rect
painter->drawRect(terminal_rect);
//Draw a stronger line if the current terminal have level
//and the current level is the first
if (real_t_count > 1 && i == 0)
{
painter->save();
pen_ = painter->pen();
pen_.setWidth(4);
pen_.setCapStyle(Qt::FlatCap);
painter->setPen(pen_);
const auto p1 { terminal_rect.topLeft() };
//We can't use terminal_rect.bottomLeft for p2 because
//the returned value deviate from the true value
//(see Qt documentation about QRect)
const QPointF p2 { p1.x(), p1.y() + terminal_rect.height() };
painter->drawLine(p1, p2);
painter->restore();
}
if(m_preview_draw)
{
painter->save();
painter->setPen(Qt::yellow);
painter->drawLine(QPointF{terminal_rect.x(), terminal_rect.y() + terminal_rect.height()/2},
QPointF{terminal_rect.width(), terminal_rect.y() + terminal_rect.height()/2});
painter->restore();
}
//Draw text
painter->save();
if (terminals_text_orientation[index_] == Qt::Horizontal)
{
text_rect = terminals_text_rect[index_];
}
else
{
const auto rect_{terminals_text_rect[index_]};
painter->translate(rect_.bottomLeft());
painter->rotate(270);
text_rect.setRect(0, 0, rect_.height(), terminal_rect.width());
}
//Draw text
painter->save();
text_rect.setRect(0, terminals_text_y, terminal_rect.width(), terminals_text_height);
if (terminals_text_orientation == Qt::Vertical)
{
painter->translate(text_rect.bottomLeft());
painter->rotate(270);
text_rect.setRect(0, 0, text_rect.height(), text_rect.width());
}
const auto shared_real_terminal{real_terminal_vector[i]};
const auto shared_real_terminal{real_terminal_vector[i]};
painter->drawText(text_rect,
shared_real_terminal ? shared_real_terminal->label() : QLatin1String(),
terminals_text_option[index_]);
terminals_text_option);
if (m_preview_draw)
{
@@ -172,16 +190,60 @@ void TerminalStripDrawer::paint(QPainter *painter)
painter->restore();
//Add bridge anchor
if (shared_real_terminal->isBridged())
//Draw xref
xref_rect.setRect(0, xref_text_y, terminal_rect.width(), xref_text_height);
painter->save();
if (xref_text_orientation == Qt::Vertical)
{
painter->save();
if (QScopedPointer<AbstractBridgeInterface> bridge_ {
shared_real_terminal->bridge() })
{
const auto x_anchor{terminal_rect.width()/2};
const auto y_anchor {m_pattern->m_bridge_point_y_offset[index_]};
const auto radius_anchor{m_pattern->m_bridge_point_d/2};
painter->translate(xref_rect.bottomLeft());
painter->rotate(270);
xref_rect.setRect(0, 0, xref_rect.height(), xref_rect.width());
}
QTransform transform;
transform.translate(x_offset, 0);
if (xref_text_orientation == Qt::Vertical)
{
transform.translate(0, xref_text_y + xref_text_height);
transform.rotate(270);
}
auto xref_string = shared_real_terminal->xref();
const auto mapped_xref_text_rect = transform.mapRect(painter->boundingRect(xref_rect, xref_string, xref_text_option));
if (m_united_xref_text_rect.isNull()) {
m_united_xref_text_rect = mapped_xref_text_rect;
} else {
m_united_xref_text_rect = m_united_xref_text_rect.united(mapped_xref_text_rect);
}
//if mouse hover the xref text, draw it in blue to advise user the xref is clickable.
if (!m_mouse_hover_pos.isNull() && mapped_xref_text_rect.contains(m_mouse_hover_pos)) {
painter->setPen(Qt::blue);
m_hovered_xref.physical = physical_index;
m_hovered_xref.real = i;
}
painter->drawText(xref_rect, xref_string, xref_text_option);
if (m_preview_draw)
{
painter->setPen(Qt::blue);
painter->drawRect(xref_rect);
}
painter->restore();
//Add bridge anchor
if (shared_real_terminal->isBridged())
{
painter->save();
if (QScopedPointer<AbstractBridgeInterface> bridge_ {
shared_real_terminal->bridge() })
{
const auto x_anchor{terminal_rect.width()/2};
const auto y_anchor {m_pattern->m_bridge_point_y_offset[index_]};
const auto radius_anchor{m_pattern->m_bridge_point_d/2};
painter->setBrush(Qt::SolidPattern);
painter->drawEllipse(QPointF(x_anchor, y_anchor),
@@ -194,12 +256,13 @@ void TerminalStripDrawer::paint(QPainter *painter)
painter->restore();
}
//Move painter pos to next drawing
painter->translate(terminal_rect.width(),0);
x_offset += terminal_rect.width();
}
}
painter->restore();
//Move painter pos to next drawing
painter->translate(terminal_rect.width(),0);
x_offset += terminal_rect.width();
}
physical_index++;
}
painter->restore();
//Draw the bridges
for (const auto &points_ : qAsConst(bridges_anchor_points))
@@ -216,7 +279,7 @@ void TerminalStripDrawer::paint(QPainter *painter)
QRectF TerminalStripDrawer::boundingRect() const
{
return QRect{0, 0, width(), height()};;
return QRectF{0, 0, width(), height()};;
}
void TerminalStripDrawer::setLayout(QSharedPointer<TerminalStripLayoutPattern> layout)
@@ -233,7 +296,42 @@ void TerminalStripDrawer::setPreviewDraw(bool draw) {
m_preview_draw = draw;
}
int TerminalStripDrawer::height() const
void TerminalStripDrawer::setMouseHoverPos(const QPointF &pos)
{
m_last_mouse_pos_in_xrefs_rect = m_united_xref_text_rect.contains(m_mouse_hover_pos);
m_mouse_hover_pos = pos;
}
/**
* @brief TerminalStripDrawer::mouseHoverXref
* @return True if the mouse position (given through the function setMouseHoverPos)
* hover the rect of a xref.
*/
bool TerminalStripDrawer::mouseHoverXref() const {
return m_united_xref_text_rect.contains(m_mouse_hover_pos);
}
bool TerminalStripDrawer::needUpdate()
{
if (mouseHoverXref()) {
return true;
} else if (m_last_mouse_pos_in_xrefs_rect) {
return true;
}
return false;
}
/**
* @brief TerminalStripDrawer::hoveredXref
* @return the current terminal hovered by the mouse
* in the xref bounding rectangle
*/
hoverTerminal TerminalStripDrawer::hoveredXref() const
{
return m_hovered_xref;
}
qreal TerminalStripDrawer::height() const
{
if (m_pattern)
{
@@ -251,11 +349,11 @@ int TerminalStripDrawer::height() const
return 0;
}
int TerminalStripDrawer::width() const
qreal TerminalStripDrawer::width() const
{
if (m_pattern)
{
int width_{m_pattern->m_header_rect.width() + m_pattern->m_spacer_rect.width()};
if (m_pattern)
{
qreal width_{m_pattern->m_header_rect.width() + m_pattern->m_spacer_rect.width()};
if (m_strip)
{

View File

@@ -27,23 +27,35 @@ class TerminalStrip;
namespace TerminalStripDrawer
{
class AbstractBridgeInterface
{
public:
AbstractBridgeInterface() {}
virtual ~AbstractBridgeInterface() {}
virtual QUuid uuid() const = 0;
/**
* @brief The hoverTerminal struct
* Just a little struct use to know what is the physical and real terminal
* when the mouse hover the Xref string of a terminal.
* If mouse don't hover a Xref the value is set to -1;
*/
struct hoverTerminal{
int physical{-1};
int real{-1};
};
class AbstractRealTerminalInterface
{
public:
AbstractRealTerminalInterface() {}
virtual ~AbstractRealTerminalInterface() {}
virtual QString label() const = 0;
virtual bool isBridged() const = 0;
virtual AbstractBridgeInterface* bridge() const = 0;
};
class AbstractBridgeInterface
{
public:
AbstractBridgeInterface() {}
virtual ~AbstractBridgeInterface() {}
virtual QUuid uuid() const = 0;
};
class AbstractRealTerminalInterface
{
public:
AbstractRealTerminalInterface() {}
virtual ~AbstractRealTerminalInterface() {}
virtual QString label() const = 0;
virtual bool isBridged() const = 0;
virtual AbstractBridgeInterface* bridge() const = 0;
virtual QString xref() const = 0;
};
class AbstractPhysicalTerminalInterface
{
@@ -79,15 +91,24 @@ namespace TerminalStripDrawer
void setPreviewDraw(bool draw = true);
private:
int height() const;
int width() const;
void setMouseHoverPos(const QPointF &pos);
bool mouseHoverXref() const;
bool needUpdate();
hoverTerminal hoveredXref() const;
private:
QSharedPointer <AbstractTerminalStripInterface> m_strip;
QSharedPointer<TerminalStripLayoutPattern> m_pattern;
bool m_preview_draw { false };
};
private:
qreal height() const;
qreal width() const;
private:
QSharedPointer <AbstractTerminalStripInterface> m_strip;
QSharedPointer<TerminalStripLayoutPattern> m_pattern;
bool m_preview_draw { false };
QPointF m_mouse_hover_pos;
QRectF m_united_xref_text_rect;
bool m_last_mouse_pos_in_xrefs_rect{false};
hoverTerminal m_hovered_xref;
};
}
#endif // TERMINALSTRIPDRAWER_H

View File

@@ -1,5 +1,5 @@
/*
Copyright 2006-2022 The QElectroTech Team
Copyright 2006-2025 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
@@ -22,6 +22,8 @@
#include "../../project/projectpropertieshandler.h"
#include "../../qetgraphicsitem/qgraphicsitemutility.h"
#include "../terminalstrip.h"
#include "../physicalterminal.h"
#include "../realterminal.h"
#include "../ui/terminalstripeditorwindow.h"
#include "trueterminalstrip.h"
@@ -94,12 +96,52 @@ QString TerminalStripItem::name() const {
return tr("plan de bornes");
}
void TerminalStripItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
QetGraphicsItem::hoverMoveEvent(event);
m_drawer.setMouseHoverPos(hoverMousePos());
if (m_drawer.needUpdate()) {
update();
}
}
void TerminalStripItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
QetGraphicsItem::hoverLeaveEvent(event);
m_drawer.setMouseHoverPos(QPointF{});
}
void TerminalStripItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
Q_UNUSED (event);
const auto hovered = m_drawer.hoveredXref();
if (m_strip) {
TerminalStripEditorWindow::edit(m_strip);
if (hovered.physical >= 0 &&
hovered.real >= 0)
{
if (const auto physical_terminal = m_strip->physicalTerminal(hovered.physical);
!physical_terminal.isNull())
{
if (const auto real_terminal = physical_terminal->realTerminal(hovered.real);
!real_terminal.isNull() &&
real_terminal->isElement())
{
if (QPointer<Element> element = real_terminal->element();
!element.isNull())
{
//Unselect and ungrab mouse to prevent unwanted
//move when element is in the same scene of this.
setSelected(false);
ungrabMouse();
QetGraphicsItem::showItem(element);
}
}
}
} else {
TerminalStripEditorWindow::edit(m_strip);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
Copyright 2006-2022 The QElectroTech Team
Copyright 2006-2025 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
@@ -46,18 +46,19 @@ class TerminalStripItem : public QetGraphicsItem
QRectF boundingRect() const override;
QString name() const override;
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
void refreshPending();
void setLayout(QSharedPointer<TerminalStripLayoutPattern> layout);
void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override;
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
void refreshPending();
void setLayout(QSharedPointer<TerminalStripLayoutPattern> layout);
private:
void setDefaultLayout();
private:
QPointer<TerminalStrip> m_strip;
TerminalStripDrawer::TerminalStripDrawer m_drawer;
QUuid m_pending_strip_uuid;
TerminalStripDrawer::TerminalStripDrawer m_drawer;
QUuid m_pending_strip_uuid;
};
#endif // TERMINALSTRIPITEM_H

View File

@@ -20,6 +20,7 @@
#include "../realterminal.h"
#include "../terminalstrip.h"
#include "../terminalstripbridge.h"
#include "../../autoNum/assignvariables.h"
#include "terminalstripdrawer.h"
@@ -118,9 +119,18 @@ namespace TerminalStripDrawer
return new TrueBridge(m_real->bridge());
}
TrueBridge::TrueBridge(QSharedPointer<TerminalStripBridge> bridge) :
m_bridge { bridge }
{}
QString TrueRealTerminal::xref() const
{
if (m_real && m_real->isElement()) {
return autonum::AssignVariables::genericXref(m_real->element());
} else {
return QString{};
}
}
TrueBridge::TrueBridge(QSharedPointer<TerminalStripBridge> bridge) :
m_bridge { bridge }
{}
QUuid TrueBridge::uuid() const
{

View File

@@ -51,13 +51,14 @@ namespace TerminalStripDrawer
QSharedPointer<PhysicalTerminal> m_physical;
};
class TrueRealTerminal : public AbstractRealTerminalInterface
{
public:
TrueRealTerminal(QSharedPointer<RealTerminal> real);
QString label() const override;
bool isBridged() const override;
AbstractBridgeInterface* bridge() const override;
class TrueRealTerminal : public AbstractRealTerminalInterface
{
public:
TrueRealTerminal(QSharedPointer<RealTerminal> real);
QString label() const override;
bool isBridged() const override;
AbstractBridgeInterface* bridge() const override;
QString xref() const override;
private:
QSharedPointer<RealTerminal> m_real;

View File

@@ -189,6 +189,20 @@ QVector<QSharedPointer<RealTerminal>> PhysicalTerminal::realTerminals() const {
return m_real_terminal;
}
/**
* @brief PhysicalTerminal::realTerminal
* @param pos
* @return the real terminal at position pos.
* Note that the returned QSharedPointer can be null
*/
QSharedPointer<RealTerminal> PhysicalTerminal::realTerminal(int pos) const
{
if (pos < m_real_terminal.size()) {
return m_real_terminal.at(pos);
}
else return QSharedPointer<RealTerminal>{};
}
/**
* @brief uuid
* @return the uuid of this physical terminal

View File

@@ -86,6 +86,7 @@ class PhysicalTerminal
int levelCount() const;
int levelOf(const QSharedPointer<RealTerminal> &terminal) const;
QVector<QSharedPointer<RealTerminal>> realTerminals() const;
QSharedPointer<RealTerminal> realTerminal(int pos) const;
QUuid uuid() const;
int pos() const;
int realTerminalCount() const;

View File

@@ -1037,8 +1037,10 @@ bool TerminalStrip::fromXml(QDomElement &xml_element)
}
}
auto raw_ptr = new PhysicalTerminal(this, real_t_vector);
m_physical_terminals.append(raw_ptr->sharedRef());
if (!real_t_vector.isEmpty()) {
auto raw_ptr = new PhysicalTerminal(this, real_t_vector);
m_physical_terminals.append(raw_ptr->sharedRef());
}
}
}

View File

@@ -1,5 +1,5 @@
/*
Copyright 2006-2022 The QElectroTech Team
Copyright 2006-2025 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify

View File

@@ -1,5 +1,5 @@
/*
Copyright 2006-2022 The QElectroTech Team
Copyright 2006-2025 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify

View File

@@ -32,16 +32,20 @@
*/
FreeTerminalEditor::FreeTerminalEditor(QETProject *project, QWidget *parent) :
QWidget(parent),
ui(new Ui::FreeTerminalEditor),
m_project(project)
ui(new Ui::FreeTerminalEditor),
m_project(project)
{
ui->setupUi(this);
ui->m_table_view->setItemDelegate(new FreeTerminalModelDelegate(ui->m_table_view));
m_model = new FreeTerminalModel(m_project, this);
m_model = new FreeTerminalModel(m_project, this);
ui->m_table_view->setModel(m_model);
ui->m_table_view->setCurrentIndex(m_model->index(0,0));
if (m_project) {
connect(m_project, &QObject::destroyed, this, &FreeTerminalEditor::reload);
}
//Disabled the move if the table is currently edited (yellow cell)
connect(m_model, &FreeTerminalModel::dataChanged, this, [=] {
this->setDisabledMove();
@@ -135,6 +139,31 @@ void FreeTerminalEditor::apply()
reload();
}
/**
* @brief FreeTerminalEditor::setProject
* Set @project as project handled by this editor.
* If a previous project was setted, everything is clear.
* This function track the destruction of the project,
* that mean if the project pointer is deleted
* no need to call this function with a nullptr,
* everything is made inside this class.
* @param project
*/
void FreeTerminalEditor::setProject(QETProject *project)
{
if(m_project) {
disconnect(m_project, &QObject::destroyed, this, &FreeTerminalEditor::reload);
}
m_project = project;
if (m_model) {
m_model->setProject(project);
}
if (m_project) {
connect(m_project, &QObject::destroyed, this, &FreeTerminalEditor::reload);
}
reload();
}
void FreeTerminalEditor::on_m_type_cb_activated(int index)
{
if (m_model)

View File

@@ -19,8 +19,8 @@
#define FREETERMINALEDITOR_H
#include <QWidget>
#include "../../qetproject.h"
class QETProject;
class RealTerminal;
class FreeTerminalModel;
class QTableView;
@@ -40,6 +40,8 @@ class FreeTerminalEditor : public QWidget
void reload();
void apply();
void setProject(QETProject *project);
private slots:
void on_m_type_cb_activated(int index);
void on_m_function_cb_activated(int index);
@@ -52,7 +54,7 @@ class FreeTerminalEditor : public QWidget
private:
Ui::FreeTerminalEditor *ui;
QETProject *m_project = nullptr;
FreeTerminalModel *m_model = nullptr;
QPointer <QETProject> m_project;
FreeTerminalModel *m_model {nullptr};
};
#endif // FREETERMINALEDITOR_H

View File

@@ -56,10 +56,30 @@ FreeTerminalModel::Column FreeTerminalModel::columnTypeForIndex(const QModelInde
* @param parent
*/
FreeTerminalModel::FreeTerminalModel(QETProject *project, QObject *parent) :
QAbstractTableModel(parent),
m_project(project)
QAbstractTableModel(parent) {
setProject(project);
}
/**
* @brief FreeTerminalModel::setProject
* Set @project as project handled by this model.
* If a previous project was setted, everything is clear.
* This function track the destruction of the project,
* that mean if the project pointer is deleted
* no need to call this function with a nullptr,
* everything is made inside this class.
* @param project
*/
void FreeTerminalModel::setProject(QETProject *project)
{
fillTerminalVector();
if(m_project) {
disconnect(m_project, &QObject::destroyed, this, &FreeTerminalModel::clear);
}
m_project = project;
if (m_project) {
connect(m_project, &QObject::destroyed, this, &FreeTerminalModel::clear);
}
clear();
}
/**
@@ -305,20 +325,22 @@ QVector<QSharedPointer<RealTerminal> > FreeTerminalModel::realTerminalForIndex(c
*/
void FreeTerminalModel::fillTerminalVector()
{
ElementProvider provider_(m_project);
auto free_terminal_vector = provider_.freeTerminal();
if (m_project) {
ElementProvider provider_(m_project);
auto free_terminal_vector = provider_.freeTerminal();
std::sort(free_terminal_vector.begin(), free_terminal_vector.end(),
[](TerminalElement *a, TerminalElement *b)
{
return QETUtils::sortBeginIntString(a->elementData().m_informations.value(QETInformation::ELMT_LABEL).toString(),
b->elementData().m_informations.value(QETInformation::ELMT_LABEL).toString());
});
std::sort(free_terminal_vector.begin(), free_terminal_vector.end(),
[](TerminalElement *a, TerminalElement *b)
{
return QETUtils::sortBeginIntString(a->elementData().m_informations.value(QETInformation::ELMT_LABEL).toString(),
b->elementData().m_informations.value(QETInformation::ELMT_LABEL).toString());
});
for (const auto &terminal_ : free_terminal_vector) {
m_terminal_vector.append(terminal_->realTerminal());
m_real_t_data.append(modelRealTerminalData::data(terminal_->realTerminal()));
}
for (const auto &terminal_ : free_terminal_vector) {
m_terminal_vector.append(terminal_->realTerminal());
m_real_t_data.append(modelRealTerminalData::data(terminal_->realTerminal()));
}
}
}
/****************************************************************

View File

@@ -47,6 +47,7 @@ class FreeTerminalModel : public QAbstractTableModel
public:
explicit FreeTerminalModel(QETProject *project, QObject *parent = nullptr);
void setProject(QETProject *project);
int rowCount(const QModelIndex &parent) const override;
int columnCount(const QModelIndex &parent) const override;

View File

@@ -57,21 +57,9 @@ TerminalStripEditor::TerminalStripEditor(QETProject *project, QWidget *parent) :
{
if (m_model->columnTypeForIndex(index) == TerminalStripModel::XRef)
{
auto mrtd = m_model->modelRealTerminalDataForIndex(index);
if (mrtd.element_)
{
auto elmt = mrtd.element_;
auto diagram = elmt->diagram();
if (diagram)
{
diagram->showMe();
if (diagram->views().size())
{
auto fit_view = elmt->sceneBoundingRect();
fit_view.adjust(-200,-200,200,200);
diagram->views().at(0)->fitInView(fit_view, Qt::KeepAspectRatioByExpanding);
}
}
const auto mrtd = m_model->modelRealTerminalDataForIndex(index);
if (mrtd.element_) {
QetGraphicsItem::showItem(mrtd.element_);
}
}
});
@@ -84,6 +72,12 @@ TerminalStripEditor::~TerminalStripEditor() {
delete ui;
}
void TerminalStripEditor::setProject(QETProject *project)
{
m_project = project;
setCurrentStrip(nullptr);
}
/**
* @brief TerminalStripEditor::setCurrentStrip
* Set the current terminal strip edited to \p strip_
@@ -98,27 +92,15 @@ void TerminalStripEditor::setCurrentStrip(TerminalStrip *strip_)
if (m_current_strip) {
disconnect(m_current_strip, &TerminalStrip::orderChanged, this, &TerminalStripEditor::reload);
disconnect(m_current_strip, &TerminalStrip::bridgeChanged, this, &TerminalStripEditor::reload);
disconnect(m_current_strip, &QObject::destroyed, this, &TerminalStripEditor::clear);
}
ui->m_move_to_cb->clear();
if (!strip_)
{
ui->m_installation_le ->clear();
ui->m_location_le ->clear();
ui->m_name_le ->clear();
ui->m_comment_le ->clear();
ui->m_description_te ->clear();
m_current_strip = nullptr;
ui->m_table_widget->setModel(nullptr);
if (m_model) {
m_model->deleteLater();
m_model = nullptr;
}
if (!strip_) {
clear();
}
else
{
else {
ui->m_installation_le ->setText(strip_->installation());
ui->m_location_le ->setText(strip_->location());
ui->m_name_le ->setText(strip_->name());
@@ -159,6 +141,7 @@ void TerminalStripEditor::setCurrentStrip(TerminalStrip *strip_)
connect(m_current_strip, &TerminalStrip::orderChanged, this, &TerminalStripEditor::reload);
connect(m_current_strip, &TerminalStrip::bridgeChanged, this, &TerminalStripEditor::reload);
connect(m_current_strip, &QObject::destroyed, this, &TerminalStripEditor::clear);
}
}
@@ -230,6 +213,22 @@ void TerminalStripEditor::apply()
reload();
}
void TerminalStripEditor::clear()
{
ui->m_installation_le ->clear();
ui->m_location_le ->clear();
ui->m_name_le ->clear();
ui->m_comment_le ->clear();
ui->m_description_te ->clear();
m_current_strip.clear();
ui->m_table_widget->setModel(nullptr);
if (m_model) {
m_model->deleteLater();
m_model = nullptr;
}
}
/**
* @brief TerminalStripEditor::spanMultiLevelTerminals
* Span row of m_table_widget for multi-level terminal

View File

@@ -41,11 +41,13 @@ class TerminalStripEditor : public QWidget
public:
explicit TerminalStripEditor(QETProject *project, QWidget *parent = nullptr);
~TerminalStripEditor() override;
void setProject(QETProject *project);
void setCurrentStrip(TerminalStrip *strip_);
void reload();
void apply();
private:
void clear();
void spanMultiLevelTerminals();
void selectionChanged();
QSize setUpBridgeCellWidth();
@@ -67,9 +69,9 @@ class TerminalStripEditor : public QWidget
private:
Ui::TerminalStripEditor *ui;
QETProject *m_project {nullptr};
TerminalStrip *m_current_strip {nullptr};
TerminalStripModel *m_model {nullptr};
QPointer<QETProject> m_project;
QPointer<TerminalStrip> m_current_strip;
TerminalStripModel *m_model {nullptr};
};
#endif // TERMINALSTRIPEDITOR_H

View File

@@ -51,10 +51,15 @@ void TerminalStripEditorWindow::edit(TerminalStrip *strip)
TerminalStripEditorWindow::TerminalStripEditorWindow(QETProject *project, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::TerminalStripEditorWindow),
m_project(project)
ui(new Ui::TerminalStripEditorWindow),
m_project(project)
{
ui->setupUi(this);
if (auto diagram_editor = QETApp::diagramEditor(project)) {
ui->m_tool_bar->addSeparator();
ui->m_tool_bar->addAction(diagram_editor->undo);
ui->m_tool_bar->addAction(diagram_editor->redo);
}
ui->m_remove_terminal->setDisabled(true);
addTreeDockWidget();
@@ -76,6 +81,18 @@ TerminalStripEditorWindow::~TerminalStripEditorWindow()
delete ui;
}
/**
* @brief TerminalStripEditorWindow::setProject
* @param project
*/
void TerminalStripEditorWindow::setProject(QETProject *project)
{
m_project = project;
m_tree_dock->setProject(project);
m_free_terminal_editor->setProject(project);
m_terminal_strip_editor->setProject(project);
}
void TerminalStripEditorWindow::setCurrentStrip(TerminalStrip *strip) {
m_tree_dock->setSelectedStrip(strip);
}
@@ -200,4 +217,3 @@ void TerminalStripEditorWindow::on_m_button_box_clicked(QAbstractButton *button)
void TerminalStripEditorWindow::on_m_stacked_widget_currentChanged(int arg1) {
ui->m_button_box->setHidden(arg1 == EMPTY_PAGE);
}

View File

@@ -43,17 +43,19 @@ class TerminalStripEditorWindow : public QMainWindow
//instance in her destrucor and then window_ become a dangling pointer.
static QPointer<TerminalStripEditorWindow> window_;
public:
static TerminalStripEditorWindow* instance(QETProject *project, QWidget *parent = nullptr) {
static QMutex mutex_;
if (!window_) {
mutex_.lock();
if (!window_)
window_ = new TerminalStripEditorWindow{project, parent};
mutex_.unlock();
}
return window_;
}
public:
static TerminalStripEditorWindow* instance(QETProject *project, QWidget *parent = nullptr) {
static QMutex mutex_;
if (!window_) {
mutex_.lock();
if (!window_)
window_ = new TerminalStripEditorWindow{project, parent};
mutex_.unlock();
} else {
window_->setProject(project);
}
return window_;
}
static void dropInstance () {
static QMutex mutex;
@@ -71,7 +73,8 @@ class TerminalStripEditorWindow : public QMainWindow
explicit TerminalStripEditorWindow(QETProject *project, QWidget *parent = nullptr);
~TerminalStripEditorWindow();
void setCurrentStrip(TerminalStrip *strip);
void setProject(QETProject *project);
void setCurrentStrip(TerminalStrip *strip);
private slots:
void on_m_add_terminal_strip_triggered();
@@ -87,7 +90,7 @@ class TerminalStripEditorWindow : public QMainWindow
private:
Ui::TerminalStripEditorWindow *ui{nullptr};
QETProject *m_project {nullptr};
QPointer <QETProject> m_project;
TerminalStripTreeDockWidget *m_tree_dock{nullptr};
FreeTerminalEditor *m_free_terminal_editor {nullptr};
TerminalStripEditor *m_terminal_strip_editor {nullptr};

View File

@@ -33,12 +33,12 @@
<x>0</x>
<y>0</y>
<width>1364</width>
<height>21</height>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<widget class="QToolBar" name="m_tool_bar">
<property name="windowTitle">
<string>toolBar</string>
</property>

View File

@@ -15,6 +15,8 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QFontDialog>
#include "terminalstriplayouteditor.h"
#include "ui_terminalstriplayouteditor.h"
#include "../GraphicsItem/properties/terminalstriplayoutpattern.h"
@@ -54,12 +56,10 @@ void TerminalStripLayoutEditor::valueEdited()
return;
}
//auto *data_ = m_layout.data();
m_layout.data()->m_header_rect.setRect(0,
ui->m_y_header_sb->value(),
ui->m_width_header_sb->value(),
ui->m_height_header_sb->value());
m_layout.data()->m_header_rect.setRect(0,
ui->m_y_header_sb->value(),
ui->m_width_header_sb->value(),
ui->m_height_header_sb->value());
m_layout.data()->m_spacer_rect.setRect(0,
ui->m_y_spacer_sb->value(),
@@ -91,9 +91,13 @@ void TerminalStripLayoutEditor::valueEdited()
m_layout.data()->m_bridge_point_y_offset[2] = ui->m_bridge_point_2_sb->value();
m_layout.data()->m_bridge_point_y_offset[3] = ui->m_bridge_point_3_sb->value();
m_layout.data()->m_header_text_orientation = ui->m_header_text_orientation_cb->currentIndex() == 0 ?
Qt::Horizontal :
Qt::Vertical;
auto font_ = ui->m_font_cb->currentFont();
font_.setPixelSize(ui->m_font_size_sb->value());
m_layout->setFont(font_);
m_layout.data()->m_header_text_orientation = ui->m_header_text_orientation_cb->currentIndex() == 0 ?
Qt::Horizontal :
Qt::Vertical;
switch (ui->m_header_text_alignment_cb->currentIndex()) {
case 0:
@@ -104,34 +108,46 @@ void TerminalStripLayoutEditor::valueEdited()
m_layout.data()->setHeaderTextAlignment(Qt::AlignRight | Qt::AlignVCenter); break;
}
m_layout.data()->m_terminals_text_orientation[0] = ui->m_terminal_text_orientation_cb->currentIndex() == 0 ?
Qt::Horizontal :
Qt::Vertical;
//Terminal text
m_layout.data()->m_terminals_text_orientation = ui->m_terminal_text_orientation_cb->currentIndex() == 0 ?
Qt::Horizontal :
Qt::Vertical;
switch (ui->m_terminal_text_alignment_cb->currentIndex()) {
case 0:
m_layout.data()->setTerminalsTextAlignment(
QVector<Qt::Alignment> { Qt::AlignLeft | Qt::AlignVCenter,
Qt::AlignLeft | Qt::AlignVCenter,
Qt::AlignLeft | Qt::AlignVCenter,
Qt::AlignLeft | Qt::AlignVCenter });
break;
case 1:
m_layout.data()->setTerminalsTextAlignment(
QVector<Qt::Alignment> { Qt::AlignHCenter | Qt::AlignVCenter,
Qt::AlignHCenter | Qt::AlignVCenter,
Qt::AlignHCenter | Qt::AlignVCenter,
Qt::AlignHCenter | Qt::AlignVCenter });
break;
default:
m_layout.data()->setTerminalsTextAlignment(
QVector<Qt::Alignment> { Qt::AlignRight | Qt::AlignVCenter,
Qt::AlignRight | Qt::AlignVCenter,
Qt::AlignRight | Qt::AlignVCenter,
Qt::AlignRight | Qt::AlignVCenter });
break;
switch (ui->m_terminal_text_alignment_cb->currentIndex()) {
case 0:
m_layout.data()->setTerminalsTextAlignment(Qt::Alignment {Qt::AlignLeft | Qt::AlignVCenter});
break;
case 1:
m_layout.data()->setTerminalsTextAlignment(Qt::Alignment { Qt::AlignHCenter | Qt::AlignVCenter});
break;
default:
m_layout.data()->setTerminalsTextAlignment(Qt::Alignment { Qt::AlignRight | Qt::AlignVCenter});
break;
}
m_layout.data()->m_terminals_text_y = ui->m_terminal_text_y_sb->value();
m_layout.data()->m_terminals_text_height = ui->m_terminal_text_height_sb->value();
//Xref text
m_layout.data()->m_xref_text_orientation = ui->m_xref_orientation_cb->currentIndex() == 0 ?
Qt::Horizontal :
Qt::Vertical;
switch (ui->m_xref_alignment_cb->currentIndex()) {
case 0:
m_layout.data()->setXrefTextAlignment(Qt::Alignment {Qt::AlignLeft | Qt::AlignVCenter});
break;
case 1:
m_layout.data()->setXrefTextAlignment(Qt::Alignment { Qt::AlignHCenter | Qt::AlignVCenter});
break;
default:
m_layout.data()->setXrefTextAlignment(Qt::Alignment { Qt::AlignRight | Qt::AlignVCenter});
break;
}
m_layout.data()->m_xref_text_y = ui->m_xref_y_sb->value();
m_layout.data()->m_xref_text_height = ui->m_xref_height_sb->value();
updateUi();
m_preview_strip_item.update();
}
@@ -180,17 +196,21 @@ void TerminalStripLayoutEditor::updateUi()
ui->m_bridge_point_2_sb->setValue(bridge_point[2]);
ui->m_bridge_point_3_sb->setValue(bridge_point[3]);
if (data->m_header_text_orientation == Qt::Horizontal) {
ui->m_header_text_orientation_cb->setCurrentIndex(0);
} else {
ui->m_header_text_orientation_cb->setCurrentIndex(1);
}
const auto font = m_layout->font();
ui->m_font_size_sb->setValue(font.pixelSize());
ui->m_font_cb->setCurrentFont(font);
if (data->m_terminals_text_orientation[0] == Qt::Horizontal) {
ui->m_terminal_text_orientation_cb->setCurrentIndex(0);
} else {
ui->m_terminal_text_orientation_cb->setCurrentIndex(1);
}
if (data->m_header_text_orientation == Qt::Horizontal) {
ui->m_header_text_orientation_cb->setCurrentIndex(0);
} else {
ui->m_header_text_orientation_cb->setCurrentIndex(1);
}
if (data->m_terminals_text_orientation == Qt::Horizontal) {
ui->m_terminal_text_orientation_cb->setCurrentIndex(0);
} else {
ui->m_terminal_text_orientation_cb->setCurrentIndex(1);
}
const auto header_alignment = data->headerTextAlignment();
if (header_alignment &Qt::AlignLeft) {
@@ -201,15 +221,38 @@ void TerminalStripLayoutEditor::updateUi()
ui->m_header_text_alignment_cb->setCurrentIndex(2);
}
const auto terminal_alignment = data->terminalsTextAlignment().at(0);
if (terminal_alignment &Qt::AlignLeft) {
ui->m_terminal_text_alignment_cb->setCurrentIndex(0);
} else if (terminal_alignment &Qt::AlignHCenter) {
ui->m_terminal_text_alignment_cb->setCurrentIndex(1);
} else if (terminal_alignment &Qt::AlignRight) {
ui->m_terminal_text_alignment_cb->setCurrentIndex(2);
//Terminal text
const auto terminal_alignment = data->terminalsTextAlignment();
if (terminal_alignment &Qt::AlignLeft) {
ui->m_terminal_text_alignment_cb->setCurrentIndex(0);
} else if (terminal_alignment &Qt::AlignHCenter) {
ui->m_terminal_text_alignment_cb->setCurrentIndex(1);
} else if (terminal_alignment &Qt::AlignRight) {
ui->m_terminal_text_alignment_cb->setCurrentIndex(2);
}
ui->m_terminal_text_y_sb->setValue(data->m_terminals_text_y);
ui->m_terminal_text_height_sb->setValue(data->m_terminals_text_height);
//Xref text
if (data->m_xref_text_orientation == Qt::Horizontal) {
ui->m_xref_orientation_cb->setCurrentIndex(0);
} else {
ui->m_xref_orientation_cb->setCurrentIndex(1);
}
const auto xref_alignment = data->xrefTextAlignment();
if (xref_alignment &Qt::AlignLeft) {
ui->m_xref_alignment_cb->setCurrentIndex(0);
} else if (xref_alignment &Qt::AlignHCenter) {
ui->m_xref_alignment_cb->setCurrentIndex(1);
} else if (xref_alignment &Qt::AlignRight) {
ui->m_xref_alignment_cb->setCurrentIndex(2);
}
ui->m_xref_y_sb->setValue(data->m_xref_text_y);
ui->m_xref_height_sb->setValue(data->m_xref_text_height);
m_ui_updating = false;
updatePreview();
}
@@ -225,4 +268,3 @@ void TerminalStripLayoutEditor::on_m_display_preview_help_clicked(bool checked)
m_preview_strip_item.m_drawer.setPreviewDraw(checked);
m_preview_strip_item.update();
}

View File

@@ -74,10 +74,9 @@ class TerminalStripLayoutEditor : public QWidget
void resizeEvent(QResizeEvent *event) override;
void showEvent(QShowEvent *event) override;
private slots:
void valueEdited();
void on_m_display_preview_help_clicked(bool checked);
private slots:
void valueEdited();
void on_m_display_preview_help_clicked(bool checked);
private:
void updateUi();

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>767</width>
<height>544</height>
<width>961</width>
<height>624</height>
</rect>
</property>
<property name="windowTitle">
@@ -17,17 +17,17 @@
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item row="4" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Borne niveau 0 :</string>
<item row="4" column="2">
<widget class="QSpinBox" name="m_width_terminal_0_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>En tête :</string>
<item row="6" column="3">
<widget class="QSpinBox" name="m_height_terminal_2_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
@@ -38,37 +38,6 @@
</property>
</widget>
</item>
<item row="12" column="0" colspan="5">
<widget class="QGraphicsView" name="m_graphics_view"/>
</item>
<item row="3" column="4">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Point de pont</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="m_y_terminal_1_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="8" column="0" colspan="5">
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QSpinBox" name="m_height_spacer_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_3">
<property name="text">
@@ -76,15 +45,43 @@
</property>
</widget>
</item>
<item row="11" column="4">
<widget class="QCheckBox" name="m_display_preview_help">
<property name="text">
<string>Afficher l'aide</string>
<item row="7" column="4">
<widget class="QSpinBox" name="m_bridge_point_3_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="m_width_header_sb">
<item row="5" column="3">
<widget class="QSpinBox" name="m_height_terminal_1_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Borne niveau 0 :</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QSpinBox" name="m_width_terminal_3_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="6" column="4">
<widget class="QSpinBox" name="m_bridge_point_2_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QSpinBox" name="m_width_terminal_1_sb">
<property name="maximum">
<number>1000</number>
</property>
@@ -97,22 +94,39 @@
</property>
</widget>
</item>
<item row="5" column="4">
<widget class="QSpinBox" name="m_bridge_point_1_sb">
<item row="14" column="0" colspan="5">
<widget class="QGraphicsView" name="m_graphics_view"/>
</item>
<item row="2" column="3">
<widget class="QSpinBox" name="m_height_spacer_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_4">
<item row="7" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Largeur</string>
<string>Borne niveau 3 :</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QSpinBox" name="m_height_terminal_2_sb">
<item row="6" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Borne niveau 2 :</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QSpinBox" name="m_width_spacer_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QSpinBox" name="m_height_terminal_0_sb">
<property name="maximum">
<number>1000</number>
</property>
@@ -125,17 +139,48 @@
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_5">
<item row="13" column="4">
<widget class="QCheckBox" name="m_display_preview_help">
<property name="text">
<string>Hauteur</string>
<string>Afficher l'aide</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_2">
<item row="0" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Prévisualisation :</string>
<string>Largeur</string>
</property>
</widget>
</item>
<item row="5" column="4">
<widget class="QSpinBox" name="m_bridge_point_1_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Espace :</string>
</property>
</widget>
</item>
<item row="11" column="0" colspan="5">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QSpinBox" name="m_bridge_point_0_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
@@ -146,35 +191,14 @@
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QSpinBox" name="m_y_terminal_3_sb">
<property name="maximum">
<number>1000</number>
<item row="5" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Borne niveau 1 :</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="m_y_terminal_0_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QSpinBox" name="m_width_spacer_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QSpinBox" name="m_width_terminal_2_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="9" column="0" colspan="5">
<item row="10" column="0" colspan="5">
<widget class="QWidget" name="widget" native="true">
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
@@ -189,26 +213,21 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="3">
<widget class="QComboBox" name="m_terminal_text_alignment_cb">
<item row="5" column="3">
<widget class="QComboBox" name="m_header_text_orientation_cb">
<item>
<property name="text">
<string>Gauche</string>
<string>Horizontal</string>
</property>
</item>
<item>
<property name="text">
<string>Centre</string>
</property>
</item>
<item>
<property name="text">
<string>Droite</string>
<string>Vertical</string>
</property>
</item>
</widget>
</item>
<item row="0" column="3">
<item row="6" column="3">
<widget class="QComboBox" name="m_header_text_alignment_cb">
<item>
<property name="text">
@@ -227,21 +246,136 @@
</item>
</widget>
</item>
<item row="0" column="2">
<item row="5" column="2">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Orientation</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Alignement du texte d'en tête :</string>
<string>Alignement</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_17">
<item row="1" column="2" colspan="4">
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>Police :</string>
</property>
</widget>
</item>
<item>
<widget class="QFontComboBox" name="m_font_cb"/>
</item>
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>Taille :</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="m_font_size_sb">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="label_20">
<property name="text">
<string>Alignement du texte de borne :</string>
<string>Texte d'en tête</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="7" column="2">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Origine vertical</string>
</property>
</widget>
</item>
<item row="8" column="2">
<widget class="QLabel" name="label_19">
<property name="text">
<string>Longueur maximal</string>
</property>
</widget>
</item>
<item row="7" column="4">
<widget class="QSpinBox" name="m_terminal_text_y_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="8" column="4">
<widget class="QSpinBox" name="m_terminal_text_height_sb">
<property name="minimum">
<number>30</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="6" column="4">
<widget class="QComboBox" name="m_terminal_text_alignment_cb">
<item>
<property name="text">
<string>Gauche</string>
</property>
</item>
<item>
<property name="text">
<string>Centre</string>
</property>
</item>
<item>
<property name="text">
<string>Droite</string>
</property>
</item>
</widget>
</item>
<item row="5" column="4">
<widget class="QComboBox" name="m_terminal_text_orientation_cb">
<item>
<property name="text">
@@ -255,8 +389,28 @@
</item>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="m_header_text_orientation_cb">
<item row="2" column="4">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Texte borne</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="5">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Référence croisée</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="5">
<widget class="QComboBox" name="m_xref_orientation_cb">
<item>
<property name="text">
<string>Horizontal</string>
@@ -269,23 +423,66 @@
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Orientation du texte de borne :</string>
<item row="6" column="5">
<widget class="QComboBox" name="m_xref_alignment_cb">
<item>
<property name="text">
<string>Gauche</string>
</property>
</item>
<item>
<property name="text">
<string>Centre</string>
</property>
</item>
<item>
<property name="text">
<string>Droite</string>
</property>
</item>
</widget>
</item>
<item row="7" column="5">
<widget class="QSpinBox" name="m_xref_y_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Orientation du texte d'en tête :</string>
<item row="8" column="5">
<widget class="QSpinBox" name="m_xref_height_sb">
<property name="minimum">
<number>30</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="2">
<widget class="QSpinBox" name="m_width_terminal_2_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="m_width_header_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>En tête :</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="m_height_header_sb">
<property name="maximum">
@@ -293,34 +490,6 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Borne niveau 2 :</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QSpinBox" name="m_width_terminal_0_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Espace :</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QSpinBox" name="m_width_terminal_3_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QSpinBox" name="m_y_terminal_2_sb">
<property name="maximum">
@@ -328,69 +497,55 @@
</property>
</widget>
</item>
<item row="6" column="4">
<widget class="QSpinBox" name="m_bridge_point_2_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="7" column="4">
<widget class="QSpinBox" name="m_bridge_point_3_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QSpinBox" name="m_width_terminal_1_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QSpinBox" name="m_height_terminal_0_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QSpinBox" name="m_height_terminal_1_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Borne niveau 3 :</string>
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QSpinBox" name="m_bridge_point_0_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Borne niveau 1 :</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="5">
<widget class="Line" name="line_2">
<item row="9" column="0" colspan="5">
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QSpinBox" name="m_y_terminal_3_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="m_y_terminal_1_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Hauteur</string>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Point de pont</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="m_y_terminal_0_sb">
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Prévisualisation :</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
@@ -811,6 +966,134 @@
</hint>
</hints>
</connection>
<connection>
<sender>m_font_cb</sender>
<signal>currentFontChanged(QFont)</signal>
<receiver>TerminalStripLayoutEditor</receiver>
<slot>valueEdited()</slot>
<hints>
<hint type="sourcelabel">
<x>245</x>
<y>276</y>
</hint>
<hint type="destinationlabel">
<x>445</x>
<y>277</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_font_size_sb</sender>
<signal>valueChanged(int)</signal>
<receiver>TerminalStripLayoutEditor</receiver>
<slot>valueEdited()</slot>
<hints>
<hint type="sourcelabel">
<x>507</x>
<y>277</y>
</hint>
<hint type="destinationlabel">
<x>445</x>
<y>277</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_terminal_text_y_sb</sender>
<signal>valueChanged(int)</signal>
<receiver>TerminalStripLayoutEditor</receiver>
<slot>valueEdited()</slot>
<hints>
<hint type="sourcelabel">
<x>207</x>
<y>383</y>
</hint>
<hint type="destinationlabel">
<x>445</x>
<y>277</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_terminal_text_height_sb</sender>
<signal>valueChanged(int)</signal>
<receiver>TerminalStripLayoutEditor</receiver>
<slot>valueEdited()</slot>
<hints>
<hint type="sourcelabel">
<x>430</x>
<y>383</y>
</hint>
<hint type="destinationlabel">
<x>445</x>
<y>277</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_xref_alignment_cb</sender>
<signal>currentIndexChanged(int)</signal>
<receiver>TerminalStripLayoutEditor</receiver>
<slot>valueEdited()</slot>
<hints>
<hint type="sourcelabel">
<x>836</x>
<y>365</y>
</hint>
<hint type="destinationlabel">
<x>480</x>
<y>311</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_xref_height_sb</sender>
<signal>valueChanged(int)</signal>
<receiver>TerminalStripLayoutEditor</receiver>
<slot>valueEdited()</slot>
<hints>
<hint type="sourcelabel">
<x>836</x>
<y>431</y>
</hint>
<hint type="destinationlabel">
<x>480</x>
<y>311</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_xref_orientation_cb</sender>
<signal>currentIndexChanged(int)</signal>
<receiver>TerminalStripLayoutEditor</receiver>
<slot>valueEdited()</slot>
<hints>
<hint type="sourcelabel">
<x>836</x>
<y>333</y>
</hint>
<hint type="destinationlabel">
<x>480</x>
<y>311</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_xref_y_sb</sender>
<signal>valueChanged(int)</signal>
<receiver>TerminalStripLayoutEditor</receiver>
<slot>valueEdited()</slot>
<hints>
<hint type="sourcelabel">
<x>836</x>
<y>398</y>
</hint>
<hint type="destinationlabel">
<x>480</x>
<y>311</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>valueEdited()</slot>

View File

@@ -30,11 +30,10 @@
TerminalStripTreeDockWidget::TerminalStripTreeDockWidget(QETProject *project, QWidget *parent) :
QDockWidget(parent),
ui(new Ui::TerminalStripTreeDockWidget),
m_project(project)
ui(new Ui::TerminalStripTreeDockWidget)
{
ui->setupUi(this);
buildTree();
setProject(project);
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
ui->m_tree_view->expandRecursively(ui->m_tree_view->rootIndex());
@@ -48,6 +47,32 @@ TerminalStripTreeDockWidget::~TerminalStripTreeDockWidget()
delete ui;
}
/**
* @brief TerminalStripTreeDockWidget::setProject
* Set @project as project handled by this tree dock.
* If a previous project was setted, everything is clear.
* This function track the destruction of the project,
* that mean if the project pointer is deleted
* no need to call this function with a nullptr,
* everything is made inside this class.
* @param project
*/
void TerminalStripTreeDockWidget::setProject(QETProject *project)
{
if(m_project && m_project_destroy_connection) {
disconnect(m_project_destroy_connection);
}
m_project = project;
if (m_project) {
m_project_destroy_connection = connect(m_project, &QObject::destroyed, [this](){
this->m_current_strip.clear();
this->reload();
});
}
m_current_strip.clear();
reload();
}
/**
* @brief TerminalStripTreeDockWidget::reload
*/
@@ -205,6 +230,9 @@ void TerminalStripTreeDockWidget::on_m_tree_view_currentItemChanged(QTreeWidgetI
*/
void TerminalStripTreeDockWidget::buildTree()
{
if(!m_project) {
return;
}
auto title_ = m_project->title();
if (title_.isEmpty()) {

View File

@@ -49,6 +49,7 @@ class TerminalStripTreeDockWidget : public QDockWidget
explicit TerminalStripTreeDockWidget(QETProject *project, QWidget *parent = nullptr);
~TerminalStripTreeDockWidget();
void setProject(QETProject *project = nullptr);
void reload();
bool currentIsStrip() const;
TerminalStrip* currentStrip() const;
@@ -74,11 +75,12 @@ class TerminalStripTreeDockWidget : public QDockWidget
QPointer<QETProject> m_project;
QPointer<TerminalStrip> m_current_strip;
QHash<QTreeWidgetItem *, TerminalStrip *> m_item_strip_H;
QHash<QTreeWidgetItem *, QPointer<TerminalStrip>> m_item_strip_H;
QHash<QUuid, QSharedPointer<RealTerminal>> m_uuid_terminal_H;
QHash<QUuid, QPointer<TerminalStrip>> m_uuid_strip_H;
QVector<QMetaObject::Connection> m_strip_changed_connection;
bool m_current_is_free_terminal{false};
bool m_current_is_free_terminal{false};
QMetaObject::Connection m_project_destroy_connection;
};
#endif // TERMINALSTRIPTREEDOCKWIDGET_H

View File

@@ -35,7 +35,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
// liste des pages
pages_list = new QListWidget();
pages_list -> setViewMode(QListView::IconMode);
if(MachineInfo::instance()->i_max_screen_height()<1000){
if(MachineInfo::instance()->i_max_screen_height() <= 1080){
pages_list -> setIconSize(QSize(64, 64));
} else {
pages_list -> setIconSize(QSize(128, 128));
@@ -69,7 +69,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
// Add a layout for QDialog
QVBoxLayout *dialog_layout = new QVBoxLayout(this);
dialog_layout->addWidget(scroll); // add scroll to the QDialog's layout
dialog_layout -> addWidget(scroll); // add scroll to the QDialog's layout
dialog_layout -> addWidget(buttons);
setLayout(dialog_layout);
@@ -79,9 +79,11 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
connect(pages_list, SIGNAL(currentRowChanged(int)),
pages_widget, SLOT(setCurrentIndex(int)));
setMaximumSize(MachineInfo::instance()->i_max_screen_width(),
MachineInfo::instance()->i_max_screen_height());
resize(1400,1000);
// set maximum a bit smaller than available size = (screen-size - Task-Bar):
setMaximumSize((int)(0.94 * MachineInfo::instance()->i_max_available_width()),
(int)(0.94 * MachineInfo::instance()->i_max_available_height()));
resize(std::min(1400,maximumWidth()),
std::min(1000,maximumHeight()));
#ifdef Q_OS_MACOS
if (parent) {

View File

@@ -1,5 +1,5 @@
/*
Copyright 2006-2021 QElectroTech Team
Copyright 2006-2025 QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify

View File

@@ -1,5 +1,5 @@
/*
Copyright 2006-2021 QElectroTech Team
Copyright 2006-2025 QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify

View File

@@ -59,7 +59,15 @@ DiagramContent::DiagramContent(Diagram *diagram, bool selected) :
{
switch (item->type())
{
case Element::Type: { m_elements << qgraphicsitem_cast<Element *>(item); break;}
case Element::Type:
{
auto element = qgraphicsitem_cast<Element *>(item);
m_elements << element;
if (element->elementData().m_type == ElementData::Terminal) {
m_terminal_elements << static_cast<TerminalElement*>(element);
}
break;
}
case IndependentTextItem::Type: { m_text_fields << qgraphicsitem_cast<IndependentTextItem *>(item); break;}
case Conductor::Type:
{

View File

@@ -21,6 +21,8 @@
#include <QSet>
#include <QVector>
#include "../qetgraphicsitem/terminalelement.h"
class QGraphicsItem;
class Conductor;
class Element;
@@ -81,6 +83,7 @@ class DiagramContent
QList<QGraphicsItem *> m_selected_items;
QVector<QetGraphicsTableItem *> m_tables;
QVector<TerminalStripItem *> m_terminal_strip;
QVector<QPointer<TerminalElement>> m_terminal_elements;
QList<DiagramTextItem *> selectedTexts() const;

View File

@@ -107,7 +107,7 @@ bool dxf2ElmtIsPresent(bool install_dialog, QWidget *parent)
"Veuillez télécharger celui-ci en suivant le lien ci dessous et le dézipper dans le dossier d'installation")};
ThirdPartyBinaryInstallDialog dialog_(string_,
QStringLiteral("https://github.com/antonioaja/dxf2elmt/releases"),
QStringLiteral("https://github.com/Vadoola/dxf2elmt/releases/tag/v0.5.1"),
dxf2ElmtDirPath(),
parent);
dialog_.exec();

View File

@@ -1,5 +1,5 @@
/*
Copyright 2006-2021 QElectroTech Team
Copyright 2006-2025 QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify

View File

@@ -446,6 +446,22 @@ int32_t MachineInfo::i_max_screen_height() {
return pc.screen.Max_height;
}
/**
@brief MachineInfo::i_max_available_width
@return max available width
*/
int32_t MachineInfo::i_max_available_width() {
return QGuiApplication::primaryScreen()->availableSize().width();
}
/**
@brief MachineInfo::i_max_available_height
@return max available height
*/
int32_t MachineInfo::i_max_available_height() {
return QGuiApplication::primaryScreen()->availableSize().height();
}
/**
@brief MachineInfo::compilation_info
@return compilation_info

View File

@@ -57,6 +57,8 @@ class MachineInfo
int32_t i_max_screen_width();
int32_t i_max_screen_height();
int32_t i_max_available_width();
int32_t i_max_available_height();
QString compilation_info();
void send_info_to_debug();

View File

@@ -1261,6 +1261,7 @@ QFont QETApp::diagramTextsFont(qreal size)
QFont diagram_texts_font = QFont(diagram_texts_family);
diagram_texts_font.setPointSizeF(diagram_texts_size);
diagram_texts_font.setWeight(diagram_texts_item_weight);
diagram_texts_font.setStyleHint(QFont::SansSerif);
diagram_texts_font.setStyleName(diagram_texts_item_style);
if (diagram_texts_size <= 4.0) {
diagram_texts_font.setWeight(QFont::Light);
@@ -1294,6 +1295,7 @@ QFont QETApp::diagramTextsItemFont(qreal size)
QFont diagram_texts_item_font = QFont(diagram_texts_item_family);
diagram_texts_item_font.setPointSizeF(diagram_texts_item_size);
diagram_texts_item_font.setWeight(diagram_texts_item_weight);
diagram_texts_item_font.setStyleHint(QFont::SansSerif);
diagram_texts_item_font.setStyleName(diagram_texts_item_style);
if (diagram_texts_item_size <= 4.0) {
diagram_texts_item_font.setWeight(QFont::Light);
@@ -1934,7 +1936,10 @@ void QETApp::configureQET()
// associe le dialogue a un eventuel widget parent
if (parent_widget) {
cd.setParent(parent_widget, cd.windowFlags());
cd.setMaximumSize(parent_widget->size());
cd.setMaximumWidth(std::min(parent_widget->width(),
(int)(0.94 * MachineInfo::instance()->i_max_available_width())));
cd.setMaximumHeight(std::min(parent_widget->height(),
(int)(0.94 * MachineInfo::instance()->i_max_available_height())));
}
// display the dialog then avoid linking it to any parent widget

View File

@@ -1469,12 +1469,21 @@ void QETDiagramEditor::selectionGroupTriggered(QAction *action)
if (!dv || value.isEmpty()) return;
if (value == "delete_selection")
{
diagram->clearSelection();
diagram->undoStack().push(new DeleteQGraphicsItemCommand(diagram, dc));
dv->adjustSceneRect();
}
if (value == "delete_selection")
{
if (DeleteQGraphicsItemCommand::hasNonDeletableTerminal(dc)) {
QET::QetMessageBox::information(this,
tr("Suppression de borne impossible"),
tr("La suppression ne peut être effectué car la selection "
"possède une ou plusieurs bornes ponté et/ou appartenant à une borne à niveau multiple.\n"
"Déponter et/ou supprimer les niveaux des bornes concerné "
"afin de pouvoir les supprimer"));
} else {
diagram->clearSelection();
diagram->undoStack().push(new DeleteQGraphicsItemCommand(diagram, dc));
dv->adjustSceneRect();
}
}
else if (value == "rotate_selection")
{
RotateSelectionCommand *c = new RotateSelectionCommand(diagram);

View File

@@ -54,6 +54,8 @@ class KAutoSaveFile;
class QETDiagramEditor : public QETMainWindow
{
Q_OBJECT
friend class TerminalStripEditorWindow;
public:
QETDiagramEditor(

View File

@@ -1,5 +1,5 @@
/*
Copyright 2006-2021 QElectroTech Team
Copyright 2006-2025 QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify

View File

@@ -229,43 +229,53 @@ void Conductor::updateConductorPath(const QPointF &p1, Qet::Orientation o1, cons
Q_ASSERT_X(!conductor_profile.isNull(), "Conductor::priv_modifieConductor", "pas de profil utilisable");
// recupere les coordonnees fournies des bornes
// retrieve the coordinates provided for the terminals
QPointF new_p1 = mapFromScene(p1);
QPointF new_p2 = mapFromScene(p2);
QRectF new_rect = QRectF(new_p1, new_p2);
// recupere la largeur et la hauteur du profil
// retrieve the width and height of the profile
qreal profile_width = conductor_profile.width();
qreal profile_height = conductor_profile.height();
// calcule les differences verticales et horizontales a appliquer
// calculates the vertical and horizontal differences to be applied
qreal h_diff = (qAbs(new_rect.width()) - qAbs(profile_width) ) * getSign(profile_width);
qreal v_diff = (qAbs(new_rect.height()) - qAbs(profile_height)) * getSign(profile_height);
// applique les differences aux segments
// apply the differences to the segments
QMultiHash<ConductorSegmentProfile *, qreal> segments_lengths;
segments_lengths.unite(shareOffsetBetweenSegments(h_diff, conductor_profile.horizontalSegments()));
segments_lengths.unite(shareOffsetBetweenSegments(v_diff, conductor_profile.verticalSegments()));
// en deduit egalement les coefficients d'inversion (-1 pour une inversion, +1 pour conserver le meme sens)
// also deduce the inversion coefficients (-1 for inversion, +1 to keep the same direction)
int horiz_coeff = getCoeff(new_rect.width(), profile_width);
int verti_coeff = getCoeff(new_rect.height(), profile_height);
// genere les nouveaux points
// generate the new points
QList<QPointF> points;
points << new_p1;
int limit = conductor_profile.segments.count() - 1;
for (int i = 0 ; i < limit ; ++ i) {
// dernier point
// last point
QPointF previous_point = points.last();
// profil de segment de conducteur en cours
// current conductor segment profile
ConductorSegmentProfile *csp = conductor_profile.segments.at(i);
// coefficient et offset a utiliser pour ce point
// coefficient and offset to be used for this point
qreal coeff = csp -> isHorizontal ? horiz_coeff : verti_coeff;
qreal offset_applied = segments_lengths.value(csp);
// applique l'offset et le coeff au point
// apply coefficient and offset to point
if (csp -> isHorizontal) {
points << QPointF (
previous_point.x() + (coeff * offset_applied),
@@ -989,16 +999,16 @@ void Conductor::pointsToSegments(const QList<QPointF>& points_list) {
/**
@brief Conductor::fromXml
Load the conductor and her information from xml element
Load the conductor and its information from xml element
@param dom_element
@return true is loading success else return false
@return true if loading succeeded else return false
*/
bool Conductor::fromXml(QDomElement &dom_element)
{
setPos(dom_element.attribute("x", nullptr).toDouble(),
dom_element.attribute("y", nullptr).toDouble());
bool return_ = pathFromXml(dom_element);
bool retval = pathFromXml(dom_element);
m_text_item -> fromXml(dom_element);
ConductorProperties pr;
@@ -1010,11 +1020,11 @@ bool Conductor::fromXml(QDomElement &dom_element)
else
m_autoNum_seq.fromXml(dom_element.firstChildElement("sequentialNumbers"));
m_freeze_label = dom_element.attribute("freezeLabel") == "true"? true : false;
m_freeze_label = dom_element.attribute("freezeLabel") == "true" ? true : false;
setProperties(pr);
return return_;
return retval;
}
/**
@@ -1134,13 +1144,14 @@ bool Conductor::pathFromXml(const QDomElement &e) {
}
}
//If there isn't segment we generate automatic path and return true
// If there is no segment, we generate an automatic path and return true
if (!segments_x.size()) {
generateConductorPath(terminal1 -> dockConductor(), terminal1 -> orientation(), terminal2 -> dockConductor(), terminal2 -> orientation());
return(true);
}
// les longueurs recueillies doivent etre coherentes avec les positions des bornes
// The collected lengths must be consistent with the positions of the terminals
qreal width = 0.0, height = 0.0;
foreach (qreal t, segments_x) width += t;
foreach (qreal t, segments_y) height += t;
@@ -1256,65 +1267,57 @@ ConductorSegment *Conductor::middleSegment()
*/
QPointF Conductor::posForText(Qt::Orientations &flag)
{
ConductorSegment *segment = segments;
bool all_segment_is_vertical = true;
bool all_segment_is_horizontal = true;
ConductorSegment *segment = segments;
bool all_segments_are_vertical = true;
bool all_segments_are_horizontal = true;
//Go to first segment
while (!segment->isFirstSegment()) {
segment = segment->previousSegment();
}
QPointF p1 = segment -> firstPoint(); //<First point of conductor
ConductorSegment *biggest_segment = segment; //<biggest segment: contain the longest segment of conductor.
ConductorSegment *longest_segment = segment; //<the longest segment of conductor.
// check if all segments are horizontal or vertical ... first segment:
if (segment -> firstPoint().x() != segment -> secondPoint().x())
all_segment_is_vertical = false;
all_segments_are_vertical = false;
if (segment -> firstPoint().y() != segment -> secondPoint().y())
all_segment_is_horizontal = false;
all_segments_are_horizontal = false;
// find longest segment
while (segment -> hasNextSegment())
{
segment = segment -> nextSegment();
if (segment -> firstPoint().x() != segment -> secondPoint().x())
all_segment_is_vertical = false;
all_segments_are_vertical = false;
if (segment -> firstPoint().y() != segment -> secondPoint().y())
all_segment_is_horizontal = false;
all_segments_are_horizontal = false;
//We must compare length segment, but they can be negative
//so we multiply by -1 to make it positive.
int saved = biggest_segment -> length();
if (saved < 0) saved *= -1;
int curent = segment->length();
if (curent < 0) curent *= -1;
if (curent > saved) biggest_segment = segment;
if (qAbs(segment->length()) > qAbs(longest_segment -> length()))
longest_segment = segment;
}
QPointF p2 = segment -> secondPoint();//<Last point of conductor
QPointF p2 = segment -> secondPoint(); //<Last point of conductor
//If the conductor is horizontal or vertical
//Return the point at the middle of conductor
if (all_segment_is_vertical) { //<Vertical
if (all_segments_are_vertical) { //<Vertical
flag = Qt::Vertical;
if (p1.y() > p2.y()) {
p1.setY(p1.y() - (length()/2));
} else {
p1.setY(p1.y() + (length()/2));
}
} else if (all_segment_is_horizontal) { //<Horizontal
} else if (all_segments_are_horizontal) { //<Horizontal
flag = Qt::Horizontal;
if (p1.x() > p2.x()) {
p1.setX(p1.x() - (length()/2));
} else {
p1.setX(p1.x() + (length()/2));
}
} else { //Return the point at the middle of biggest segment.
p1 = biggest_segment->middle();
flag = (biggest_segment->isHorizontal())? Qt::Horizontal : Qt::Vertical;
} else { //Return the point at the middle of longest segment.
p1 = longest_segment->middle();
flag = (longest_segment->isHorizontal())? Qt::Horizontal : Qt::Vertical;
}
return p1;
}
@@ -1420,7 +1423,7 @@ void Conductor::calculateTextItemPosition()
/**
Sauvegarde le profil courant du conducteur pour l'utiliser ulterieurement
dans priv_modifieConductor.
Save the current conductors profile for later use in priv_modifiedConductor.
Save the current conductors profile for later use in priv_modifieConductor.
*/
void Conductor::saveProfile(bool undo) {
Qt::Corner current_path_type = currentPathType();
@@ -1487,7 +1490,7 @@ ConductorProfile Conductor::profile(Qt::Corner path_type) const
/**
@brief Conductor::refreshText
Refresh the text of this conductor.
recalcule and set the text according to the formula.
recalculate and set the text according to the formula.
*/
void Conductor::refreshText()
{

View File

@@ -320,24 +320,7 @@ void CrossRefItem::paint(
void CrossRefItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
event->accept();
if (m_hovered_contact && m_hovered_contact->scene())
{
//Show and select the linked slave element
if (scene() != m_hovered_contact->scene())
{
m_hovered_contact->diagram()->showMe();
}
m_hovered_contact->setSelected(true);
//Zoom to the linked slave element
foreach(QGraphicsView *view,
m_hovered_contact->diagram()->views())
{
QRectF fit = m_hovered_contact->sceneBoundingRect();
fit.adjust(-200, -200, 200, 200);
view->fitInView(fit, Qt::KeepAspectRatioByExpanding);
}
}
QetGraphicsItem::showItem(m_hovered_contact);
}
/**

View File

@@ -1,5 +1,5 @@
/*
Copyright 2006-2021 QElectroTech Team
Copyright 2006-2025 QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify

View File

@@ -1277,18 +1277,8 @@ void DynamicElementTextItem::zoomToLinkedElement()
//move when linked element is in the same scene of this.
setSelected(false);
ungrabMouse();
if(scene() != zoomed_element->scene())
zoomed_element->diagram()->showMe();
zoomed_element->setSelected(true);
//Zoom to the element
for(QGraphicsView *view : zoomed_element->scene()->views())
{
QRectF fit = zoomed_element->sceneBoundingRect();
fit.adjust(-200, -200, 200, 200);
view->fitInView(fit, Qt::KeepAspectRatioByExpanding);
}
QetGraphicsItem::showItem(zoomed_element);
}
}

View File

@@ -35,6 +35,7 @@
#include "iostream"
#include "../qetxml.h"
#include "../qetversion.h"
#include "qgraphicsitemutility.h"
#include <QDomElement>
#include <utility>
@@ -236,7 +237,7 @@ void Element::paint(
//Draw the selection rectangle
if ( isSelected() || m_mouse_over ) {
drawSelection(painter, options);
QGIUtility::drawBoundingRectSelection(this, painter);
}
}
@@ -334,34 +335,6 @@ void Element::drawAxes(
/*** Methodes privees ***/
/**
Dessine le cadre de selection de l'element de maniere systematiquement non antialiasee.
@param painter Le QPainter a utiliser pour dessiner les bornes.
@param options Les options de style a prendre en compte
*/
void Element::drawSelection(
QPainter *painter,
const QStyleOptionGraphicsItem *options)
{
Q_UNUSED(options)
painter -> save();
// Annulation des renderhints
painter -> setRenderHint(QPainter::Antialiasing, false);
painter -> setRenderHint(QPainter::TextAntialiasing, false);
painter -> setRenderHint(QPainter::SmoothPixmapTransform, false);
// Dessin du cadre de selection en gris
QPen t;
t.setColor(Qt::gray);
t.setStyle(Qt::DashDotLine);
t.setCosmetic(true);
painter -> setPen(t);
// Le dessin se fait a partir du rectangle delimitant
painter -> drawRoundedRect(boundingRect().adjusted(1, 1, -1, -1),
10,
10);
painter -> restore();
}
/**
Dessine le cadre de selection de l'element de maniere systematiquement non antialiasee.
@param painter Le QPainter a utiliser pour dessiner les bornes.

View File

@@ -198,9 +198,6 @@ class Element : public QetGraphicsItem
void setSize(int, int);
private:
void drawSelection(
QPainter *,
const QStyleOptionGraphicsItem *);
void drawHighlight(
QPainter *,
const QStyleOptionGraphicsItem *);

View File

@@ -24,12 +24,31 @@
Default constructor
@param parent : Parent Item
*/
void QetGraphicsItem::showItem(QetGraphicsItem *item)
{
if (item && item->diagram())
{
item->diagram()->showMe();
item->setSelected(true);
//Zoom to the item
for(QGraphicsView *view : item->scene()->views())
{
QRectF fit = item->sceneBoundingRect();
fit.adjust(-200, -200, 200, 200);
view->fitInView(fit, Qt::KeepAspectRatioByExpanding);
}
}
}
QetGraphicsItem::QetGraphicsItem(QGraphicsItem *parent):
QGraphicsObject(parent),
is_movable_(true),
m_first_move(true),
snap_to_grid_(true)
{}
{
setAcceptHoverEvents(true);
}
QetGraphicsItem::~QetGraphicsItem()
{}
@@ -68,6 +87,11 @@ bool QetGraphicsItem::isHovered() const {
return m_hovered;
}
QPointF QetGraphicsItem::hoverMousePos() const
{
return m_mouse_hover_pos;
}
/**
@brief QetGraphicsItem::state
@return the current state of this item
@@ -166,6 +190,12 @@ void QetGraphicsItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
QGraphicsObject::hoverEnterEvent(event);
}
void QetGraphicsItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
QGraphicsObject::hoverMoveEvent(event);
m_mouse_hover_pos = event->pos();
}
void QetGraphicsItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
m_hovered = false;

View File

@@ -28,6 +28,9 @@ class QetGraphicsItem : public QGraphicsObject
{
Q_OBJECT
public :
static void showItem (QetGraphicsItem *item);
public:
//constructor destructor
QetGraphicsItem(QGraphicsItem *parent = nullptr);
@@ -43,6 +46,7 @@ class QetGraphicsItem : public QGraphicsObject
virtual void setMovable (bool movable) { is_movable_ = movable;}
bool isHovered() const;
QPointF hoverMousePos() const;
virtual void editProperty () {}
virtual QString name ()const
@@ -57,6 +61,7 @@ class QetGraphicsItem : public QGraphicsObject
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override;
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
protected:
@@ -68,6 +73,7 @@ class QetGraphicsItem : public QGraphicsObject
private:
bool m_hovered{false};
QPointF m_mouse_hover_pos;
};

View File

@@ -18,8 +18,6 @@
#include "slaveelement.h"
#include "../diagram.h"
#include "../diagramposition.h"
#include "../qetapp.h"
#include "dynamicelementtextitem.h"
/**
@@ -33,9 +31,7 @@ SlaveElement::SlaveElement(const ElementsLocation &location,
QGraphicsItem *qgi,
int *state) :
Element(location, qgi, state, Element::Slave)
{
m_xref_item = nullptr;
}
{}
/**
@brief SlaveElement::~SlaveElement

View File

@@ -18,7 +18,6 @@
#ifndef SLAVEELEMENT_H
#define SLAVEELEMENT_H
#include "../properties/xrefproperties.h"
#include "element.h"
class SlaveElement : public Element
@@ -33,9 +32,6 @@ class SlaveElement : public Element
void linkToElement(Element *elmt) override;
void unlinkAllElements() override;
void unlinkElement(Element *elmt) override;
private:
QGraphicsTextItem *m_xref_item;
};
#endif // SLAVEELEMENT_H

View File

@@ -953,4 +953,93 @@ bool qGraphicsItemPosFromXml(QGraphicsItem *item, const QDomElement &xml_elmt)
return false;
}
/**
* @brief orientationToAttribute
* Write the Qt::orientation has an attribute of @param element.
* Attribute name is 'orientation' value is 'horizontal' or 'vertical'
* @param orientation
* @param element
*/
void orientationToAttribute(const Qt::Orientation &orientation, QDomElement &element)
{
element.setAttribute(QStringLiteral("orientation"),
orientation == Qt::Horizontal ? QStringLiteral("Horizontal") :
QStringLiteral("Vertical"));
}
/**
* @brief orientationFromAttribute
* @param element
* @param def_value
* @return the Qt::Orientation read in @param element. If an error occur
* the returned orientation is @param def_value.
*/
Qt::Orientation orientationFromAttribute(const QDomElement &element, Qt::Orientation def_value)
{
if (element.hasAttribute(QStringLiteral("orientation"))) {
const auto str {element.attribute(QStringLiteral("orientation"))};
if (str == QLatin1String("Horizontal"))
return Qt::Horizontal;
else if (str == QLatin1String("Vertical"))
return Qt::Vertical;
}
//Error occur during reading, we return the default value
return def_value;
}
void alignmentToAttribute(const Qt::Alignment &alignment, QDomElement &element)
{
QStringList al;
if (alignment &Qt::AlignLeft)
al.append(QStringLiteral("Left"));
if (alignment &Qt::AlignRight)
al.append(QStringLiteral("Right"));
if (alignment &Qt::AlignHCenter)
al.append(QStringLiteral("HCenter"));
if (alignment &Qt::AlignJustify)
al.append(QStringLiteral("Justify"));
if (alignment &Qt::AlignTop)
al.append(QStringLiteral("Top"));
if (alignment &Qt::AlignBottom)
al.append(QStringLiteral("Bottom"));
if (alignment &Qt::AlignBottom)
al.append(QStringLiteral("VCenter"));
if (alignment &Qt::AlignBaseline)
al.append(QStringLiteral("Baseline"));
element.setAttribute(QStringLiteral("alignment"),al.join(QStringLiteral(" ")));
}
/**
* @brief alignmentFromAttribute
* @param element
* @return The alignment read in @param element. If an error
* occured the return Qt::alignment contain no set flag.
*/
Qt::Alignment alignmentFromAttribute(const QDomElement &element)
{
Qt::Alignment al;
if (element.hasAttribute(QStringLiteral("alignment"))) {
const auto alignment {element.attribute(QStringLiteral("alignment"))};
if(alignment.contains(QStringLiteral("Left")))
al = al | Qt::AlignLeft;
if(alignment.contains(QStringLiteral("Right")))
al = al | Qt::AlignRight;
if(alignment.contains(QStringLiteral("HCenter")))
al = al | Qt::AlignHCenter;
if(alignment.contains(QStringLiteral("Justify")))
al = al | Qt::AlignJustify;
if(alignment.contains(QStringLiteral("Top")))
al = al | Qt::AlignTop;
if(alignment.contains(QStringLiteral("Bottom")))
al = al | Qt::AlignBottom;
if(alignment.contains(QStringLiteral("VCenter")))
al = al | Qt::AlignVCenter;
if(alignment.contains(QStringLiteral("Baseline")))
al = al | Qt::AlignBaseline;
}
return al;
}
}

View File

@@ -94,6 +94,12 @@ namespace QETXML
QDomElement qGraphicsItemPosToXml(QGraphicsItem *item, QDomDocument &document);
bool qGraphicsItemPosFromXml(QGraphicsItem *item, const QDomElement &xml_elmt);
void orientationToAttribute(const Qt::Orientation &orientation, QDomElement &element);
Qt::Orientation orientationFromAttribute(const QDomElement &element, Qt::Orientation def_value = Qt::Vertical);
void alignmentToAttribute(const Qt::Alignment &alignment, QDomElement &element);
Qt::Alignment alignmentFromAttribute (const QDomElement &element);
QString boolToString(bool value);
bool boolFromString(const QString &value,
bool default_value = true,

151
sources/svg/qetsvg.cpp Normal file
View File

@@ -0,0 +1,151 @@
/*
Copyright 2006-2025 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/>.
*/
#include "qetsvg.h"
#include <QDomDocument>
#include <QRect>
#include <../qet.h>
/**
* @brief QETSVG::rectToElmt
* Write a QRect as a svg rect element.
* @param rect
* @param parent_document
* @return
*/
QDomElement QETSVG::rectToElmt(const QRectF &rect, QDomDocument &parent_document)
{
auto dom_element = parent_document.createElement(QStringLiteral("rect"));
if (!rect.isNull()) {
dom_element.setAttribute(QStringLiteral("x"), rect.x());
yToAttribute(rect.y(), dom_element);
dom_element.setAttribute(QStringLiteral("width"), rect.width());
heightToAttribute(rect.height(), dom_element);
}
return dom_element;
}
/**
* @brief QETSVG::rectFromElmt
* @param xml_element : xml_element of an svg rect.
* The tag name must be 'rect' if not, the returned QRect is null.
* @return a svg rect to QRect
*/
QRectF QETSVG::rectFromElmt(const QDomElement &xml_element)
{
QRectF rect_;
if (xml_element.tagName() == QLatin1String("rect")) {
rect_.setRect(xml_element.attribute(QStringLiteral("x"), QStringLiteral("0")).toDouble(),
yFromAttribute(xml_element, 0),
xml_element.attribute(QStringLiteral("width"), QStringLiteral("10")).toDouble(),
heightFromAttribute(xml_element, 10));
}
return rect_;
}
/**
* @brief QETSVG::yToAttribute
* @param y
* @param xml_element
*/
void QETSVG::yToAttribute(const qreal &y, QDomElement &xml_element) {
xml_element.setAttribute(QStringLiteral("y"), QString::number(y));
}
/**
* @brief QETSVG::yFromAttribute
* @param xml_element
* @param def_value
* @return
*/
qreal QETSVG::yFromAttribute(const QDomElement &xml_element, const qreal &def_value) {
qreal value_;
if (QET::attributeIsAReal(xml_element, QStringLiteral("y"), &value_)) {
return value_;
}
return def_value;
}
/**
* @brief QETSVG::heightToAttribute
* @param height
* @param xml_element
*/
void QETSVG::heightToAttribute(const qreal &height, QDomElement &xml_element) {
xml_element.setAttribute(QStringLiteral("height"), QString::number(height));
}
qreal QETSVG::heightFromAttribute(const QDomElement &xml_element, const qreal &def_value) {
qreal value_;
if (QET::attributeIsAReal(xml_element, QStringLiteral("height"), &value_)) {
return value_;
}
return def_value;
}
void QETSVG::rToAttribute(const qreal &r, QDomElement &xml_element) {
xml_element.setAttribute(QStringLiteral("r"), QString::number(r));
}
qreal QETSVG::rFromAttribute(const QDomElement &xml_element, const qreal &def_value) {
qreal value_;
if (QET::attributeIsAReal(xml_element, QStringLiteral("r"), &value_)) {
return value_;
}
return def_value;
}
void QETSVG::pointsToAttribute(const QVector<QPointF> &points, QDomElement &xml_element)
{
QStringList strl_;
for (const auto &point : points) {
strl_.append(QString::number(point.x()) +
QString(",") +
QString::number(point.y()));
}
xml_element.setAttribute(QStringLiteral("points"), strl_.join(" "));
}
/**
* @brief QETSVG::pointsFromAttribute
* @param xml_element
* @return a vector of points stored in attribute 'points' of @xml_element.
* The returned vector can be empty.
*/
QVector<QPointF> QETSVG::pointsFromAttribute(const QDomElement &xml_element)
{
QVector<QPointF> vector_;
if (const auto string_points = xml_element.attribute(QStringLiteral("points")).split(QStringLiteral(" ")) ;
!string_points.isEmpty()) {
bool x_ok, y_ok; for (const auto &point : string_points) {
const auto string_x_y = point.split(QStringLiteral(","));
if (string_x_y.size() == 2) {
const auto x = string_x_y[0].toDouble(&x_ok);
const auto y = string_x_y[1].toDouble(&y_ok);
if (x_ok && y_ok) {
vector_.append(QPointF{x,y});
}
}
}
}
return vector_;
}

51
sources/svg/qetsvg.h Normal file
View File

@@ -0,0 +1,51 @@
/*
Copyright 2006-2025 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/>.
*/
#ifndef QETSVG_H
#define QETSVG_H
#include <QDomElement>
class QDomDocument;
class QPointF;
class QRectF;
/**
* @namespace QETSVG
* @brief the QETSVG namespace provide function read and write svg.
* Some function work on xml element (ex rect) and some other
* work on attribute of an element (ex x)
*/
namespace QETSVG
{
QDomElement rectToElmt(const QRectF &rect, QDomDocument &parent_document);
QRectF rectFromElmt(const QDomElement &xml_element);
void yToAttribute(const qreal &y, QDomElement &xml_element);
qreal yFromAttribute(const QDomElement &xml_element, const qreal &def_value=0);
void heightToAttribute(const qreal &height, QDomElement &xml_element);
qreal heightFromAttribute(const QDomElement &xml_element, const qreal &def_value=10);
void rToAttribute(const qreal &r, QDomElement &xml_element);
qreal rFromAttribute(const QDomElement &xml_element, const qreal &def_value=1);
void pointsToAttribute(const QVector<QPointF> &points, QDomElement &xml_element);
QVector<QPointF> pointsFromAttribute (const QDomElement &xml_element);
}
#endif // QETSVG_H

View File

@@ -178,7 +178,7 @@ void AboutQETDialog::setAnnexProject()
addLibrary(ui->m_annex_project_label, tr("Générateur d'élément lambda", "Lambda element generator"),
"https://github.com/asnigma/qet_gen_element");
addLibrary(ui->m_annex_project_label, tr("Convertisseur d'élément DXF", "Dxf2elmt"),
"https://github.com/antonioaja/dxf2elmt");
"https://github.com/Vadoola/dxf2elmt");
addLibrary(ui->m_annex_project_label, tr("Outil de traduction d'éléments", "Qet_translate"),
"https://qelectrotech.org/forum/viewtopic.php?pid=16027#p16027");

View File

@@ -21,6 +21,7 @@
#include "../../qeticons.h"
#include "ui_generalconfigurationpage.h"
#include "../../utils/qetsettings.h"
#include "../../qetmessagebox.h"
#include <QFileDialog>
#include <QFontDialog>
@@ -83,7 +84,6 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
ui->m_use_gesture_trackpad->setChecked(settings.value("diagramview/gestures", false).toBool());
ui->m_save_label_paste->setChecked(settings.value("diagramcommands/erase-label-on-copy", true).toBool());
ui->m_use_folio_label->setChecked(settings.value("genericpanel/folio", true).toBool());
ui->m_export_terminal->setChecked(settings.value("nomenclature-exportlist", true).toBool());
ui->m_border_0->setChecked(settings.value("border-columns_0", false).toBool());
ui->m_autosave_sb->setValue(settings.value("diagrameditor/autosave-interval", 0).toInt());
@@ -224,9 +224,6 @@ void GeneralConfigurationPage::applyConf()
//GENERIC PANEL
settings.setValue("genericpanel/folio",ui->m_use_folio_label->isChecked());
//NOMENCLATURE
settings.setValue("nomenclature/terminal-exportlist",ui->m_export_terminal->isChecked());
//DIAGRAM EDITOR
QString view_mode = ui->m_use_tab_mode_rb->isChecked() ? "tabbed" : "windowed";
@@ -564,3 +561,29 @@ void GeneralConfigurationPage::on_ElementEditor_Grid_PointSize_min_sb_valueChang
{
ui->ElementEditor_Grid_PointSize_max_sb->setMinimum(std::max(1, value));
}
void GeneralConfigurationPage::on_m_hdpi_round_cb_clicked(bool checked)
{
if (checked) {
if (QMessageBox::Cancel == QET::QetMessageBox::warning(
this,
tr("Fonctionnalité expérimental"),
tr("AVERTISSEMENT :\n"
"Toutes valeurs autre que Pas darrondi peut causer des erreurs de rendu "
"du projet en fonction de :\n\n"
"1 - la valeur sélectionnée \n"
"2 - du dpi de l'écran \n"
"3 - Modifier le projet sur un autre ordinateur et/ou écran n'ayant pas les mêmes paramètres des points 1 et 2."),
QMessageBox::StandardButton::Cancel|QMessageBox::StandardButton::Ok,
QMessageBox::StandardButton::Cancel
)) {
ui->m_hdpi_round_cb->blockSignals(true);
ui->m_hdpi_round_cb->setChecked(false);
ui->m_hdpi_round_cb->blockSignals(false);
return;
}
}
ui->m_hdpi_round_label->setEnabled(checked);
ui->m_hdpi_round_policy_cb->setEnabled(checked);
}

View File

@@ -51,6 +51,8 @@ class GeneralConfigurationPage : public ConfigPage
void on_DiagramEditor_Grid_PointSize_min_sb_valueChanged(int value);
void on_ElementEditor_Grid_PointSize_min_sb_valueChanged(int value);
void on_m_hdpi_round_cb_clicked(bool checked);
private:
void fillLang();

View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>872</width>
<width>955</width>
<height>556</height>
</rect>
</property>
@@ -17,7 +17,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">
@@ -82,7 +82,7 @@
</item>
<item>
<widget class="QWidget" name="m_hdpi_round_policy_widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,1">
<property name="leftMargin">
<number>0</number>
</property>
@@ -96,14 +96,28 @@
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<widget class="QCheckBox" name="m_hdpi_round_cb">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_hdpi_round_label">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Méthode de mise à l'echelle des écrans à haute densité de pixels (hdpi) (appliqué au prochain lancement de QElectroTech) :</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="m_hdpi_round_policy_cb"/>
<widget class="QComboBox" name="m_hdpi_round_policy_cb">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
@@ -128,41 +142,21 @@
<string>Projets</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="4" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="1" column="0">
<widget class="QCheckBox" name="m_use_folio_label">
<property name="text">
<string>Utiliser les numéros de folio à la place de leur position dans le projet</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</widget>
</item>
<item row="4" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Sauvegarde automatique des projets (appliqué au prochain lancement de QElectroTech)</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="m_save_label_paste">
<property name="text">
<string>Ne pas conserver les labels des éléments lors des copier coller</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="m_border_0">
<property name="text">
<string extracomment="Choix de l'increment de depart 1 ou 0">Numéroter les colonnes de cartouche à partir de 0 (1 sinon)</string>
</property>
</widget>
</item>
<item row="4" column="2">
<item row="3" column="2">
<widget class="QSpinBox" name="m_autosave_sb">
<property name="frame">
<bool>true</bool>
@@ -184,14 +178,14 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="m_use_folio_label">
<item row="0" column="0">
<widget class="QCheckBox" name="m_save_label_paste">
<property name="text">
<string>Utiliser les numéros de folio à la place de leur position dans le projet</string>
<string>Ne pas conserver les labels des éléments lors des copier coller</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="4" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -204,10 +198,23 @@
</property>
</spacer>
</item>
<item row="3" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="m_export_terminal">
<widget class="QCheckBox" name="m_border_0">
<property name="text">
<string>Exporter les bornes dans la nomenclature</string>
<string extracomment="Choix de l'increment de depart 1 ou 0">Numéroter les colonnes de cartouche à partir de 0 (1 sinon)</string>
</property>
</widget>
</item>
@@ -1090,7 +1097,6 @@ Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments
<tabstop>m_use_tab_mode_rb</tabstop>
<tabstop>m_save_label_paste</tabstop>
<tabstop>m_use_folio_label</tabstop>
<tabstop>m_export_terminal</tabstop>
<tabstop>m_border_0</tabstop>
<tabstop>m_autosave_sb</tabstop>
<tabstop>m_common_elmt_path_cb</tabstop>

View File

@@ -146,7 +146,6 @@ void DynamicElementTextItemEditor::setCurrentText(DynamicElementTextItem *text)
return;
ui->m_tree_view->expand(index);
// ui->m_tree_view->expand(index.QModelIndex::model()->index(0,0)); // commented by plc-user: leads to crash, when other textitem was selected before
ui->m_tree_view->setCurrentIndex(index);
ui->m_remove_selection->setEnabled(true);
}

View File

@@ -28,6 +28,8 @@
#include "../qetgraphicsitem/elementtextitemgroup.h"
#include "../qetgraphicsitem/terminal.h"
#include "addelementtextcommand.h"
#include "../TerminalStrip/realterminal.h"
#include "../TerminalStrip/physicalterminal.h"
/**
@brief DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand
@@ -115,6 +117,36 @@ DeleteQGraphicsItemCommand::~DeleteQGraphicsItemCommand()
m_diagram->qgiManager().release(m_removed_contents.items(DiagramContent::All));
}
/**
* @brief DeleteQGraphicsItemCommand::hasNonDeletableTerminal
* Return true if @content have terminal element which can't be deleted.
* The reason why a terminal can't be deleted is because they have bridge
* or belong to a physical terminal with more than one level.
* @param diagram
* @param content
* @param dialog
* @return
*/
bool DeleteQGraphicsItemCommand::hasNonDeletableTerminal(const DiagramContent &content)
{
if (!content.m_terminal_elements.isEmpty())
{
for (const auto &terminal : content.m_terminal_elements)
{
if (!terminal.isNull())
{
if (terminal->parentTerminalStrip()
&& (terminal->realTerminal()->isBridged()
|| terminal->realTerminal()->physicalTerminal()->levelCount() != 1)) {
return true;
}
}
}
}
return false;
}
/**
@brief DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements
This function creates new conductors (if needed) for conserve the electrical potentials

View File

@@ -34,10 +34,10 @@ class DeleteQGraphicsItemCommand : public QUndoCommand
public:
DeleteQGraphicsItemCommand(Diagram *diagram, const DiagramContent &content, QUndoCommand * parent = nullptr);
~DeleteQGraphicsItemCommand() override;
static bool hasNonDeletableTerminal(const DiagramContent &content);
private:
DeleteQGraphicsItemCommand(const DeleteQGraphicsItemCommand &);
void setPotentialsOfRemovedElements();
Terminal *terminalInSamePotential(Terminal *terminal, Conductor *conductor_to_exclude);

View File

@@ -1,5 +1,5 @@
/*
Copyright 2006-2022 The QElectroTech Team
Copyright 2006-2025 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify

Some files were not shown because too many files have changed in this diff Show More