Compare commits

...

5 Commits

Author SHA1 Message Date
joshua
ab2f933fdf Re-enable multi-threading to load collection
The name of the elements and folders of the collection are not displayed
until we hover the item with the mouse.
This due that QtConcurent::run was disabled at loading of collection in
the goal of use QtConcurrent::run with Qt6.
Run is made to run a function once.
Map is made to run a fonction for each item of a sequence (what we need
in this case).
Remove code of run and re-enable code for map.
2026-01-28 19:47:04 +01:00
joshua
7f718f672f Fix : can't open recent file 2026-01-28 00:15:09 +01:00
joshua
9ec02bc088 Build with qt6 and cmake
First build with qt6 and cmake.
QET compil, but a lot of things don't work.
Build tested on debian sid and ubuntu 25.04.

Dependency needed under debian and ubuntu :
qtcreator cmake qt6-tools-dev qt6-svg-dev libsqlite3-dev
libkf6coreaddons-dev extra-cmake-modules libkf6widgetsaddons-dev
2026-01-27 23:31:34 +01:00
Laurent Trinques
0c62f291f0 Set QetVersion::VersionType VERSION_TYPE = QetVersion::dev; return
Some checks failed
Auto-build doxygen docs / doxygen (push) Has been cancelled
Auto-build doxygen docs / deploy (push) Has been cancelled
QVersionNumber{ 0, 100, 1 };
2026-01-27 08:22:38 +01:00
plc-user
534de377d3 dxf2elmt: point link to general release directory instead of special version
Some checks failed
Auto-build doxygen docs / doxygen (push) Has been cancelled
Auto-build doxygen docs / deploy (push) Has been cancelled
2026-01-26 18:47:43 +01:00
20 changed files with 101 additions and 145 deletions

View File

