Compare commits

...

21 Commits

Author SHA1 Message Date
plc-user 26f6f6d36e Merge pull request #727 from zi-mozhuang/zh
Fix print window clipping diagram when titleblock on right edge is hidden.

Fixes a frequently made mistake: confusing width and height when rotating something...   😉
2026-08-13 18:04:19 +02:00
plc-user 293dc92b41 Merge pull request #738 from ispyisail/fix/exclude-from-bom-ghost-row
Fix nameless "false" row in the element Informations panel
2026-08-13 17:56:40 +02:00
ispyisail 61a509e5d8 Fix nameless "false" row in the element Informations panel
"exclude_from_bom" is listed in QETInformation::elementInfoKeys() so the
project database can build the element_info table column for it, but it
is not a free-text property: ElementInfoWidget already gives it its own
"Exclure de la nomenclature" check box.

Because buildInterface() creates one ElementInfoPartWidget per key in
that list, the key also got a second, generic edit row. And since
translatedInfoKey() has no case for it and falls through to
"return QString()", that row carries no label at all - an anonymous edit
line at the bottom of the panel. currentInfo() then writes
exclude_from_bom unconditionally, so as soon as the user edits anything
the nameless row fills with "true"/"false".

Drop the key from the list buildInterface() iterates. The check box
remains the only way to set it, currentInfo() still writes it exactly as
before, elementInfoKeys() is untouched so the database schema and
elementquerywidget are unaffected, and predefinedKeys() already excluded
it from the custom-property rows.

Reported by plc-user on #642.
2026-08-13 21:24:50 +12:00
Laurent Trinques 2186d2733f Merge pull request #709 from arummler/master-continue-qt6-migration
Qt6 migration beyond signal/slot
2026-08-13 10:55:47 +02:00
子墨庄 b0172f4dd7 Change comment style for title block edge method
Updated comment to use Doxygen style for documentation.
2026-08-13 08:50:24 +08:00
Andre Rummler 1de9f7eaf0 The Qt6 CMake signatures for translation handling changed multiple times with minor versions. 2026-08-12 22:37:46 +02:00
Andre Rummler d2a921ea80 Fixing MacOS only GUI adjustment relying on QWheelEvent->delta() which was removed in Qt6. Some simplification was possible but no test due to lack of OS.
Discovered due to new CI.
2026-08-12 12:29:56 +02:00
Andre Rummler a4d23fe312 QUuid and QHash no longer transititve. Adding includes explicitly. 2026-08-12 12:29:56 +02:00
Andre Rummler 8cfb777fe1 Fixing the translation installation for Qt5. Messed up the order of two lines. 2026-08-12 12:29:56 +02:00
Andre Rummler 8d08c3fd56 Replacing depreciated qAsConst with std::as_const 2026-08-12 12:29:56 +02:00
Andre Rummler 766a6b981d QUuid not transitively included in Qt6; added explicit includes. 2026-08-12 12:29:56 +02:00
Andre Rummler 8b40134a47 sources/qetgraphicsitem/ViewItem/projectdbmodel.cpp
QVector<int>(Qt::DisplayRole) creates a vector of size 0 (since  Qt::DisplayRole == 0), not a vector containing DisplayRole. Fixed
to {Qt::DisplayRole}.

The sam applies to QVector<int>(role) which gets changed to {role}.
2026-08-12 12:29:56 +02:00
Andre Rummler cc032c9c76 Fixing comment removing the long dash that AIs tend to use. 2026-08-12 12:29:56 +02:00
Andre Rummler 92b2608bfb Comments in CMake with # and not //... always remember the language you are currently using. 2026-08-12 12:29:56 +02:00
Andre Rummler af87d28e33 Fix several parameters after Qt6 migration. 2026-08-12 12:29:56 +02:00
Andre Rummler c5d714089f Replacing KF5 missed in shell print out. 2026-08-12 12:29:56 +02:00
Shane Ringrose 206c37f620 cmake(qt6): verify Qt6::GuiPrivate at configure time, drop #warning
<private/qpdf_p.h> (QPdfEngine::drawHyperlink) needs Qt's private GUI
module, previously flagged only by a #warning at compile time.

