mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-16 19:54:13 +02:00
Merge branch 'master' into master-update-more-signal-slot
This commit is contained in:
@@ -113,7 +113,7 @@ jobs:
|
|||||||
-DQt5_DIR=/ucrt64/lib/cmake/Qt5 \
|
-DQt5_DIR=/ucrt64/lib/cmake/Qt5 \
|
||||||
-DQT_VERSION_MAJOR=5 \
|
-DQT_VERSION_MAJOR=5 \
|
||||||
-DCMAKE_DISABLE_FIND_PACKAGE_Qt6=ON \
|
-DCMAKE_DISABLE_FIND_PACKAGE_Qt6=ON \
|
||||||
-DBUILD_TESTING=OFF \
|
-DPACKAGE_TESTS=OFF \
|
||||||
-DCMAKE_POLICY_DEFAULT_CMP0077=NEW \
|
-DCMAKE_POLICY_DEFAULT_CMP0077=NEW \
|
||||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||||
-DCMAKE_CXX_FLAGS="-DQET_EXPORT_PROJECT_DB" \
|
-DCMAKE_CXX_FLAGS="-DQET_EXPORT_PROJECT_DB" \
|
||||||
@@ -456,7 +456,7 @@ jobs:
|
|||||||
-DCMAKE_PREFIX_PATH=/ucrt64 \
|
-DCMAKE_PREFIX_PATH=/ucrt64 \
|
||||||
-DQt6_DIR=/ucrt64/lib/cmake/Qt6 \
|
-DQt6_DIR=/ucrt64/lib/cmake/Qt6 \
|
||||||
-DQT_VERSION_MAJOR=6 \
|
-DQT_VERSION_MAJOR=6 \
|
||||||
-DBUILD_WITH_KF5=OFF \
|
-DBUILD_WITH_KF=OFF \
|
||||||
-DPACKAGE_TESTS=OFF \
|
-DPACKAGE_TESTS=OFF \
|
||||||
-DCMAKE_POLICY_DEFAULT_CMP0077=NEW \
|
-DCMAKE_POLICY_DEFAULT_CMP0077=NEW \
|
||||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||||
|
|||||||
+111
-30
@@ -48,19 +48,11 @@ endif()
|
|||||||
# INTERFACE_QT_MAJOR_VERSION mismatch at generate time.
|
# 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)
|
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/paths_compilation_installation.cmake)
|
||||||
include(cmake/start_options.cmake)
|
include(cmake/start_options.cmake)
|
||||||
include(cmake/developer_options.cmake)
|
include(cmake/developer_options.cmake)
|
||||||
include(cmake/git_update_submodules.cmake)
|
include(cmake/git_update_submodules.cmake)
|
||||||
include(cmake/git_last_commit_sha.cmake)
|
include(cmake/git_last_commit_sha.cmake)
|
||||||
include(cmake/fetch_kdeaddons.cmake)
|
|
||||||
include(cmake/fetch_singleapplication.cmake)
|
include(cmake/fetch_singleapplication.cmake)
|
||||||
include(cmake/fetch_pugixml.cmake)
|
include(cmake/fetch_pugixml.cmake)
|
||||||
include(cmake/qet_compilation_vars.cmake)
|
include(cmake/qet_compilation_vars.cmake)
|
||||||
@@ -78,12 +70,23 @@ find_package(
|
|||||||
${QET_COMPONENTS}
|
${QET_COMPONENTS}
|
||||||
REQUIRED)
|
REQUIRED)
|
||||||
|
|
||||||
# Qt6 only creates the Qt::GuiPrivate target (used for QPdfEngine::drawHyperlink)
|
# <private/qpdf_p.h> (QPdfEngine::drawHyperlink) needs Qt's private GUI module.
|
||||||
# when the GuiPrivate component is explicitly requested. Qt5 has no such
|
# Qt >= 6.7 ships it as a proper find_package component, but some distro
|
||||||
# component package and creates the target implicitly with Gui, so only
|
# packages (e.g. Ubuntu's qt6-base-private-dev) omit Qt6GuiPrivateConfig.cmake
|
||||||
# request it on Qt6 - requesting it on Qt5 fails the whole configure.
|
# 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)
|
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()
|
endif()
|
||||||
|
|
||||||
find_package(SQLite3 REQUIRED)
|
find_package(SQLite3 REQUIRED)
|
||||||
@@ -100,25 +103,19 @@ endif()
|
|||||||
|
|
||||||
set(CMAKE_AUTOUIC_SEARCH_PATHS ${QET_DIR}/sources/ui)
|
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)
|
if(QT_VERSION_MAJOR EQUAL 6)
|
||||||
qt6_add_translation(QM_FILES ${TS_FILES})
|
set(KF_MAJOR_VERSION 6)
|
||||||
else()
|
else()
|
||||||
qt5_add_translation(QM_FILES ${TS_FILES})
|
set(KF_MAJOR_VERSION 5)
|
||||||
endif()
|
endif()
|
||||||
|
include(cmake/fetch_kdeaddons.cmake)
|
||||||
|
|
||||||
add_custom_target(update_translations
|
# Add sub directories
|
||||||
COMMAND $<TARGET_FILE:Qt${QT_VERSION_MAJOR}::lupdate> ${CMAKE_SOURCE_DIR}/sources -ts ${TS_FILES}
|
option(PACKAGE_TESTS "Build the tests" ON)
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
if(PACKAGE_TESTS)
|
||||||
COMMENT "Updating .ts files from sources/ (lupdate) - developer target, run explicitly"
|
message("Add sub directory tests")
|
||||||
VERBATIM
|
add_subdirectory(tests)
|
||||||
)
|
endif()
|
||||||
|
|
||||||
# als laatse
|
# als laatse
|
||||||
include(cmake/define_definitions.cmake)
|
include(cmake/define_definitions.cmake)
|
||||||
@@ -145,6 +142,90 @@ else()
|
|||||||
)
|
)
|
||||||
endif()
|
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
|
# Optional precompiled headers -- see QET_ENABLE_PCH in
|
||||||
# cmake/developer_options.cmake for what this trades away.
|
# cmake/developer_options.cmake for what this trades away.
|
||||||
#
|
#
|
||||||
@@ -180,7 +261,7 @@ target_link_libraries(
|
|||||||
pugixml::pugixml
|
pugixml::pugixml
|
||||||
SingleApplication::SingleApplication
|
SingleApplication::SingleApplication
|
||||||
SQLite3::SQLite3
|
SQLite3::SQLite3
|
||||||
${KF5_PRIVATE_LIBRARIES}
|
${KF_PRIVATE_LIBRARIES}
|
||||||
${QET_PRIVATE_LIBRARIES}
|
${QET_PRIVATE_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -221,7 +302,7 @@ target_include_directories(
|
|||||||
${QET_DIR}/sources/svg
|
${QET_DIR}/sources/svg
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT BUILD_WITH_KF5)
|
if(NOT BUILD_WITH_KF)
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
${PROJECT_NAME}
|
${PROJECT_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ git clone --recursive https://github.com/qelectrotech/qelectrotech-source-mirror
|
|||||||
Here are the technical choices made for the software development:
|
Here are the technical choices made for the software development:
|
||||||
|
|
||||||
* Integrated development environment: [Qt Framework](https://www.qt.io/ide/)
|
* Integrated development environment: [Qt Framework](https://www.qt.io/ide/)
|
||||||
* Libraries: Qt 5.x
|
* Libraries: Qt 5.x / Qt 6.x
|
||||||
* [KF5 Framework](https://github.com/KDE)
|
* [KF5/6 Framework](https://github.com/KDE)
|
||||||
[Cmake](https://cmake.org/install/)
|
[Cmake](https://cmake.org/install/)
|
||||||
[kcoreaddons](https://github.com/KDE/kcoreaddons/tree/kf5)
|
[kcoreaddons](https://github.com/KDE/kcoreaddons/tree/kf5)
|
||||||
[kwidgetsaddons](https://github.com/KDE/kwidgetsaddons/tree/kf5).
|
[kwidgetsaddons](https://github.com/KDE/kwidgetsaddons/tree/kf5).
|
||||||
|
|||||||
@@ -62,10 +62,10 @@ message("PROJECT_SOURCE_DIR :" ${PROJECT_SOURCE_DIR})
|
|||||||
message("QET_DIR :" ${QET_DIR})
|
message("QET_DIR :" ${QET_DIR})
|
||||||
message("GIT_COMMIT_SHA :" ${GIT_COMMIT_SHA})
|
message("GIT_COMMIT_SHA :" ${GIT_COMMIT_SHA})
|
||||||
|
|
||||||
if(BUILD_WITH_KF5)
|
if(BUILD_WITH_KF)
|
||||||
message("KF5_GIT_TAG :" ${KF5_GIT_TAG})
|
message("KF_GIT_TAG :" ${KF_GIT_TAG})
|
||||||
else()
|
else()
|
||||||
add_definitions(-DBUILD_WITHOUT_KF5)
|
add_definitions(-DBUILD_WITHOUT_KF)
|
||||||
endif()
|
endif()
|
||||||
message("QET_COMPONENTS :" ${QET_COMPONENTS})
|
message("QET_COMPONENTS :" ${QET_COMPONENTS})
|
||||||
message("QT_VERSION_MAJOR :" ${QT_VERSION_MAJOR})
|
message("QT_VERSION_MAJOR :" ${QT_VERSION_MAJOR})
|
||||||
|
|||||||
@@ -31,8 +31,11 @@ add_definitions(-DQT_MESSAGELOGCONTEXT)
|
|||||||
# In order to do so, uncomment the following line.
|
# In order to do so, uncomment the following line.
|
||||||
#add_definitions(-DTODO_LIST)
|
#add_definitions(-DTODO_LIST)
|
||||||
|
|
||||||
# Build with KF5
|
# Build with KDE Frameworks. The major version (KF5/KF6) is derived
|
||||||
option(BUILD_WITH_KF5 "Build with KF5" ON)
|
# 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.
|
# Precompiled headers for the Qt umbrella headers.
|
||||||
#
|
#
|
||||||
|
|||||||
+58
-36
@@ -16,52 +16,74 @@
|
|||||||
|
|
||||||
message(" - fetch_kdeaddons")
|
message(" - fetch_kdeaddons")
|
||||||
|
|
||||||
if(BUILD_WITH_KF5)
|
# TODO remove path as soon as Qt5 gets retired
|
||||||
|
if(BUILD_WITH_KF)
|
||||||
Include(FetchContent)
|
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)
|
if(KF_MAJOR_VERSION EQUAL 5)
|
||||||
#https://qelectrotech.org/forum/viewtopic.php?pid=13924#p13924
|
if(NOT DEFINED KF_GIT_TAG)
|
||||||
set(KF5_GIT_TAG v5.77.0)
|
#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()
|
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)
|
||||||
|
|
||||||
# Fix stop the run autotests of kcoreaddons
|
# QElectroTech is a plain QtWidgets application with no QML anywhere in
|
||||||
# see
|
# it; these disable optional features of the fetched KF modules that
|
||||||
# https://invent.kde.org/frameworks/kcoreaddons/-/blob/master/CMakeLists.txt#L98
|
# would otherwise pull in extra Qt6 components (e.g. Qt6Qml) we don't
|
||||||
# issue:
|
# have and don't need.
|
||||||
# CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:89 (add_executable):
|
set(BUILD_DESIGNERPLUGIN OFF)
|
||||||
# Cannot find source file:
|
set(KCOREADDONS_USE_QML OFF)
|
||||||
# see
|
set(BUILD_QCH OFF)
|
||||||
# https://qelectrotech.org/forum/viewtopic.php?pid=13929#p13929
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
set(KDE_SKIP_TEST_SETTINGS "TRUE")
|
|
||||||
set(BUILD_TESTING "0")
|
|
||||||
FetchContent_Declare(
|
|
||||||
ecm
|
|
||||||
GIT_REPOSITORY https://invent.kde.org/frameworks/extra-cmake-modules.git
|
|
||||||
GIT_TAG ${KF5_GIT_TAG})
|
|
||||||
FetchContent_MakeAvailable(ecm)
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
kcoreaddons
|
ecm
|
||||||
GIT_REPOSITORY https://invent.kde.org/frameworks/kcoreaddons.git
|
GIT_REPOSITORY https://invent.kde.org/frameworks/extra-cmake-modules.git
|
||||||
GIT_TAG ${KF5_GIT_TAG})
|
GIT_TAG ${KF_GIT_TAG})
|
||||||
FetchContent_MakeAvailable(kcoreaddons)
|
FetchContent_MakeAvailable(ecm)
|
||||||
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
kwidgetsaddons
|
kcoreaddons
|
||||||
GIT_REPOSITORY https://invent.kde.org/frameworks/kwidgetsaddons.git
|
GIT_REPOSITORY https://invent.kde.org/frameworks/kcoreaddons.git
|
||||||
GIT_TAG ${KF5_GIT_TAG})
|
GIT_TAG ${KF_GIT_TAG})
|
||||||
FetchContent_MakeAvailable(kwidgetsaddons)
|
FetchContent_MakeAvailable(kcoreaddons)
|
||||||
|
|
||||||
|
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()
|
else()
|
||||||
find_package(KF5CoreAddons REQUIRED)
|
find_package(KF${KF_MAJOR_VERSION}CoreAddons REQUIRED)
|
||||||
find_package(KF5WidgetsAddons REQUIRED)
|
find_package(KF${KF_MAJOR_VERSION}WidgetsAddons REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(KF5_PRIVATE_LIBRARIES
|
set(KF_PRIVATE_LIBRARIES
|
||||||
KF5::WidgetsAddons
|
KF${KF_MAJOR_VERSION}::WidgetsAddons
|
||||||
KF5::CoreAddons
|
KF${KF_MAJOR_VERSION}::CoreAddons
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -801,7 +801,7 @@ set(QET_SRC_FILES
|
|||||||
${QET_DIR}/sources/xml/terminalstriplayoutpatternxml.h
|
${QET_DIR}/sources/xml/terminalstriplayoutpatternxml.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT BUILD_WITH_KF5)
|
if(NOT BUILD_WITH_KF)
|
||||||
list(APPEND QET_SRC_FILES
|
list(APPEND QET_SRC_FILES
|
||||||
${QET_DIR}/sources/ui/nokde/kautosavefile.cpp
|
${QET_DIR}/sources/ui/nokde/kautosavefile.cpp
|
||||||
${QET_DIR}/sources/ui/nokde/kautosavefile.h
|
${QET_DIR}/sources/ui/nokde/kautosavefile.h
|
||||||
|
|||||||
Binary file not shown.
+610
-557
File diff suppressed because it is too large
Load Diff
@@ -46,6 +46,18 @@ class PropertiesEditorDialog : public QDialog
|
|||||||
PropertiesEditorDialog(T editor, QWidget *parent = nullptr) :
|
PropertiesEditorDialog(T editor, QWidget *parent = nullptr) :
|
||||||
QDialog (parent)
|
QDialog (parent)
|
||||||
{
|
{
|
||||||
|
// Without this, a QWidget-modal QDialog with a parent falls
|
||||||
|
// back to macOS's automatic sheet presentation, which some
|
||||||
|
// Qt/Cocoa versions render stuck centered on screen and
|
||||||
|
// non-draggable rather than as a proper attached sheet
|
||||||
|
// (bugtracker #275). Other dialogs in this codebase already
|
||||||
|
// opt in explicitly (see ElementDialog, DiagramPropertiesDialog)
|
||||||
|
// -- this one was missing it.
|
||||||
|
setWindowModality(Qt::WindowModal);
|
||||||
|
#ifdef Q_OS_MACOS
|
||||||
|
setWindowFlags(Qt::Sheet);
|
||||||
|
#endif
|
||||||
|
|
||||||
//Set dialog title
|
//Set dialog title
|
||||||
setWindowTitle(editor->title());
|
setWindowTitle(editor->title());
|
||||||
// Reparent the editor,
|
// Reparent the editor,
|
||||||
|
|||||||
@@ -1020,6 +1020,7 @@ void SearchAndReplaceWidget::on_m_tree_widget_currentItemChanged(
|
|||||||
{
|
{
|
||||||
m_highlighted_element = elmt;
|
m_highlighted_element = elmt;
|
||||||
elmt.data()->setHighlighted(true);
|
elmt.data()->setHighlighted(true);
|
||||||
|
elmt.data()->ensureVisible();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_text_hash.contains(current))
|
else if (m_text_hash.contains(current))
|
||||||
@@ -1029,6 +1030,7 @@ void SearchAndReplaceWidget::on_m_tree_widget_currentItemChanged(
|
|||||||
{
|
{
|
||||||
text.data()->setSelected(true);
|
text.data()->setSelected(true);
|
||||||
m_last_selected = text;
|
m_last_selected = text;
|
||||||
|
text.data()->ensureVisible();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_conductor_hash.contains(current))
|
else if (m_conductor_hash.contains(current))
|
||||||
@@ -1038,6 +1040,7 @@ void SearchAndReplaceWidget::on_m_tree_widget_currentItemChanged(
|
|||||||
{
|
{
|
||||||
cond.data()->setSelected(true);
|
cond.data()->setSelected(true);
|
||||||
m_last_selected = cond;
|
m_last_selected = cond;
|
||||||
|
cond.data()->ensureVisible();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
#include <QUuid>
|
||||||
|
|
||||||
namespace TerminalStripDrawer {
|
namespace TerminalStripDrawer {
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#define TERMINALSTRIPDRAWER_H
|
#define TERMINALSTRIPDRAWER_H
|
||||||
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QUuid>
|
||||||
|
|
||||||
#include "properties/terminalstriplayoutpattern.h"
|
#include "properties/terminalstriplayoutpattern.h"
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
#include "../terminalstrip.h"
|
#include "../terminalstrip.h"
|
||||||
#include "../../qetinformation.h"
|
#include "../../qetinformation.h"
|
||||||
|
|
||||||
|
#include <QUuid>
|
||||||
|
|
||||||
TerminalStripTreeDockWidget::TerminalStripTreeDockWidget(QETProject *project, QWidget *parent) :
|
TerminalStripTreeDockWidget::TerminalStripTreeDockWidget(QETProject *project, QWidget *parent) :
|
||||||
QDockWidget(parent),
|
QDockWidget(parent),
|
||||||
ui(new Ui::TerminalStripTreeDockWidget)
|
ui(new Ui::TerminalStripTreeDockWidget)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
class QETProject;
|
class QETProject;
|
||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QSignalBlocker>
|
||||||
|
|
||||||
DynamicTextFieldEditor::DynamicTextFieldEditor(QETElementEditor *editor,
|
DynamicTextFieldEditor::DynamicTextFieldEditor(QETElementEditor *editor,
|
||||||
PartDynamicTextField *text_field,
|
PartDynamicTextField *text_field,
|
||||||
@@ -141,9 +142,20 @@ void DynamicTextFieldEditor::updateForm()
|
|||||||
ui -> m_size_sb -> setValue(m_text_field.data() -> font().pointSize());
|
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_keep_visual_rotation_cb->setChecked(m_text_field.data()->keepVisualRotation());
|
||||||
ui->m_rotation_point_center_cb->setChecked(m_text_field.data()->rotationPointCenter());
|
ui->m_rotation_point_center_cb->setChecked(m_text_field.data()->rotationPointCenter());
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
#else
|
#else
|
||||||
m_color_kpb -> setColor(m_text_field.data() -> color());
|
//Block signals while loading the colour into the button.
|
||||||
|
//KColorButton::changed fires on a programmatic setColor() as well
|
||||||
|
//as on user interaction, and m_color_kpb_changed() applies the new
|
||||||
|
//colour to *every* selected part -- so merely showing the first
|
||||||
|
//part's colour would overwrite the colour of all the others.
|
||||||
|
//The other widgets above are immune because they are wired to
|
||||||
|
//user-only signals (editingFinished, clicked), which setValue()
|
||||||
|
//and setChecked() do not emit.
|
||||||
|
{
|
||||||
|
const QSignalBlocker blocker(m_color_kpb);
|
||||||
|
m_color_kpb -> setColor(m_text_field.data() -> color());
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
ui -> m_width_sb -> setValue(m_text_field.data() -> textWidth());
|
ui -> m_width_sb -> setValue(m_text_field.data() -> textWidth());
|
||||||
ui -> m_font_pb -> setText(m_text_field -> font().family());
|
ui -> m_font_pb -> setText(m_text_field -> font().family());
|
||||||
@@ -170,7 +182,7 @@ void DynamicTextFieldEditor::updateForm()
|
|||||||
|
|
||||||
void DynamicTextFieldEditor::setupWidget()
|
void DynamicTextFieldEditor::setupWidget()
|
||||||
{
|
{
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
#else
|
#else
|
||||||
m_color_kpb = new KColorButton(this);
|
m_color_kpb = new KColorButton(this);
|
||||||
m_color_kpb->setObjectName(QString::fromUtf8("m_color_kpb"));
|
m_color_kpb->setObjectName(QString::fromUtf8("m_color_kpb"));
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "../elementitemeditor.h"
|
#include "../elementitemeditor.h"
|
||||||
#include "../graphicspart/partdynamictextfield.h"
|
#include "../graphicspart/partdynamictextfield.h"
|
||||||
|
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
#else
|
#else
|
||||||
# include <KColorButton>
|
# include <KColorButton>
|
||||||
#endif
|
#endif
|
||||||
@@ -79,7 +79,7 @@ class DynamicTextFieldEditor : public ElementItemEditor {
|
|||||||
QList<PartDynamicTextField*> m_parts;
|
QList<PartDynamicTextField*> m_parts;
|
||||||
QList<QMetaObject::Connection> m_connection_list;
|
QList<QMetaObject::Connection> m_connection_list;
|
||||||
|
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
#else
|
#else
|
||||||
KColorButton* m_color_kpb = nullptr;
|
KColorButton* m_color_kpb = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ TerminalEditor::TerminalEditor(QETElementEditor *editor, QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
m_color_pb = new QPushButton(this);
|
m_color_pb = new QPushButton(this);
|
||||||
m_color_pb->setMinimumSize(40, 24);
|
m_color_pb->setMinimumSize(40, 24);
|
||||||
connect(m_color_pb, &QPushButton::clicked, this, &TerminalEditor::labelColorClicked);
|
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_rotation_sb->setValue(static_cast<int>(m_part->labelRotation()));
|
||||||
ui->m_label_frame_cb->setChecked(m_part->labelFrame());
|
ui->m_label_frame_cb->setChecked(m_part->labelFrame());
|
||||||
|
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
QPixmap px(16, 16);
|
QPixmap px(16, 16);
|
||||||
px.fill(m_part->labelColor());
|
px.fill(m_part->labelColor());
|
||||||
m_color_pb->setIcon(QIcon(px));
|
m_color_pb->setIcon(QIcon(px));
|
||||||
@@ -410,7 +410,7 @@ void TerminalEditor::labelColorClicked()
|
|||||||
if (m_locked) return;
|
if (m_locked) return;
|
||||||
m_locked = true;
|
m_locked = true;
|
||||||
|
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
QColor new_color = QColorDialog::getColor(m_part->labelColor(), this);
|
QColor new_color = QColorDialog::getColor(m_part->labelColor(), this);
|
||||||
if (new_color.isValid() && m_part->labelColor() != new_color) {
|
if (new_color.isValid() && m_part->labelColor() != new_color) {
|
||||||
auto undo = new QPropertyUndoCommand(m_part, "label_color", m_part->labelColor(), new_color);
|
auto undo = new QPropertyUndoCommand(m_part, "label_color", m_part->labelColor(), new_color);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "../elementitemeditor.h"
|
#include "../elementitemeditor.h"
|
||||||
|
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#else
|
#else
|
||||||
#include <KColorButton>
|
#include <KColorButton>
|
||||||
@@ -78,7 +78,7 @@ class TerminalEditor : public ElementItemEditor
|
|||||||
m_change_connections;
|
m_change_connections;
|
||||||
PartTerminal *m_part = nullptr;
|
PartTerminal *m_part = nullptr;
|
||||||
bool m_locked = false;
|
bool m_locked = false;
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
QPushButton *m_color_pb;
|
QPushButton *m_color_pb;
|
||||||
#else
|
#else
|
||||||
KColorButton *m_color_pb;
|
KColorButton *m_color_pb;
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ void TextEditor::updateForm()
|
|||||||
m_rotation_sb -> setValue(m_text -> rotation());
|
m_rotation_sb -> setValue(m_text -> rotation());
|
||||||
m_size_sb -> setValue(m_text -> font().pointSize());
|
m_size_sb -> setValue(m_text -> font().pointSize());
|
||||||
m_font_pb -> setText(m_text -> font().family());
|
m_font_pb -> setText(m_text -> font().family());
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
#else
|
#else
|
||||||
m_color_pb -> setColor(m_text -> defaultTextColor());
|
m_color_pb -> setColor(m_text -> defaultTextColor());
|
||||||
#endif
|
#endif
|
||||||
@@ -346,7 +346,7 @@ void TextEditor::setUpWidget(QWidget *parent)
|
|||||||
m_line_edit->setPlaceholderText(tr("Entrer votre texte ici"));
|
m_line_edit->setPlaceholderText(tr("Entrer votre texte ici"));
|
||||||
|
|
||||||
gridLayout->addWidget(m_line_edit, 0, 0, 1, 6);
|
gridLayout->addWidget(m_line_edit, 0, 0, 1, 6);
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
#else
|
#else
|
||||||
m_color_pb = new KColorButton(parent);
|
m_color_pb = new KColorButton(parent);
|
||||||
m_color_pb->setObjectName(QString::fromUtf8("m_color_pb"));
|
m_color_pb->setObjectName(QString::fromUtf8("m_color_pb"));
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
#else
|
#else
|
||||||
#include <KColorButton>
|
#include <KColorButton>
|
||||||
#endif
|
#endif
|
||||||
@@ -65,7 +65,7 @@ class TextEditor : public ElementItemEditor {
|
|||||||
QSpinBox *m_size_sb;
|
QSpinBox *m_size_sb;
|
||||||
QLineEdit *m_line_edit;
|
QLineEdit *m_line_edit;
|
||||||
QPushButton *m_font_pb;
|
QPushButton *m_font_pb;
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
#else
|
#else
|
||||||
KColorButton *m_color_pb;
|
KColorButton *m_color_pb;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -252,4 +252,10 @@ void NewElementWizard::createNewElement()
|
|||||||
loc_.addToPath(m_chosen_file);
|
loc_.addToPath(m_chosen_file);
|
||||||
edit_new_element -> setLocation(loc_);
|
edit_new_element -> setLocation(loc_);
|
||||||
edit_new_element -> show();
|
edit_new_element -> show();
|
||||||
|
// Without this, the just-closed wizard can leave the main window
|
||||||
|
// as the active/key window (bugtracker #281, reported on macOS):
|
||||||
|
// the new editor is created and shown, but stays behind the main
|
||||||
|
// window and doesn't surface in the Dock/Windows menu.
|
||||||
|
edit_new_element -> raise();
|
||||||
|
edit_new_element -> activateWindow();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,8 @@
|
|||||||
#include "qetgraphicsitem/element.h"
|
#include "qetgraphicsitem/element.h"
|
||||||
#include "qetgraphicsitem/elementtextitemgroup.h"
|
#include "qetgraphicsitem/elementtextitemgroup.h"
|
||||||
|
|
||||||
// Private Qt PDF engine for drawHyperlink() — not public API, stable since Qt4.
|
// Private Qt PDF engine for drawHyperlink() — not public API.
|
||||||
// Requires QT += gui-private in qelectrotech.pro / gui-private in CMake.
|
// Availability of Qt::GuiPrivate is verified at configure time in CMakeLists.txt.
|
||||||
#include <private/qpdf_p.h>
|
#include <private/qpdf_p.h>
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
#include "ui_projectprintwindow.h"
|
#include "ui_projectprintwindow.h"
|
||||||
|
|
||||||
// Private Qt PDF engine for drawHyperlink() — not public API, stable since Qt4
|
// Private Qt PDF engine for drawHyperlink() is not a public API.
|
||||||
// Requires QT += gui-private in qelectrotech.pro
|
// Availability of Qt::GuiPrivate is verified at configure time in CMakeLists.txt.
|
||||||
#include <private/qpdf_p.h>
|
#include <private/qpdf_p.h>
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
#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);
|
print_dialog.setWindowFlags(Qt::Sheet);
|
||||||
#endif
|
#endif
|
||||||
print_dialog.setWindowTitle(tr("Options d'impression", "window title"));
|
print_dialog.setWindowTitle(tr("Options d'impression", "window title"));
|
||||||
// setOptions() is the modern spelling of the Qt4-era
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||||
// setEnabledOptions() (removed in Qt 6): replace the enabled
|
print_dialog.setEnabledOptions(QAbstractPrintDialog::PrintShowPageSize);
|
||||||
// option set with just PrintShowPageSize, on Qt 5 and 6 alike.
|
#else
|
||||||
print_dialog.setOptions(QAbstractPrintDialog::PrintShowPageSize);
|
#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) {
|
if (print_dialog.exec() == QDialog::Rejected) {
|
||||||
delete printer_;
|
delete printer_;
|
||||||
return;
|
return;
|
||||||
@@ -108,7 +112,7 @@ QString ProjectPrintWindow::docName(QETProject *project)
|
|||||||
{
|
{
|
||||||
QString doc_name;
|
QString doc_name;
|
||||||
if (!project->filePath().isEmpty()) {
|
if (!project->filePath().isEmpty()) {
|
||||||
doc_name = QFileInfo(project->filePath()).baseName();
|
doc_name = QFileInfo(project->filePath()).completeBaseName();
|
||||||
} else if (!project->title().isEmpty()) {
|
} else if (!project->title().isEmpty()) {
|
||||||
doc_name = project->title();
|
doc_name = project->title();
|
||||||
doc_name = QET::stringToFileName(doc_name);
|
doc_name = QET::stringToFileName(doc_name);
|
||||||
|
|||||||
+13
-5
@@ -345,11 +345,19 @@ QString ProjectView::askUserForFilePath(bool assign) {
|
|||||||
// if no filepath is provided, return an empty string
|
// if no filepath is provided, return an empty string
|
||||||
if (filepath.isEmpty()) return(filepath);
|
if (filepath.isEmpty()) return(filepath);
|
||||||
|
|
||||||
// if the name does not end with the .qet extension and we're _not_ using xdg-desktop-portal, append it
|
// Ensure the path ends with exactly one .qet extension, regardless of
|
||||||
bool usesPortal =
|
// whether the active file dialog already appended one. Whether it does
|
||||||
qEnvironmentVariableIsSet("FLATPAK_ID") ||
|
// depends on which backend actually shows the dialog (Qt's own vs. the
|
||||||
qEnvironmentVariableIsSet("SNAP_NAME");
|
// xdg-desktop-portal used by sandboxed Snap/Flatpak builds), and that
|
||||||
if (!filepath.endsWith(".qet", Qt::CaseInsensitive) && !usesPortal) filepath += ".qet";
|
// isn't reliably predictable from environment variables alone -- an
|
||||||
|
// earlier attempt at that (only appending when *not* Snap/Flatpak,
|
||||||
|
// assuming the portal always appends it) left Snap saves with no
|
||||||
|
// extension at all whenever the portal didn't (bugtracker #270).
|
||||||
|
// Stripping any existing suffix first and re-appending it once is
|
||||||
|
// correct either way.
|
||||||
|
if (filepath.endsWith(".qet", Qt::CaseInsensitive))
|
||||||
|
filepath.chop(4);
|
||||||
|
filepath += ".qet";
|
||||||
|
|
||||||
if (assign) {
|
if (assign) {
|
||||||
// assign the provided filepath to the currently edited project
|
// assign the provided filepath to the currently edited project
|
||||||
|
|||||||
+16
-16
@@ -35,28 +35,28 @@ public:
|
|||||||
: QTabWidget(parent)
|
: QTabWidget(parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
double temp_index = 0;
|
|
||||||
|
|
||||||
void wheelEvent(QWheelEvent *event) override
|
void wheelEvent(QWheelEvent *event) override
|
||||||
{
|
{
|
||||||
int index = currentIndex();
|
// Only intercept if Ctrl is held down
|
||||||
double delta = 0;
|
if (event->modifiers() & Qt::ControlModifier) {
|
||||||
double scale_factor = 0.005; // Decrease or increase speed of mouse wheel (0.04 = decrease)
|
int index = currentIndex();
|
||||||
if (event->modifiers() & Qt::ControlModifier) {
|
if (index != -1) {
|
||||||
if (index != -1) {
|
// angleDelta().y() is usually 120 per click.
|
||||||
delta = event->delta() * scale_factor; // Read and scale the scroll value
|
// Dividing by 120 gives you exactly +1 (scroll up) or -1 (scroll down)
|
||||||
if (delta > 0 && (temp_index > -1)) temp_index = temp_index - abs(delta);
|
int steps = event->angleDelta().y() / 120;
|
||||||
if (delta < 0 && (temp_index < count())) temp_index = temp_index + abs(delta);
|
|
||||||
|
|
||||||
index = int (temp_index);
|
if (steps != 0) {
|
||||||
qDebug() << "index" << index << "temp_index" << temp_index << " " << event->delta() << delta;
|
int newIndex = index - steps;
|
||||||
|
|
||||||
if (index >= 0 && index < count())
|
if (newIndex >= 0 && newIndex < count())
|
||||||
setCurrentIndex(index);
|
setCurrentIndex(newIndex);
|
||||||
|
|
||||||
// qDebug() << currentIndex();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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
|
#endif
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ void XRefProperties::fromSettings(const QSettings &settings,
|
|||||||
m_slave_label = settings.value(prefix % "slave_label", "(%f-%l%c)").toString();
|
m_slave_label = settings.value(prefix % "slave_label", "(%f-%l%c)").toString();
|
||||||
|
|
||||||
QMetaEnum var = QMetaEnum::fromType<Qt::Alignment>();
|
QMetaEnum var = QMetaEnum::fromType<Qt::Alignment>();
|
||||||
m_xref_pos = Qt::AlignmentFlag(var.keyToValue((settings.value(prefix % "xrefpos").toString()).toStdString().data()));
|
m_xref_pos = Qt::AlignmentFlag(var.keyToValue((settings.value(prefix % "xrefpos", "AlignBottom").toString()).toStdString().data()));
|
||||||
|
|
||||||
for (QString key : m_prefix_keys) {
|
for (QString key : m_prefix_keys) {
|
||||||
m_prefix.insert(key, settings.value(prefix + key % "prefix").toString());
|
m_prefix.insert(key, settings.value(prefix + key % "prefix").toString());
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@
|
|||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
#include <QProcessEnvironment>
|
#include <QProcessEnvironment>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
# include "ui/nokde/kautosavefile.h"
|
# include "ui/nokde/kautosavefile.h"
|
||||||
#else
|
#else
|
||||||
# include <KAutoSaveFile>
|
# include <KAutoSaveFile>
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
# include "ui/nokde/kautosavefile.h"
|
# include "ui/nokde/kautosavefile.h"
|
||||||
#else
|
#else
|
||||||
# include <KAutoSaveFile>
|
# include <KAutoSaveFile>
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ bool ProjectDBModel::setData(const QModelIndex &index, const QVariant &value, in
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_index_0_0_data.insert(role, value);
|
m_index_0_0_data.insert(role, value);
|
||||||
emit dataChanged(index, index, QVector<int>(role));
|
emit dataChanged(index, index, {role});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,7 +332,7 @@ void ProjectDBModel::dataBaseUpdated()
|
|||||||
auto row = m_record.size();
|
auto row = m_record.size();
|
||||||
auto col = row ? m_record.first().count() : 1;
|
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});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -155,6 +155,8 @@ void QETMainWindow::initCommonMenus()
|
|||||||
connect(settings_menu_, &QMenu::aboutToShow, this, &QETMainWindow::checkToolbarsmenu);
|
connect(settings_menu_, &QMenu::aboutToShow, this, &QETMainWindow::checkToolbarsmenu);
|
||||||
|
|
||||||
help_menu_ = new QMenu(tr("&Aide", "window menu"), this);
|
help_menu_ = new QMenu(tr("&Aide", "window menu"), this);
|
||||||
|
help_menu_ -> addAction(diagnostics_action_);
|
||||||
|
help_menu_ -> addSeparator();
|
||||||
help_menu_ -> addAction(whatsthis_action_);
|
help_menu_ -> addAction(whatsthis_action_);
|
||||||
help_menu_ -> addSeparator();
|
help_menu_ -> addSeparator();
|
||||||
help_menu_ -> addAction(manual_online_);
|
help_menu_ -> addAction(manual_online_);
|
||||||
@@ -164,8 +166,6 @@ void QETMainWindow::initCommonMenus()
|
|||||||
help_menu_ -> addAction(donate_);
|
help_menu_ -> addAction(donate_);
|
||||||
help_menu_ -> addAction(about_qt_);
|
help_menu_ -> addAction(about_qt_);
|
||||||
help_menu_ -> addAction(about_qet_);
|
help_menu_ -> addAction(about_qet_);
|
||||||
help_menu_ -> addSeparator();
|
|
||||||
help_menu_ -> addAction(diagnostics_action_);
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
upgrade_ -> setVisible(true);
|
upgrade_ -> setVisible(true);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include "titleblock/templatescollection.h"
|
#include "titleblock/templatescollection.h"
|
||||||
#include "titleblockproperties.h"
|
#include "titleblockproperties.h"
|
||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF
|
||||||
# include "ui/nokde/kautosavefile.h"
|
# include "ui/nokde/kautosavefile.h"
|
||||||
#else
|
#else
|
||||||
# include <KAutoSaveFile>
|
# include <KAutoSaveFile>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const QString SETTINGS_GROUP = QStringLiteral("shortcuts/");
|
const QString SETTINGS_GROUP = QStringLiteral("shortcuts/");
|
||||||
@@ -143,7 +144,7 @@ void ShortcutManager::setSequence(const QString &id, const QKeySequence &sequenc
|
|||||||
settings.setValue(key, sequence.toString());
|
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) {
|
if (target) {
|
||||||
target->setProperty("shortcut", QVariant::fromValue(sequence));
|
target->setProperty("shortcut", QVariant::fromValue(sequence));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -776,7 +776,20 @@ bool QETTitleBlockTemplateEditor::saveAs(const TitleBlockTemplateLocation &locat
|
|||||||
elmt.setAttribute("name", location.name());
|
elmt.setAttribute("name", location.name());
|
||||||
doc.appendChild(elmt);
|
doc.appendChild(elmt);
|
||||||
|
|
||||||
collection -> setTemplateXmlDescription(location.name(), elmt);
|
if (!collection -> setTemplateXmlDescription(location.name(), elmt)) {
|
||||||
|
// Report the failure instead of marking the template "saved"
|
||||||
|
// regardless (bugtracker #251) -- this return value used to
|
||||||
|
// be discarded here.
|
||||||
|
QET::QetMessageBox::critical(
|
||||||
|
this,
|
||||||
|
tr("Erreur", "message box title"),
|
||||||
|
tr(
|
||||||
|
"Impossible d'enregistrer le modèle « %1 ».",
|
||||||
|
"message box content - %1 is a title block template name"
|
||||||
|
).arg(location.name())
|
||||||
|
);
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
opened_from_file_ = false;
|
opened_from_file_ = false;
|
||||||
location_ = location;
|
location_ = location;
|
||||||
@@ -880,6 +893,21 @@ bool QETTitleBlockTemplateEditor::saveAs()
|
|||||||
if (location.isValid()) {
|
if (location.isValid()) {
|
||||||
return(saveAs(location));
|
return(saveAs(location));
|
||||||
}
|
}
|
||||||
|
if (!location.name().isEmpty()) {
|
||||||
|
// The name was rejected (e.g. contains a path separator or
|
||||||
|
// other filesystem-reserved character) rather than the user
|
||||||
|
// cancelling the dialog -- say so instead of silently doing
|
||||||
|
// nothing (bugtracker #251).
|
||||||
|
QET::QetMessageBox::critical(
|
||||||
|
this,
|
||||||
|
tr("Erreur", "message box title"),
|
||||||
|
tr(
|
||||||
|
"Le nom « %1 » n'est pas valide : il ne doit pas contenir "
|
||||||
|
"les caractères suivants : \\ / : * ? \" < > |",
|
||||||
|
"message box content - %1 is the rejected template name"
|
||||||
|
).arg(location.name())
|
||||||
|
);
|
||||||
|
}
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,13 @@ void TitleBlockTemplateLocation::setName(const QString &name) {
|
|||||||
*/
|
*/
|
||||||
bool TitleBlockTemplateLocation::isValid() const
|
bool TitleBlockTemplateLocation::isValid() const
|
||||||
{
|
{
|
||||||
return(!name_.isEmpty());
|
// The name becomes (part of) a filename on disk (see
|
||||||
|
// TitleBlockTemplatesFilesCollection::toFileName()). A name containing
|
||||||
|
// a path separator or another filesystem-reserved character silently
|
||||||
|
// fails to save instead of erroring, because it turns into an
|
||||||
|
// unintended subpath rather than a plain filename (bugtracker #251).
|
||||||
|
static const QRegularExpression invalid_chars_re(QStringLiteral("[\\\\/:*?\"<>|]"));
|
||||||
|
return(!name_.isEmpty() && !name_.contains(invalid_chars_re));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief ShortcutsConfigPage::ShortcutsConfigPage
|
@brief ShortcutsConfigPage::ShortcutsConfigPage
|
||||||
@@ -198,7 +199,7 @@ void ShortcutsConfigPage::resetRow(int row_index)
|
|||||||
|
|
||||||
void ShortcutsConfigPage::resetAllRows()
|
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);
|
row.edit->setKeySequence(row.default_sequence);
|
||||||
}
|
}
|
||||||
checkConflicts();
|
checkConflicts();
|
||||||
@@ -211,7 +212,7 @@ void ShortcutsConfigPage::resetAllRows()
|
|||||||
*/
|
*/
|
||||||
void ShortcutsConfigPage::applyConf()
|
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());
|
ShortcutManager::instance().setSequence(row.id, row.edit->keySequence());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include <QStandardItem>
|
#include <QStandardItem>
|
||||||
|
#include <QTimer>
|
||||||
#include <QUndoCommand>
|
#include <QUndoCommand>
|
||||||
|
|
||||||
static int src_txt_row = 0;
|
static int src_txt_row = 0;
|
||||||
@@ -1595,6 +1596,15 @@ DynamicTextItemDelegate::DynamicTextItemDelegate(QObject *parent) :
|
|||||||
QStyledItemDelegate(parent)
|
QStyledItemDelegate(parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
void DynamicTextItemDelegate::commitAndCloseDeferred(QWidget *editor) const
|
||||||
|
{
|
||||||
|
auto *self = const_cast<DynamicTextItemDelegate *>(this);
|
||||||
|
QTimer::singleShot(0, self, [self, editor]() {
|
||||||
|
emit self->commitData(editor);
|
||||||
|
emit self->closeEditor(editor);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *DynamicTextItemDelegate::createEditor(
|
QWidget *DynamicTextItemDelegate::createEditor(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
const QStyleOptionViewItem &option,
|
const QStyleOptionViewItem &option,
|
||||||
@@ -1682,13 +1692,43 @@ QWidget *DynamicTextItemDelegate::createEditor(
|
|||||||
w->setProperty("ok", ok);
|
w->setProperty("ok", ok);
|
||||||
}
|
}
|
||||||
w->setObjectName("font_dialog");
|
w->setObjectName("font_dialog");
|
||||||
|
commitAndCloseDeferred(w);
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
case DynamicElementTextModel::color:
|
case DynamicElementTextModel::color:
|
||||||
{
|
{
|
||||||
QColorDialog *cd = new QColorDialog(index.data(Qt::EditRole).value<QColor>(), parent);
|
/* Like the font case above: run the dialog synchronously via
|
||||||
cd->setObjectName("color_dialog");
|
* its static convenience function and stash the result on a
|
||||||
return cd;
|
* plain placeholder widget, rather than handing back the
|
||||||
|
* QColorDialog itself as the item view's "editor".
|
||||||
|
*
|
||||||
|
* The item view's own Enter/Escape handling (the base
|
||||||
|
* QStyledItemDelegate::eventFilter(), since "color_dialog"
|
||||||
|
* isn't one of the objectNames special-cased in this
|
||||||
|
* delegate's own eventFilter() above) treats whatever
|
||||||
|
* createEditor() returned as a small inline editor it
|
||||||
|
* commits and destroys directly on a key press. A QColorDialog
|
||||||
|
* is not that: on Windows it can hand off to the native
|
||||||
|
* color picker, whose own accept/close path then races the
|
||||||
|
* view's -- pressing Enter fired both, one tearing down an
|
||||||
|
* object the other was still using (case #323 on the bug
|
||||||
|
* tracker: "QObject::installEventFilter(): Cannot filter
|
||||||
|
* events for objects in a different thread" immediately
|
||||||
|
* followed by a segfault; clicking the dialog's own OK
|
||||||
|
* button with the mouse didn't reach the view's key
|
||||||
|
* handling, so it didn't crash). Resolving the dialog
|
||||||
|
* before returning removes the second, competing teardown
|
||||||
|
* path entirely. */
|
||||||
|
QColor color = QColorDialog::getColor(index.data(Qt::EditRole).value<QColor>(), parent);
|
||||||
|
QWidget *w = new QWidget(parent);
|
||||||
|
if (color.isValid())
|
||||||
|
{
|
||||||
|
w->setProperty("color", color);
|
||||||
|
w->setProperty("ok", true);
|
||||||
|
}
|
||||||
|
w->setObjectName("color_dialog");
|
||||||
|
commitAndCloseDeferred(w);
|
||||||
|
return w;
|
||||||
}
|
}
|
||||||
case DynamicElementTextModel::pos:
|
case DynamicElementTextModel::pos:
|
||||||
{
|
{
|
||||||
@@ -1788,11 +1828,11 @@ void DynamicTextItemDelegate::setModelData(
|
|||||||
{
|
{
|
||||||
if(QStandardItem *qsi = qsim->itemFromIndex(index))
|
if(QStandardItem *qsi = qsim->itemFromIndex(index))
|
||||||
{
|
{
|
||||||
QColorDialog *cd = static_cast<QColorDialog *> (editor);
|
if (editor->property("ok").toBool() == true)
|
||||||
if (cd->result() == QDialog::Accepted)
|
|
||||||
{
|
{
|
||||||
qsi->setData(cd->selectedColor(), Qt::EditRole);
|
QColor color = editor->property("color").value<QColor>();
|
||||||
qsi->setData(cd->selectedColor(), Qt::ForegroundRole);
|
qsi->setData(color, Qt::EditRole);
|
||||||
|
qsi->setData(color, Qt::ForegroundRole);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,6 +155,21 @@ class DynamicTextItemDelegate : public QStyledItemDelegate
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList availableInfo(DynamicElementTextItem *deti) const;
|
QStringList availableInfo(DynamicElementTextItem *deti) const;
|
||||||
|
/**
|
||||||
|
@brief commitAndCloseDeferred
|
||||||
|
Schedule commitData()/closeEditor() for @a editor on the next
|
||||||
|
event loop iteration. For editors resolved synchronously inside
|
||||||
|
createEditor() (font/color, both run their picker dialog before
|
||||||
|
returning) there is no user interaction left to drive the base
|
||||||
|
QStyledItemDelegate::eventFilter()'s usual Enter/focus-out commit
|
||||||
|
path, so without this the value sits picked-but-uncommitted
|
||||||
|
until something unrelated (e.g. clicking elsewhere) happens to
|
||||||
|
trigger it. Deferred rather than called immediately: the view
|
||||||
|
only registers the widget createEditor() returns as "the active
|
||||||
|
editor" *after* createEditor() itself returns, so emitting here
|
||||||
|
would target an editor the view doesn't know about yet.
|
||||||
|
*/
|
||||||
|
void commitAndCloseDeferred(QWidget *editor) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DYNAMICELEMENTTEXTMODEL_H
|
#endif // DYNAMICELEMENTTEXTMODEL_H
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ add_executable(
|
|||||||
${QET_DIR}/sources/borderproperties.h
|
${QET_DIR}/sources/borderproperties.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT BUILD_WITH_KF5)
|
if(NOT BUILD_WITH_KF)
|
||||||
target_sources(
|
target_sources(
|
||||||
${PROJECT_NAME}
|
${PROJECT_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
@@ -109,7 +109,7 @@ target_link_libraries(
|
|||||||
PUBLIC
|
PUBLIC
|
||||||
Catch2::Catch2
|
Catch2::Catch2
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${KF5_PRIVATE_LIBRARIES}
|
${KF_PRIVATE_LIBRARIES}
|
||||||
${QET_PRIVATE_LIBRARIES})
|
${QET_PRIVATE_LIBRARIES})
|
||||||
|
|
||||||
if (DEFINED ENV{CATCH_INCLUDE_DIR})
|
if (DEFINED ENV{CATCH_INCLUDE_DIR})
|
||||||
|
|||||||
@@ -85,6 +85,6 @@ target_link_libraries(
|
|||||||
PUBLIC
|
PUBLIC
|
||||||
gmock gmock_main
|
gmock gmock_main
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${KF5_PRIVATE_LIBRARIES}
|
${KF_PRIVATE_LIBRARIES}
|
||||||
${QET_PRIVATE_LIBRARIES})
|
${QET_PRIVATE_LIBRARIES})
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,6 @@ target_link_libraries(
|
|||||||
PUBLIC
|
PUBLIC
|
||||||
gtest gtest_main
|
gtest gtest_main
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${KF5_PRIVATE_LIBRARIES}
|
${KF_PRIVATE_LIBRARIES}
|
||||||
${QET_PRIVATE_LIBRARIES})
|
${QET_PRIVATE_LIBRARIES})
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,6 @@ target_link_libraries(
|
|||||||
${PROJECT_NAME}
|
${PROJECT_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
Qt::Test
|
Qt::Test
|
||||||
${KF5_PRIVATE_LIBRARIES}
|
${KF_PRIVATE_LIBRARIES}
|
||||||
${QET_PRIVATE_LIBRARIES})
|
${QET_PRIVATE_LIBRARIES})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user