@@ -16,10 +16,10 @@
include(cmake/hoto_update_cmake_message.cmake)
cmake_minimum_required(VERSION 3.14...3.19 FATAL_ERROR)
cmake_minimum_required(VERSION 3.21.1 FATAL_ERROR)
project(qelectrotech
VERSION 0.9.0
VERSION 0.100.0
DESCRIPTION "QET is a CAD/CAE editor focusing on schematics drawing features."
HOMEPAGE_URL "https://qelectrotech.org/"
LANGUAGES CXX)
@@ -27,9 +27,16 @@ project(qelectrotech
include(cmake/copyright_message.cmake)
set(QET_DIR ${PROJECT_SOURCE_DIR})
include(cmake/qet_compilation_vars.cmake)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt6 REQUIRED COMPONENTS ${QET_COMPONENTS})
qt_standard_project_setup()
# Add sub directories
option(PACKAGE_TESTS "Build the tests" ON)
option(PACKAGE_TESTS "Build the tests" NO)
if(PACKAGE_TESTS)
message("Add sub directory tests")
add_subdirectory(tests)
@@ -43,42 +50,19 @@ 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)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
SET(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(
QT
NAMES
Qt6
Qt5
COMPONENTS
${QET_COMPONENTS}
REQUIRED
)
find_package(
Qt${QT_VERSION_MAJOR}
COMPONENTS
${QET_COMPONENTS}
REQUIRED)
set(CMAKE_AUTOUIC_SEARCH_PATHS ${QET_DIR}/sources/ui)
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${QET_DIR}/lang")
qt5_add_translation(QM_FILES ${TS_FILES})
# als laatse
include(cmake/define_definitions.cmake)
add_executable(
find_package(KF6WidgetsAddons REQUIRED)
qt_add_executable(
${PROJECT_NAME}
${QET_RES_FILES}
${QET_SRC_FILES}
@@ -86,14 +70,26 @@ add_executable(
${QET_DIR}/qelectrotech.qrc
)
if(QMFILES_AS_RESOURCE)
qt_add_translations(${PROJECT_NAME} TS_FILES ${TS_FILES} RESOURCE_PREFIX "/lang")
else()
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${QET_DIR}/lang")
qt_add_translation(QM_FILES ${TS_FILES})
endif()
find_package(SQLite3 REQUIRED)
target_link_libraries(
${PROJECT_NAME}
PUBLIC
PRIVATE
pugixml::pugixml
SingleApplication::SingleApplication
${KF5_PRIVATE_LIBRARIES}
SQLite::SQLite3
${KF6_PRIVATE_LIBRARIES}
${QET_PRIVATE_LIBRARIES}
KF6::WidgetsAddons
)
target_include_directories(
@@ -149,6 +145,7 @@ install(FILES LICENSE ELEMENTS.LICENSE CREDIT README ChangeLog DESTINATION share
install(FILES misc/org.qelectrotech.qelectrotech.desktop DESTINATION share/applications)
install(FILES misc/qelectrotech.xml DESTINATION share/mime/packages)
install(FILES misc/qelectrotech.appdata.xml DESTINATION ${QET_APPDATA_PATH})
install(FILES ${QM_FILES} DESTINATION ${QET_LANG_PATH})
if(NOT QMFILES_AS_RESOURCE)
install(FILES ${QM_FILES} DESTINATION ${QET_LANG_PATH})
endif()
endif()

View File

@@ -62,10 +62,15 @@ 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})
else()
add_definitions(-DBUILD_WITHOUT_KF5)
if(BUILD_WITH_KF6 AND BUILD_KF6)
message("KF6_GIT_TAG :" ${KF6_GIT_TAG})
endif()
if(NOT BUILD_WITH_KF6)
add_definitions(-DBUILD_WITHOUT_KF6)
endif()
message("QET_COMPONENTS :" ${QET_COMPONENTS})
message("QT_VERSION_MAJOR :" ${QT_VERSION_MAJOR})
message("Qt version :" ${Qt6_VERSION})
if(QMFILES_AS_RESOURCE)
add_definitions(-DQMFILES_AS_RESOURCE)
endif()

View File

@@ -31,5 +31,8 @@ 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 KF6
option(BUILD_WITH_KF6 "Build with KF6" ON)
# Use translations as a Qt resource
option(QMFILES_AS_RESOURCE "Use .qm files as Qt resource" ON)

View File

@@ -14,54 +14,47 @@
# You should have received a copy of the GNU General Public License
# along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
message(" - fetch_kdeaddons")
message(STATUS "fetch_kdeaddons")
if(DEFINED BUILD_WITH_KF5)
Include(FetchContent)
if(BUILD_WITH_KF6)
option(BUILD_KF6 "Build KF6 libraries, use system ones otherwise" OFF)
block(PROPAGATE KF6_GIT_TAG)
set(BUILD_TESTING OFF)
set(KDE_SKIP_TEST_SETTINGS ON)
set(BUILD_DESIGNERPLUGIN OFF)
set(KCOREADDONS_USE_QML OFF)
set(BUILD_QCH OFF)
set(BUILD_SHARED_LIBS OFF)
find_package(ECM 6.8.0 REQUIRED NO_MODULE)
list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
option(BUILD_KF5 "Build KF5 libraries, use system ones otherwise" YES)
if(BUILD_KF6)
Include(FetchContent)
if(BUILD_KF5)
if(NOT DEFINED KF5_GIT_TAG)
#https://qelectrotech.org/forum/viewtopic.php?pid=13924#p13924
set(KF5_GIT_TAG v5.77.0)
if(NOT DEFINED KF6_GIT_TAG)
set(KF6_GIT_TAG v6.8.0)
endif()
# Fix stop the run autotests of kcoreaddons
# see
# https://invent.kde.org/frameworks/kcoreaddons/-/blob/master/CMakeLists.txt#L98
# issue:
# CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:89 (add_executable):
# Cannot find source file:
# see
# https://qelectrotech.org/forum/viewtopic.php?pid=13929#p13929
set(KDE_SKIP_TEST_SETTINGS "TRUE")
set(BUILD_TESTING "0")
FetchContent_Declare(
ecm
GIT_REPOSITORY https://invent.kde.org/frameworks/extra-cmake-modules.git
GIT_TAG ${KF5_GIT_TAG})
FetchContent_MakeAvailable(ecm)
FetchContent_Declare(
kcoreaddons
GIT_REPOSITORY https://invent.kde.org/frameworks/kcoreaddons.git
GIT_TAG ${KF5_GIT_TAG})
GIT_TAG ${KF6_GIT_TAG})
FetchContent_MakeAvailable(kcoreaddons)
get_target_property(kca_version KF6::CoreAddons VERSION)
FetchContent_Declare(
kwidgetsaddons
GIT_REPOSITORY https://invent.kde.org/frameworks/kwidgetsaddons.git
GIT_TAG ${KF5_GIT_TAG})
FetchContent_MakeAvailable(kwidgetsaddons)
else()
find_package(KF5CoreAddons REQUIRED)
find_package(KF5WidgetsAddons REQUIRED)
find_package(KF6CoreAddons REQUIRED)
set(kca_version ${KF6CoreAddons_VERSION})
endif()
set(KF5_PRIVATE_LIBRARIES
KF5::WidgetsAddons
KF5::CoreAddons
get_target_property(kwa_type KF6::CoreAddons TYPE)
message(NOTICE "ecm version : " ${ECM_VERSION})
message(NOTICE "kcoreaddons library : " ${kca_type})
message(NOTICE "kcoreaddons version : " ${kca_version})
endblock()
set(KF6_PRIVATE_LIBRARIES
KF6::CoreAddons
)
endif()

View File

@@ -17,6 +17,8 @@
message(" - qet_compilation_vars")
set(QET_COMPONENTS
Core
Gui
LinguistTools
PrintSupport
Xml
@@ -109,6 +111,12 @@ set(QET_SRC_FILES
${QET_DIR}/sources/borderproperties.h
${QET_DIR}/sources/bordertitleblock.cpp
${QET_DIR}/sources/bordertitleblock.h
# ${QET_DIR}/sources/colorbutton.cpp
# ${QET_DIR}/sources/colorbutton.h
# ${QET_DIR}/sources/colorcombobox.cpp
# ${QET_DIR}/sources/colorcombobox.h
# ${QET_DIR}/sources/colorcomboboxdelegate.cpp
# ${QET_DIR}/sources/colorcomboboxdelegate.h
${QET_DIR}/sources/conductorautonumerotation.cpp
${QET_DIR}/sources/conductorautonumerotation.h
${QET_DIR}/sources/conductornumexport.cpp
@@ -726,19 +734,17 @@ set(TS_FILES
${QET_DIR}/lang/qet_mn.ts
${QET_DIR}/lang/qet_nb.ts
${QET_DIR}/lang/qet_nl.ts
${QET_DIR}/lang/qet_nl_BE.ts
${QET_DIR}/lang/qet_nl_BE.ts
${QET_DIR}/lang/qet_no.ts
${QET_DIR}/lang/qet_pl.ts
${QET_DIR}/lang/qet_pt.ts
${QET_DIR}/lang/qet_pt_BR.ts
${QET_DIR}/lang/qet_ro.ts
${QET_DIR}/lang/qet_rs.ts
${QET_DIR}/lang/qet_ru.ts
${QET_DIR}/lang/qet_sk.ts
${QET_DIR}/lang/qet_sl.ts
${QET_DIR}/lang/qet_sr.ts
${QET_DIR}/lang/qet_sv.ts
${QET_DIR}/lang/qet_tr.ts
${QET_DIR}/lang/qet_uk.ts
${QET_DIR}/lang/qet_zh.ts
)

View File

@@ -26,12 +26,7 @@
#include "xmlprojectelementcollectionitem.h"
#include <QFutureWatcher>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
#include <QtConcurrentMap>
#else
#include <QtConcurrentRun>
#endif
/**
@brief ElementsCollectionModel::ElementsCollectionModel
Constructor
@@ -298,15 +293,8 @@ void ElementsCollectionModel::loadCollections(bool common_collection,
&QFutureWatcher<void>::finished,
watcher,
&QFutureWatcher<void>::deleteLater);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
m_future = QtConcurrent::map(m_items_list_to_setUp, setUpData);
#else
# if TODO_LIST
# pragma message("@TODO remove code for QT 6 or later")
# endif
qDebug() << "Help code for QT 6 or later"
<< "QtConcurrent::run its backwards now...function, object, args";
#endif
watcher->setFuture(m_future);
}

View File

@@ -807,13 +807,13 @@ bool ElementsLocation::setXml(const QDomDocument &xml_document) const
QString path_ = collectionPath(false);
QRegularExpression rx("^(.*)/(.*\\.elmt)$");
if (rx.exactMatch(path_))
if (auto regex_match = rx.match(path_); regex_match.hasMatch())
{
return project()
->embeddedElementCollection()
->addElementDefinition(
rx.cap(1),
rx.cap(2),
regex_match.captured(1),
regex_match.captured(2),
xml_document.documentElement());
}
else

View File

@@ -18,6 +18,7 @@
#include "terminalstripdrawer.h"
#include <QPainter>
#include <QHash>
namespace TerminalStripDrawer {

View File

@@ -131,7 +131,7 @@ bool PhysicalTerminal::setLevelOf(const QSharedPointer<RealTerminal> &terminal,
if (i >= 0)
{
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
m_real_terminal.swapItemsAt(i, std::min(level, m_real_terminal.size()-1));
m_real_terminal.swapItemsAt(i, std::min(static_cast<qsizetype>(level), m_real_terminal.size()-1));
#else
auto j = std::min(level, m_real_terminal.size()-1);
std::swap(m_real_terminal.begin()[i], m_real_terminal.begin()[j]);

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/Vadoola/dxf2elmt/releases/tag/v0.5.1"),
QStringLiteral("https://github.com/Vadoola/dxf2elmt/releases"),
dxf2ElmtDirPath(),
parent);
dialog_.exec();

View File

@@ -188,10 +188,8 @@ void MachineInfo::send_info_to_debug()
QDirIterator it1(QETApp::commonElementsDir().toLatin1(),nameFilters, QDir::Files, QDirIterator::Subdirectories);
while (it1.hasNext())
{
if(it1.next() > 0 )
{
it1.next();
commomElementsDir ++;
}
}
qInfo()<< " Common Elements count:"<< commomElementsDir << "Elements";
@@ -200,10 +198,8 @@ void MachineInfo::send_info_to_debug()
QDirIterator it2(QETApp::customElementsDir().toLatin1(), nameFilters, QDir::Files, QDirIterator::Subdirectories);
while (it2.hasNext())
{
if(it2.next() > 0 )
{
it2.next();
customElementsDir ++;
}
}
qInfo()<< " Custom Elements count:"<< customElementsDir << "Elements";
@@ -211,10 +207,8 @@ void MachineInfo::send_info_to_debug()
QDirIterator it3(QETApp::companyElementsDir().toLatin1(), nameFilters, QDir::Files, QDirIterator::Subdirectories);
while (it3.hasNext())
{
if(it3.next() > 0 )
{
it3.next();
companyElementsDir ++;
}
}
qInfo()<< " Company Elements count:"<< companyElementsDir << "Elements";

View File

@@ -19,11 +19,11 @@
namespace QetVersion
{
QetVersion::VersionType VERSION_TYPE = QetVersion::stable;
QetVersion::VersionType VERSION_TYPE = QetVersion::dev;
QVersionNumber currentVersion()
{
return QVersionNumber{ 0, 100, 0 };
return QVersionNumber{ 0, 100, 1 };
}
QString displayedVersion()

View File

@@ -20,6 +20,7 @@
#include <QDomElement>
#include <QPen>
#include <QUuid>
class QDomDocument;
class QDir;

View File

@@ -70,25 +70,6 @@ void QGIManager::release(QGraphicsItem *qgi) {
}
}
/**
Demande au QGIManager de gerer plusieurs QGI
@param qgis QGraphicsItems a gerer
*/
void QGIManager::manage(const QList<QGraphicsItem *> &qgis) {
foreach(QGraphicsItem *qgi, qgis) manage(qgi);
}
/**
Indique au QGIManager que pour chaque QGI fourni, une reference vers celui-ci
a ete detruite.
S'il n'y a plus de references vers un QGI et que celui-ci n'est pas present
sur la scene de ce QGIManager, alors il sera detruit.
@param qgis QGraphicsItems a ne plus gerer
*/
void QGIManager::release(const QList<QGraphicsItem *> &qgis) {
foreach(QGraphicsItem *qgi, qgis) release(qgi);
}
void QGIManager::manage(const QVector<QGraphicsItem *> &items) {
for (const auto &qgi : items) {
manage(qgi);

View File

@@ -45,10 +45,6 @@ class QGIManager {
public:
void manage(QGraphicsItem *);
void release(QGraphicsItem *);
QT_DEPRECATED_X("Use QGIManager::manage(const QVector<QGraphicsItem *> &) instead")
void manage(const QList<QGraphicsItem *> &);
QT_DEPRECATED_X("Use QGIManager::release(const QVector<QGraphicsItem *> &) instead")
void release(const QList<QGraphicsItem *> &);
void manage(const QVector<QGraphicsItem *> &items);
void release(const QVector<QGraphicsItem *> &items);
void setDestroyQGIOnDelete(bool);

View File

@@ -16,7 +16,6 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "recentfiles.h"
#include "qeticons.h"
#include <QMenu>
/**
@@ -33,7 +32,7 @@ RecentFiles::RecentFiles(const QString &identifier, int size, QObject *parent) :
menu_(nullptr)
{
mapper_ = new QSignalMapper(this);
connect(mapper_, SIGNAL(mapped(const QString &)), this, SLOT(handleMenuRequest(const QString &)));
connect(mapper_, &QSignalMapper::mappedString, this, &RecentFiles::fileOpeningRequested);
extractFilesFromSettings();
buildMenu();
@@ -103,13 +102,6 @@ void RecentFiles::save()
saveFilesToSettings();
}
/**
Gere les actions sur le menu
*/
void RecentFiles::handleMenuRequest(const QString &filepath) {
emit(fileOpeningRequested(filepath));
}
/**
Gere le fait qu'un fichier ait ete ouvert
@param filepath Chemin du fichier ouvert
@@ -193,6 +185,6 @@ void RecentFiles::buildMenu()
// lie l'action et le mapper
mapper_ -> setMapping(action, filepath);
connect(action, SIGNAL(triggered()), mapper_, SLOT(map()));
connect(action, &QAction::triggered, mapper_, qOverload<>(&QSignalMapper::map));
}
}

View File

@@ -54,9 +54,6 @@ class RecentFiles : public QObject {
void saveFilesToSettings();
void buildMenu();
private slots:
void handleMenuRequest(const QString &);
// attributes
private:
QString identifier_;

View File

@@ -454,7 +454,7 @@ QDomElement TitleBlockTemplatesFilesCollection::getTemplateXmlDescription(const
}
QDomDocument *xml_document = new QDomDocument();
bool xml_parsing = xml_document -> setContent(&xml_file);
const auto xml_parsing = xml_document -> setContent(&xml_file);
if (!xml_parsing) {
delete xml_document;
return(QDomElement());

View File

@@ -24,6 +24,8 @@ class HelperCell;
class SplittedHelperCell;
class TitleBlockTemplateCommand;
class TitleBlockTemplateCellsSet;
class QGraphicsLayoutItem;
class QGraphicsGridLayout;
/**
This QGraphicsView subclass is used in the title block template editor to

View File

@@ -103,7 +103,7 @@ bool TitleBlockTemplate::loadFromXmlFile(const QString &filepath) {
// parse its content as XML
QDomDocument xml_doc;
bool xml_parsing = xml_doc.setContent(&template_file);
const auto xml_parsing = xml_doc.setContent(&template_file);
if (!xml_parsing) {
return(false);
}