mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-03 01:04:13 +02:00
Keep both folio report arrows in the folio's context menu
Fixes #1210. The "Renvoi de folio" submenu offered the common coming and going arrows only while the project had no folio report element yet. Placing one copies it into the embedded collection, so from then on the menu listed just that one and the other arrow could not be inserted until the project was closed without saving. The two common arrows are now always listed, after the project's own report elements, each name once. Checked in the GUI on a blank one-folio project: on master the submenu drops from two entries to one after a coming arrow is placed and the second pick places another coming arrow; with this change it keeps two entries and the second pick places a going arrow (both in the saved file). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+12
-12
@@ -1950,8 +1950,8 @@ void DiagramView::contextMenuEvent(QContextMenuEvent *e)
|
||||
@brief DiagramView::updateFolioReportMenu
|
||||
Fill the "Renvoi de folio" submenu of the context menu with the folio
|
||||
report elements this project already uses -- the ones in its embedded
|
||||
collection -- or, when it has none yet, the coming and going arrows of
|
||||
the common collection. An entry places its element where the context
|
||||
collection -- and the coming and going arrows of the common collection,
|
||||
each name listed once. An entry places its element where the context
|
||||
menu was opened. Left empty, and so hidden, on a read-only diagram.
|
||||
*/
|
||||
void DiagramView::updateFolioReportMenu()
|
||||
@@ -1965,9 +1965,9 @@ void DiagramView::updateFolioReportMenu()
|
||||
QETProject *project = m_diagram->project();
|
||||
XmlElementCollection *collection =
|
||||
project ? project->embeddedElementCollection() : nullptr;
|
||||
QSet<QString> names;
|
||||
if (collection)
|
||||
{
|
||||
QSet<QString> names;
|
||||
const QDomNodeList definitions =
|
||||
collection->root().elementsByTagName(QStringLiteral("definition"));
|
||||
for (int i = 0 ; i < definitions.count() ; ++i)
|
||||
@@ -1990,16 +1990,16 @@ void DiagramView::updateFolioReportMenu()
|
||||
}
|
||||
}
|
||||
|
||||
if (locations.isEmpty())
|
||||
//Always offer both standard arrows: placing one copies it into the
|
||||
//embedded collection, and must not hide the other one.
|
||||
for (const auto path : {
|
||||
"common://10_electric/10_allpole/100_folio_referencing/01coming_arrow.elmt",
|
||||
"common://10_electric/10_allpole/100_folio_referencing/02going_arrow.elmt"})
|
||||
{
|
||||
for (const auto path : {
|
||||
"common://10_electric/10_allpole/100_folio_referencing/01coming_arrow.elmt",
|
||||
"common://10_electric/10_allpole/100_folio_referencing/02going_arrow.elmt"})
|
||||
{
|
||||
const ElementsLocation location(QString::fromLatin1(path));
|
||||
if (location.exist()) {
|
||||
locations << location;
|
||||
}
|
||||
const ElementsLocation location(QString::fromLatin1(path));
|
||||
if (location.exist() && !names.contains(location.name())) {
|
||||
names.insert(location.name());
|
||||
locations << location;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user