mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Dynamic element text item :
when text is owned by a folio report, the only information available to the text is : the label (formula used for the Xref between linked report), the function of the potential and tension/protocol of the potential. Unlike other elements there is no more information, because a report is not a real element. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5039 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -27,6 +27,8 @@
|
||||
#include "qetapp.h"
|
||||
#include "element.h"
|
||||
#include "compositetexteditdialog.h"
|
||||
#include "terminal.h"
|
||||
#include "conductor.h"
|
||||
|
||||
DynamicElementTextModel::DynamicElementTextModel(QObject *parent) :
|
||||
QStandardItemModel(parent)
|
||||
@@ -628,20 +630,38 @@ void DynamicTextItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *
|
||||
QStringList DynamicTextItemDelegate::availableInfo(DynamicElementTextItem *deti) const
|
||||
{
|
||||
QStringList qstrl;
|
||||
Element *elmt = deti->elementUseForInfo();
|
||||
if(!elmt)
|
||||
return qstrl;
|
||||
|
||||
|
||||
QStringList info_list = QETApp::elementInfoKeys();
|
||||
info_list.removeAll("formula"); //No need to have formula
|
||||
DiagramContext dc = elmt->elementInformations();
|
||||
|
||||
for(QString info : info_list)
|
||||
if(deti->parentElement()->linkType() & Element::AllReport) //Special treatment for text owned by a folio report
|
||||
{
|
||||
if(dc.contains(info))
|
||||
qstrl << info;
|
||||
qstrl << "label";
|
||||
|
||||
if(!deti->m_watched_conductor.isNull())
|
||||
{
|
||||
Conductor *cond = deti->m_watched_conductor.data();
|
||||
if (!cond->properties().m_function.isEmpty())
|
||||
qstrl << "function";
|
||||
if(!cond->properties().m_tension_protocol.isEmpty())
|
||||
qstrl << "tension-protocol";
|
||||
}
|
||||
|
||||
return qstrl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Element *elmt = deti->elementUseForInfo();
|
||||
if(!elmt)
|
||||
return qstrl;
|
||||
|
||||
|
||||
QStringList info_list = QETApp::elementInfoKeys();
|
||||
info_list.removeAll("formula"); //No need to have formula
|
||||
DiagramContext dc = elmt->elementInformations();
|
||||
|
||||
for(QString info : info_list)
|
||||
{
|
||||
if(dc.contains(info))
|
||||
qstrl << info;
|
||||
}
|
||||
}
|
||||
|
||||
return qstrl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user