Repository navigation
Replies: 7 comments 6 replies
|
@scorpio810 — I don't think #562 actually covers this one, worth flagging before it gets marked as answered. @TomasTal is asking for a general, user-extensible mechanism: an element author defines their own custom-named information fields (e.g. #562 adds exactly 5 new fields — The actual gap: A real fix for this request would need a genuinely user-extensible custom element-info system: something an element author can add/name in the element editor, that gets serialized per-instance (similar in spirit to how project/folio custom variables already work today), and shows up automatically in the dynamic-text "Element information" dropdown by name. (Also worth knowing regardless of the above: #562 is still unmerged, so it isn't something usable today either way.) |
|
|
BTW, you can use your tittleblock variables also. |
|
Double-checked this against the live source (not just the screenshot) before replying again, since I don't want to misrepresent it:
Good news while checking this, though — the fix is smaller than it might look. The per-element data model already supports arbitrary custom keys; only the UI doesn't expose them. // sources/qetgraphicsitem/element.cpp:948-953
if (! m_data.m_informations.keys().isEmpty()) {
QDomElement infos = document.createElement(QStringLiteral("elementInformations"));
m_data.m_informations.toXml(infos, QStringLiteral("elementInformation"));
element.appendChild(infos);
}Whatever keys happen to be in there get written and read back ( So a sketch of what's actually missing is small — an "Add property" action that lets the user name a new row, using the exact same widget class the fixed rows already use: // ElementInfoWidget: new slot, wired to a small "+" toolbutton in the .ui
void ElementInfoWidget::addCustomProperty()
{
bool ok = false;
const QString name = QInputDialog::getText(
this, tr("Add property"), tr("Property name:"),
QLineEdit::Normal, QString(), &ok);
if (!ok || name.isEmpty())
return;
// Reject collisions with the fixed keys / an existing custom one
if (infoPartWidgetForKey(name)) {
QMessageBox::warning(this, tr("Add property"),
tr("A property named \"%1\" already exists.").arg(name));
return;
}
// Same widget class the fixed rows already use — key == translated_key
// since a user-chosen name has nothing to translate.
auto *eipw = new ElementInfoPartWidget(name, name, this);
ui->scroll_vlayout->insertWidget(m_eipw_list.count(), eipw);
m_eipw_list << eipw;
connect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply);
}No change needed to |
|
It seems that this isn't a priority. But if more people would understand the possibilities of this proposal i think more people would upvote it. :-( |

Uh oh!
There was an error while loading. Please reload this page.
I would like to suggest the possibility of adding properties (Element Property/Informations) in the "Edit/edit element properties" window.
Example:

AddressA
AddressB
AddressC
...
These properties should be editable when the element is inserted into a schematic and accessible from dynamic text fields.
As an example i created an IO card for siemens that i want o use multiple times in the project. The card will have multiple addresses.
I want to be able to set them after the insertion in the project.
When creating an element, I would use this newly created "element property" because the existing properties as "Auxiliary block 1, Label, Function, Manufacturer,...) doesn't fit the task i need.
I can use the Auxiliary block 1 and 2 for something like that but if i need more than it will be confusing fast. And in few months i will don't remember what block is which field.
Thank you, the program is great.
All reactions