Qt >= 6.7 ships GuiPrivate as a proper find_package component, but some
distro packages (e.g. Ubuntu's qt6-base-private-dev, Qt 6.8.3) do not
install Qt6GuiPrivateConfig.cmake and only provide the implicit
Qt6::GuiPrivate target created alongside Qt6::Gui. Requesting the
component unconditionally would therefore break distro-Qt builds.

Instead: try the component quietly, then hard-verify the Qt6::GuiPrivate
target exists after the main find_package, failing at configure time
with an actionable message if the private headers are missing. The
compile-time #warning in pdf_links.cpp and projectprintwindow.cpp is
now redundant and removed.

Verified: cmake configure + compile of both translation units on
Ubuntu 25.04 / Qt 6.8.3 (system KF6), cmake configure on Qt 5.15.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-12 12:29:56 +02:00
Andre Rummler c14d6a6dd6 In order to migrate to Qt6 all options for KF6 were added:
a) using a system provided KF6
b) downloading and compiling KF6
c) using the vendored-in re-creation of the functionality

The behaviour for both Qt5 and Qt6 is steered with the same two variables which were renamed to become version agnostic:
a) BUILD_WITH_KF=ON BUILD_KF=OFF
b) BUILD_WITH_KF=ON BUILD_KF=ON
c) BUILD_WITH_KF=OFF

The version is automatically derived from the chosen Qt major version.
2026-08-12 12:29:56 +02:00
zi-mozhuang e32e5595c0 syn 2026-08-12 15:20:03 +08:00
zi-mozhuang 1684d2cfe6 syn 2026-08-12 15:13:52 +08:00
zi-mozhuang 6f66745ce3 Apply minimal title block fix to zh (from c77f78e4a) 2026-08-12 15:07:52 +08:00
32 changed files with 258 additions and 128 deletions
+2 -2
View File
@@ -113,7 +113,7 @@ jobs:
-DQt5_DIR=/ucrt64/lib/cmake/Qt5 \
-DQT_VERSION_MAJOR=5 \
-DCMAKE_DISABLE_FIND_PACKAGE_Qt6=ON \
-DBUILD_TESTING=OFF \
-DPACKAGE_TESTS=OFF \
-DCMAKE_POLICY_DEFAULT_CMP0077=NEW \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_CXX_FLAGS="-DQET_EXPORT_PROJECT_DB" \
@@ -456,7 +456,7 @@ jobs:
-DCMAKE_PREFIX_PATH=/ucrt64 \
-DQt6_DIR=/ucrt64/lib/cmake/Qt6 \
-DQT_VERSION_MAJOR=6 \
-DBUILD_WITH_KF5=OFF \
-DBUILD_WITH_KF=OFF \
-DPACKAGE_TESTS=OFF \
-DCMAKE_POLICY_DEFAULT_CMP0077=NEW \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
+111 -30
View File
@@ -48,19 +48,11 @@ endif()
# INTERFACE_QT_MAJOR_VERSION mismatch at generate time.
set(QT_DEFAULT_MAJOR_VERSION ${QT_VERSION_MAJOR} CACHE STRING "Qt version to use (5 or 6)" FORCE)
# Add sub directories
option(PACKAGE_TESTS "Build the tests" ON)
if(PACKAGE_TESTS)
message("Add sub directory tests")
add_subdirectory(tests)
endif()
include(cmake/paths_compilation_installation.cmake)
include(cmake/start_options.cmake)
include(cmake/developer_options.cmake)
include(cmake/git_update_submodules.cmake)
include(cmake/git_last_commit_sha.cmake)
include(cmake/fetch_kdeaddons.cmake)
include(cmake/fetch_singleapplication.cmake)
include(cmake/fetch_pugixml.cmake)
include(cmake/qet_compilation_vars.cmake)
@@ -78,12 +70,23 @@ find_package(
${QET_COMPONENTS}
REQUIRED)
# Qt6 only creates the Qt::GuiPrivate target (used for QPdfEngine::drawHyperlink)
# when the GuiPrivate component is explicitly requested. Qt5 has no such
# component package and creates the target implicitly with Gui, so only
# request it on Qt6 - requesting it on Qt5 fails the whole configure.
# <private/qpdf_p.h> (QPdfEngine::drawHyperlink) needs Qt's private GUI module.
# Qt >= 6.7 ships it as a proper find_package component, but some distro
# packages (e.g. Ubuntu's qt6-base-private-dev) omit Qt6GuiPrivateConfig.cmake
# and only provide the implicit Qt6::GuiPrivate target created alongside
# Qt6::Gui. Try the component quietly, then verify the target below so a
# missing private-headers package fails here instead of at compile time.
# Qt5 has no such component as its GuiPrivate target always exists once Gui is found.
if(QT_VERSION_MAJOR GREATER_EQUAL 6)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS GuiPrivate)
find_package(Qt6 QUIET COMPONENTS GuiPrivate)
endif()
if(QT_VERSION_MAJOR GREATER_EQUAL 6 AND NOT TARGET Qt6::GuiPrivate)
message(FATAL_ERROR
"Qt6::GuiPrivate was not found. It is required for PDF hyperlink "
"support (<private/qpdf_p.h>). Install the Qt6 private headers "
"(e.g. 'qt6-base-private-dev' on Debian/Ubuntu) or use a Qt build "
"that provides the GuiPrivate component.")
endif()
find_package(SQLite3 REQUIRED)
@@ -100,25 +103,19 @@ endif()
set(CMAKE_AUTOUIC_SEARCH_PATHS ${QET_DIR}/sources/ui)
# The default build only compiles the tracked .ts files to .qm (lrelease).
# Refreshing the .ts from the sources (lupdate) is a developer action behind
# the explicit "update_translations" target below: running lupdate on every
# build rewrote tracked files as a side effect, and under high parallelism
# lupdate rewriting a .ts while lrelease read the same file made the build
# fail with "Premature end of document".
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${QET_DIR}/lang")
if(QT_VERSION_MAJOR EQUAL 6)
qt6_add_translation(QM_FILES ${TS_FILES})
set(KF_MAJOR_VERSION 6)
else()
qt5_add_translation(QM_FILES ${TS_FILES})
set(KF_MAJOR_VERSION 5)
endif()
include(cmake/fetch_kdeaddons.cmake)
add_custom_target(update_translations
COMMAND $<TARGET_FILE:Qt${QT_VERSION_MAJOR}::lupdate> ${CMAKE_SOURCE_DIR}/sources -ts ${TS_FILES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Updating .ts files from sources/ (lupdate) - developer target, run explicitly"
VERBATIM
)
# Add sub directories
option(PACKAGE_TESTS "Build the tests" ON)
if(PACKAGE_TESTS)
message("Add sub directory tests")
add_subdirectory(tests)
endif()
# als laatse
include(cmake/define_definitions.cmake)
@@ -145,6 +142,90 @@ else()
)
endif()
# The default build only compiles the tracked .ts files to .qm (lrelease).
# Refreshing the .ts from the sources (lupdate) is a developer action behind
# the explicit "update_translations" target below: running lupdate on every
# build rewrote tracked files as a side effect, and under high parallelism
# lupdate rewriting a .ts while lrelease read the same file made the build
# fail with "Premature end of document".
set_source_files_properties(
${TS_FILES}
PROPERTIES OUTPUT_LOCATION "${QET_DIR}/lang"
)
if(QT_VERSION_MAJOR EQUAL 6)
if(Qt6_VERSION VERSION_LESS "6.2")
# Qt 6.0–6.1
qt6_add_translation(QM_FILES ${TS_FILES})
# qt6_add_translation() only creates custom commands. Something must
# depend on their outputs for them to run during the default build.
add_custom_target(${PROJECT_NAME}_lrelease ALL
DEPENDS ${QM_FILES}
)
add_custom_target(update_translations
COMMAND
$<TARGET_FILE:Qt6::lupdate>
"${CMAKE_SOURCE_DIR}/sources"
-ts ${TS_FILES}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
COMMENT
"Updating .ts files from sources/ (lupdate) - developer target"
VERBATIM
)
elseif(Qt6_VERSION VERSION_LESS "6.7")
# Qt 6.2–6.6: old target-based signature
qt_add_lrelease(
${PROJECT_NAME}
TS_FILES ${TS_FILES}
QM_FILES_OUTPUT_VARIABLE QM_FILES
)
# Automatically creates the update_translations umbrella target.
qt_add_lupdate(
${PROJECT_NAME}
TS_FILES ${TS_FILES}
)
else()
# Qt 6.7+: new signature
qt_add_lrelease(
TS_FILES ${TS_FILES}
LRELEASE_TARGET ${PROJECT_NAME}_lrelease
QM_FILES_OUTPUT_VARIABLE QM_FILES
)
qt_add_lupdate(
SOURCE_TARGETS ${PROJECT_NAME}
TS_FILES ${TS_FILES}
LUPDATE_TARGET update_translations
NO_GLOBAL_TARGET
)
endif()
else()
# Qt 5
qt5_add_translation(QM_FILES ${TS_FILES})
# Likewise, qt5_add_translation() needs a target depending on its outputs,
# unless QM_FILES are already consumed elsewhere.
add_custom_target(${PROJECT_NAME}_lrelease ALL
DEPENDS ${QM_FILES}
)
add_custom_target(update_translations
COMMAND
$<TARGET_FILE:Qt5::lupdate>
"${CMAKE_SOURCE_DIR}/sources"
-ts ${TS_FILES}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
COMMENT
"Updating .ts files from sources/ (lupdate) - developer target"
VERBATIM
)
endif()
# Optional precompiled headers -- see QET_ENABLE_PCH in
# cmake/developer_options.cmake for what this trades away.
#
@@ -180,7 +261,7 @@ target_link_libraries(
pugixml::pugixml
SingleApplication::SingleApplication
SQLite3::SQLite3
${KF5_PRIVATE_LIBRARIES}
${KF_PRIVATE_LIBRARIES}
${QET_PRIVATE_LIBRARIES}
)
@@ -221,7 +302,7 @@ target_include_directories(
${QET_DIR}/sources/svg
)
if(NOT BUILD_WITH_KF5)
if(NOT BUILD_WITH_KF)
target_include_directories(
${PROJECT_NAME}
PRIVATE
+2 -2
View File
@@ -40,8 +40,8 @@ git clone --recursive https://github.com/qelectrotech/qelectrotech-source-mirror
Here are the technical choices made for the software development:
* Integrated development environment: [Qt Framework](https://www.qt.io/ide/)
* Libraries: Qt 5.x
* [KF5 Framework](https://github.com/KDE)
* Libraries: Qt 5.x / Qt 6.x
* [KF5/6 Framework](https://github.com/KDE)
[Cmake](https://cmake.org/install/)
[kcoreaddons](https://github.com/KDE/kcoreaddons/tree/kf5)
[kwidgetsaddons](https://github.com/KDE/kwidgetsaddons/tree/kf5).
+3 -3
View File
@@ -62,10 +62,10 @@ message("PROJECT_SOURCE_DIR :" ${PROJECT_SOURCE_DIR})
message("QET_DIR :" ${QET_DIR})
message("GIT_COMMIT_SHA :" ${GIT_COMMIT_SHA})
if(BUILD_WITH_KF5)
message("KF5_GIT_TAG :" ${KF5_GIT_TAG})
if(BUILD_WITH_KF)
message("KF_GIT_TAG :" ${KF_GIT_TAG})
else()
add_definitions(-DBUILD_WITHOUT_KF5)
add_definitions(-DBUILD_WITHOUT_KF)
endif()
message("QET_COMPONENTS :" ${QET_COMPONENTS})
message("QT_VERSION_MAJOR :" ${QT_VERSION_MAJOR})
+5 -2
View File
@@ -31,8 +31,11 @@ add_definitions(-DQT_MESSAGELOGCONTEXT)
# In order to do so, uncomment the following line.
#add_definitions(-DTODO_LIST)
# Build with KF5
option(BUILD_WITH_KF5 "Build with KF5" ON)
# Build with KDE Frameworks. The major version (KF5/KF6) is derived
# automatically from QT_VERSION_MAJOR -- KDE Frameworks deliberately
# mirrors Qt's own major version numbering, so there is no independent
# choice to make here. See cmake/fetch_kdeaddons.cmake.
option(BUILD_WITH_KF "Build with KDE Frameworks" ON)
# Precompiled headers for the Qt umbrella headers.
#
+58 -36
View File
@@ -16,52 +16,74 @@
message(" - fetch_kdeaddons")
if(BUILD_WITH_KF5)
# TODO remove path as soon as Qt5 gets retired
if(BUILD_WITH_KF)
Include(FetchContent)
option(BUILD_KF5 "Build KF5 libraries, use system ones otherwise" YES)
option(BUILD_KF "Build KF libraries, use system ones otherwise" YES)
if(BUILD_KF5)
if(BUILD_KF)
if(NOT DEFINED KF5_GIT_TAG)
#https://qelectrotech.org/forum/viewtopic.php?pid=13924#p13924
set(KF5_GIT_TAG v5.77.0)
if(KF_MAJOR_VERSION EQUAL 5)
if(NOT DEFINED KF_GIT_TAG)
#https://qelectrotech.org/forum/viewtopic.php?pid=13924#p13924
set(KF_GIT_TAG v5.77.0)
endif()
else()
if(NOT DEFINED KF_GIT_TAG)
# this is a more or less random version, taken as an conservative approach
set(KF_GIT_TAG v6.10.0)
endif()
endif()
# using a function in order to limit the scope of the variables
# with CMake >=3.25 we could use a block()
function(qet_make_kf_available)
# Fix stop the run autotests of kcoreaddons
# see
# https://invent.kde.org/frameworks/kcoreaddons/-/blob/master/CMakeLists.txt#L98
# issue:
# CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:89 (add_executable):
# Cannot find source file:
# see
# https://qelectrotech.org/forum/viewtopic.php?pid=13929#p13929
set(KDE_SKIP_TEST_SETTINGS ON)
set(BUILD_TESTING OFF)
# QElectroTech is a plain QtWidgets application with no QML anywhere in
# it; these disable optional features of the fetched KF modules that
# would otherwise pull in extra Qt6 components (e.g. Qt6Qml) we don't
# have and don't need.
set(BUILD_DESIGNERPLUGIN OFF)
set(KCOREADDONS_USE_QML OFF)
set(BUILD_QCH OFF)
set(BUILD_SHARED_LIBS OFF)
# Fix stop the run autotests of kcoreaddons
# see
# https://invent.kde.org/frameworks/kcoreaddons/-/blob/master/CMakeLists.txt#L98
# issue:
# CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:89 (add_executable):
# Cannot find source file:
# see
# https://qelectrotech.org/forum/viewtopic.php?pid=13929#p13929
set(KDE_SKIP_TEST_SETTINGS "TRUE")
set(BUILD_TESTING "0")
FetchContent_Declare(
ecm
GIT_REPOSITORY https://invent.kde.org/frameworks/extra-cmake-modules.git
GIT_TAG ${KF5_GIT_TAG})
FetchContent_MakeAvailable(ecm)
FetchContent_Declare(
ecm
GIT_REPOSITORY https://invent.kde.org/frameworks/extra-cmake-modules.git
GIT_TAG ${KF_GIT_TAG})
FetchContent_MakeAvailable(ecm)
FetchContent_Declare(
kcoreaddons
GIT_REPOSITORY https://invent.kde.org/frameworks/kcoreaddons.git
GIT_TAG ${KF5_GIT_TAG})
FetchContent_MakeAvailable(kcoreaddons)
FetchContent_Declare(
kcoreaddons
GIT_REPOSITORY https://invent.kde.org/frameworks/kcoreaddons.git
GIT_TAG ${KF_GIT_TAG})
FetchContent_MakeAvailable(kcoreaddons)
FetchContent_Declare(
kwidgetsaddons
GIT_REPOSITORY https://invent.kde.org/frameworks/kwidgetsaddons.git
GIT_TAG ${KF5_GIT_TAG})
FetchContent_MakeAvailable(kwidgetsaddons)
FetchContent_Declare(
kwidgetsaddons
GIT_REPOSITORY https://invent.kde.org/frameworks/kwidgetsaddons.git
GIT_TAG ${KF_GIT_TAG})
FetchContent_MakeAvailable(kwidgetsaddons)
endfunction()
qet_make_kf_available()
else()
find_package(KF5CoreAddons REQUIRED)
find_package(KF5WidgetsAddons REQUIRED)
find_package(KF${KF_MAJOR_VERSION}CoreAddons REQUIRED)
find_package(KF${KF_MAJOR_VERSION}WidgetsAddons REQUIRED)
endif()
set(KF5_PRIVATE_LIBRARIES
KF5::WidgetsAddons
KF5::CoreAddons
set(KF_PRIVATE_LIBRARIES
KF${KF_MAJOR_VERSION}::WidgetsAddons
KF${KF_MAJOR_VERSION}::CoreAddons
)
endif()
+1 -1
View File
@@ -801,7 +801,7 @@ set(QET_SRC_FILES
${QET_DIR}/sources/xml/terminalstriplayoutpatternxml.h
)
if(NOT BUILD_WITH_KF5)
if(NOT BUILD_WITH_KF)
list(APPEND QET_SRC_FILES
${QET_DIR}/sources/ui/nokde/kautosavefile.cpp
${QET_DIR}/sources/ui/nokde/kautosavefile.h
@@ -19,6 +19,7 @@
#include <QPainter>
#include <QHash>
#include <QUuid>
namespace TerminalStripDrawer {
@@ -19,6 +19,7 @@
#define TERMINALSTRIPDRAWER_H
#include <QPointer>
#include <QUuid>
#include "properties/terminalstriplayoutpattern.h"
@@ -28,6 +28,8 @@
#include "../terminalstrip.h"
#include "../../qetinformation.h"
#include <QUuid>
TerminalStripTreeDockWidget::TerminalStripTreeDockWidget(QETProject *project, QWidget *parent) :
QDockWidget(parent),
ui(new Ui::TerminalStripTreeDockWidget)
@@ -20,6 +20,7 @@
#include <QDockWidget>
#include <QPointer>
#include <QHash>
class QETProject;
class QTreeWidgetItem;
+2
View File
@@ -73,6 +73,8 @@ class BorderTitleBlock : public QObject
return(rows_count_ * rows_height_); }
/// @return la rows header width, in pixels
qreal rowsHeaderWidth() const { return(rows_header_width_); }
/// @return the edge where title block is docked
Qt::Edge titleBlockEdge() const { return(m_edge); }
// border - title block = diagram
/**
+2 -2
View File
@@ -142,7 +142,7 @@ void DynamicTextFieldEditor::updateForm()
ui -> m_size_sb -> setValue(m_text_field.data() -> font().pointSize());
ui->m_keep_visual_rotation_cb->setChecked(m_text_field.data()->keepVisualRotation());
ui->m_rotation_point_center_cb->setChecked(m_text_field.data()->rotationPointCenter());
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
#else
//Block signals while loading the colour into the button.
//KColorButton::changed fires on a programmatic setColor() as well
@@ -182,7 +182,7 @@ void DynamicTextFieldEditor::updateForm()
void DynamicTextFieldEditor::setupWidget()
{
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
#else
m_color_kpb = new KColorButton(this);
m_color_kpb->setObjectName(QString::fromUtf8("m_color_kpb"));
+2 -2
View File
@@ -21,7 +21,7 @@
#include "../elementitemeditor.h"
#include "../graphicspart/partdynamictextfield.h"
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
#else
# include <KColorButton>
#endif
@@ -79,7 +79,7 @@ class DynamicTextFieldEditor : public ElementItemEditor {
QList<PartDynamicTextField*> m_parts;
QList<QMetaObject::Connection> m_connection_list;
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
#else
KColorButton* m_color_kpb = nullptr;
#endif
+3 -3
View File
@@ -40,7 +40,7 @@ TerminalEditor::TerminalEditor(QETElementEditor *editor, QWidget *parent) :
{
ui->setupUi(this);
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
m_color_pb = new QPushButton(this);
m_color_pb->setMinimumSize(40, 24);
connect(m_color_pb, &QPushButton::clicked, this, &TerminalEditor::labelColorClicked);
@@ -93,7 +93,7 @@ void TerminalEditor::updateForm()
ui->m_label_rotation_sb->setValue(static_cast<int>(m_part->labelRotation()));
ui->m_label_frame_cb->setChecked(m_part->labelFrame());
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
QPixmap px(16, 16);
px.fill(m_part->labelColor());
m_color_pb->setIcon(QIcon(px));
@@ -410,7 +410,7 @@ void TerminalEditor::labelColorClicked()
if (m_locked) return;
m_locked = true;
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
QColor new_color = QColorDialog::getColor(m_part->labelColor(), this);
if (new_color.isValid() && m_part->labelColor() != new_color) {
auto undo = new QPropertyUndoCommand(m_part, "label_color", m_part->labelColor(), new_color);
+2 -2
View File
@@ -21,7 +21,7 @@
#include <QWidget>
#include "../elementitemeditor.h"
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
#include <QPushButton>
#else
#include <KColorButton>
@@ -78,7 +78,7 @@ class TerminalEditor : public ElementItemEditor
m_change_connections;
PartTerminal *m_part = nullptr;
bool m_locked = false;
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
QPushButton *m_color_pb;
#else
KColorButton *m_color_pb;
+2 -2
View File
@@ -63,7 +63,7 @@ void TextEditor::updateForm()
m_rotation_sb -> setValue(m_text -> rotation());
m_size_sb -> setValue(m_text -> font().pointSize());
m_font_pb -> setText(m_text -> font().family());
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
#else
m_color_pb -> setColor(m_text -> defaultTextColor());
#endif
@@ -346,7 +346,7 @@ void TextEditor::setUpWidget(QWidget *parent)
m_line_edit->setPlaceholderText(tr("Entrer votre texte ici"));
gridLayout->addWidget(m_line_edit, 0, 0, 1, 6);
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
#else
m_color_pb = new KColorButton(parent);
m_color_pb->setObjectName(QString::fromUtf8("m_color_pb"));
+2 -2
View File
@@ -25,7 +25,7 @@
#include <QSpinBox>
#include <QLineEdit>
#include <QPushButton>
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
#else
#include <KColorButton>
#endif
@@ -65,7 +65,7 @@ class TextEditor : public ElementItemEditor {
QSpinBox *m_size_sb;
QLineEdit *m_line_edit;
QPushButton *m_font_pb;
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
#else
KColorButton *m_color_pb;
#endif
+2 -2
View File
@@ -23,8 +23,8 @@
#include "qetgraphicsitem/element.h"
#include "qetgraphicsitem/elementtextitemgroup.h"
// Private Qt PDF engine for drawHyperlink() — not public API, stable since Qt4.
// Requires QT += gui-private in qelectrotech.pro / gui-private in CMake.
// Private Qt PDF engine for drawHyperlink() — not public API.
// Availability of Qt::GuiPrivate is verified at configure time in CMakeLists.txt.
#include <private/qpdf_p.h>
#include <QByteArray>
+15 -8
View File
@@ -28,8 +28,8 @@
#include "ui_projectprintwindow.h"
// Private Qt PDF engine for drawHyperlink() — not public API, stable since Qt4
// Requires QT += gui-private in qelectrotech.pro
// Private Qt PDF engine for drawHyperlink() is not a public API.
// Availability of Qt::GuiPrivate is verified at configure time in CMakeLists.txt.
#include <private/qpdf_p.h>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
@@ -79,10 +79,14 @@ void ProjectPrintWindow::launchDialog(QETProject *project, QPrinter::OutputForma
print_dialog.setWindowFlags(Qt::Sheet);
#endif
print_dialog.setWindowTitle(tr("Options d'impression", "window title"));
// setOptions() is the modern spelling of the Qt4-era
// setEnabledOptions() (removed in Qt 6): replace the enabled
// option set with just PrintShowPageSize, on Qt 5 and 6 alike.
print_dialog.setOptions(QAbstractPrintDialog::PrintShowPageSize);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
print_dialog.setEnabledOptions(QAbstractPrintDialog::PrintShowPageSize);
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 6 or later")
#endif
qDebug()<<"Help code for QT 6 or later";
#endif
if (print_dialog.exec() == QDialog::Rejected) {
delete printer_;
return;
@@ -450,8 +454,11 @@ QRect ProjectPrintWindow::diagramRect(Diagram *diagram, const ExportProperties &
{
auto diagram_rect = diagram->border_and_titleblock.borderAndTitleBlockRect();
if (!option.draw_titleblock) {
auto titleblock_height = diagram->border_and_titleblock.titleBlockRect().height();
diagram_rect.setHeight(diagram_rect.height() - titleblock_height);
auto titleblock_rect = diagram->border_and_titleblock.titleBlockRect();
if (diagram->border_and_titleblock.titleBlockEdge() == Qt::BottomEdge)
diagram_rect.setHeight(diagram_rect.height() - titleblock_rect.height());
else
diagram_rect.setWidth(diagram_rect.width() - titleblock_rect.width());
}
//Adjust the border of diagram to 1px (width of the line)
+16 -16
View File
@@ -35,28 +35,28 @@ public:
: QTabWidget(parent)
{}
double temp_index = 0;
void wheelEvent(QWheelEvent *event) override
{
int index = currentIndex();
double delta = 0;
double scale_factor = 0.005; // Decrease or increase speed of mouse wheel (0.04 = decrease)
if (event->modifiers() & Qt::ControlModifier) {
if (index != -1) {
delta = event->delta() * scale_factor; // Read and scale the scroll value
if (delta > 0 && (temp_index > -1)) temp_index = temp_index - abs(delta);
if (delta < 0 && (temp_index < count())) temp_index = temp_index + abs(delta);
// Only intercept if Ctrl is held down
if (event->modifiers() & Qt::ControlModifier) {
int index = currentIndex();
if (index != -1) {
// angleDelta().y() is usually 120 per click.
// Dividing by 120 gives you exactly +1 (scroll up) or -1 (scroll down)
int steps = event->angleDelta().y() / 120;
index = int (temp_index);
qDebug() << "index" << index << "temp_index" << temp_index << " " << event->delta() << delta;
if (steps != 0) {
int newIndex = index - steps;
if (index >= 0 && index < count())
setCurrentIndex(index);
// qDebug() << currentIndex();
if (newIndex >= 0 && newIndex < count())
setCurrentIndex(newIndex);
}
}
event->accept(); // Mark event handled so parent widgets don't process it
} else {
// Allow the default QTabWidget wheel behavior to process if Ctrl isn't held
QTabWidget::wheelEvent(event);
}
}
};
#endif
+1 -1
View File
@@ -50,7 +50,7 @@
#include <QFontDatabase>
#include <QProcessEnvironment>
#include <QRegularExpression>
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
# include "ui/nokde/kautosavefile.h"
#else
# include <KAutoSaveFile>
+1 -1
View File
@@ -57,7 +57,7 @@
#include <QDateTime>
#include <QDebug>
#include <QDir>
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
# include "ui/nokde/kautosavefile.h"
#else
# include <KAutoSaveFile>
@@ -146,7 +146,7 @@ bool ProjectDBModel::setData(const QModelIndex &index, const QVariant &value, in
return false;
}
m_index_0_0_data.insert(role, value);
emit dataChanged(index, index, QVector<int>(role));
emit dataChanged(index, index, {role});
return true;
}
@@ -332,7 +332,7 @@ void ProjectDBModel::dataBaseUpdated()
auto row = m_record.size();
auto col = row ? m_record.first().count() : 1;
emit dataChanged(this->index(0,0), this->index(row-1, col-1), QVector<int>(Qt::DisplayRole));
emit dataChanged(this->index(0,0), this->index(row-1, col-1), {Qt::DisplayRole});
}
}
+1 -1
View File
@@ -29,7 +29,7 @@
#include "titleblock/templatescollection.h"
#include "titleblockproperties.h"
#include "diagram.h"
#ifdef BUILD_WITHOUT_KF5
#ifdef BUILD_WITHOUT_KF
# include "ui/nokde/kautosavefile.h"
#else
# include <KAutoSaveFile>
+2 -1
View File
@@ -21,6 +21,7 @@
#include <QSettings>
#include <QVariant>
#include <algorithm>
#include <utility>
namespace {
const QString SETTINGS_GROUP = QStringLiteral("shortcuts/");
@@ -143,7 +144,7 @@ void ShortcutManager::setSequence(const QString &id, const QKeySequence &sequenc
settings.setValue(key, sequence.toString());
}
for (const QPointer<QObject> &target : qAsConst(it->targets)) {
for (const QPointer<QObject> &target : std::as_const(it->targets)) {
if (target) {
target->setProperty("shortcut", QVariant::fromValue(sequence));
}
@@ -31,6 +31,7 @@
#include <QToolButton>
#include <QVBoxLayout>
#include <algorithm>
#include <utility>
/**
@brief ShortcutsConfigPage::ShortcutsConfigPage
@@ -198,7 +199,7 @@ void ShortcutsConfigPage::resetRow(int row_index)
void ShortcutsConfigPage::resetAllRows()
{
for (const Row &row : qAsConst(m_rows)) {
for (const Row &row : std::as_const(m_rows)) {
row.edit->setKeySequence(row.default_sequence);
}
checkConflicts();
@@ -211,7 +212,7 @@ void ShortcutsConfigPage::resetAllRows()
*/
void ShortcutsConfigPage::applyConf()
{
for (const Row &row : qAsConst(m_rows)) {
for (const Row &row : std::as_const(m_rows)) {
ShortcutManager::instance().setSequence(row.id, row.edit->keySequence());
}
}
+8
View File
@@ -204,6 +204,14 @@ void ElementInfoWidget::buildInterface()
keys = QETInformation::elementInfoKeys();
}
//"exclude_from_bom" is part of elementInfoKeys() because the project
//database builds the element_info table from that list, but it is not
//a free-text property: it already has its own check box below. Without
//this it also gets a generic edit row, and since translatedInfoKey()
//has no entry for it that row carries no label at all - an anonymous
//line that currentInfo() then fills with "true"/"false".
keys.removeAll(QStringLiteral("exclude_from_bom"));
for (auto str : keys)
{
ElementInfoPartWidget *eipw = new ElementInfoPartWidget(str, QETInformation::translatedInfoKey(str), this);
+2 -2
View File
@@ -90,7 +90,7 @@ add_executable(
${QET_DIR}/sources/borderproperties.h
)
if(NOT BUILD_WITH_KF5)
if(NOT BUILD_WITH_KF)
target_sources(
${PROJECT_NAME}
PRIVATE
@@ -109,7 +109,7 @@ target_link_libraries(
PUBLIC
Catch2::Catch2
PRIVATE
${KF5_PRIVATE_LIBRARIES}
${KF_PRIVATE_LIBRARIES}
${QET_PRIVATE_LIBRARIES})
if (DEFINED ENV{CATCH_INCLUDE_DIR})
+1 -1
View File
@@ -85,6 +85,6 @@ target_link_libraries(
PUBLIC
gmock gmock_main
PRIVATE
${KF5_PRIVATE_LIBRARIES}
${KF_PRIVATE_LIBRARIES}
${QET_PRIVATE_LIBRARIES})
+1 -1
View File
@@ -84,6 +84,6 @@ target_link_libraries(
PUBLIC
gtest gtest_main
PRIVATE
${KF5_PRIVATE_LIBRARIES}
${KF_PRIVATE_LIBRARIES}
${QET_PRIVATE_LIBRARIES})
+1 -1
View File
@@ -74,6 +74,6 @@ target_link_libraries(
${PROJECT_NAME}
PRIVATE
Qt::Test
${KF5_PRIVATE_LIBRARIES}
${KF_PRIVATE_LIBRARIES}
${QET_PRIVATE_LIBRARIES})