#3325: DlgPropertyLink as editor of Tip property

This commit is contained in:
wmayer
2018-01-28 22:37:03 +01:00
parent 5d1fb6937e
commit f9b04b1551
4 changed files with 53 additions and 6 deletions

View File

@@ -48,7 +48,7 @@ DlgPropertyLink::DlgPropertyLink(const QStringList& list, QWidget* parent, Qt::W
: QDialog(parent, fl), link(list), ui(new Ui_DlgPropertyLink)
{
#ifdef FC_DEBUG
assert(list.size() == 4);
assert(list.size() >= 5);
#endif
ui->setupUi(this);
findObjects(ui->checkObjectType->isChecked(), QString());
@@ -125,6 +125,7 @@ void DlgPropertyLink::findObjects(bool on, const QString& searchText)
QString docName = link[0]; // document name
QString objName = link[1]; // internal object name
QString parName = link[3]; // internal object name of the parent of the link property
QString proName = link[4]; // property name
bool isSingleSelection = (ui->listWidget->selectionMode() == QAbstractItemView::SingleSelection);
App::Document* doc = App::GetApplication().getDocument((const char*)docName.toLatin1());
@@ -155,8 +156,10 @@ void DlgPropertyLink::findObjects(bool on, const QString& searchText)
App::DocumentObject* par = doc->getObject((const char*)parName.toLatin1());
if (par) {
// for multi-selection we need all objects
if (isSingleSelection)
outList = par->getOutList();
if (isSingleSelection) {
App::Property* prop = par->getPropertyByName((const char*)proName.toLatin1());
outList = par->getOutListOfProperty(prop);
}
outList.push_back(par);
}

View File

@@ -3493,7 +3493,8 @@ QVariant PropertyLinkItem::value(const App::Property* prop) const
const App::PropertyLink* prop_link = static_cast<const App::PropertyLink*>(prop);
App::PropertyContainer* c = prop_link->getContainer();
// the list has four elements: [document name, internal name, label, internal name of container]
// the list has five elements:
// [document name, internal name, label, internal name of container, property name]
App::DocumentObject* obj = prop_link->getValue();
QStringList list;
if (obj) {
@@ -3527,6 +3528,8 @@ QVariant PropertyLinkItem::value(const App::Property* prop) const
list << QString::fromLatin1("Null");
}
list << QString::fromLatin1(prop->getName());
return QVariant(list);
}
@@ -3675,7 +3678,8 @@ QVariant PropertyLinkListItem::value(const App::Property* prop) const
objName = QString::fromLatin1("Null");
}
// each item is a list of four elements: [document name, internal name, label, internal name of container]
// each item is a list of five elements:
//[document name, internal name, label, internal name of container, property name]
// the variant list contains at least one item
std::vector<App::DocumentObject*> obj = prop_link->getValues();
QVariantList varList;
@@ -3686,6 +3690,7 @@ QVariant PropertyLinkListItem::value(const App::Property* prop) const
list << QString::fromLatin1((*it)->getNameInDocument());
list << QString::fromUtf8((*it)->Label.getValue());
list << objName;
list << QString::fromLatin1(prop->getName());
varList << list;
}
}
@@ -3706,6 +3711,7 @@ QVariant PropertyLinkListItem::value(const App::Property* prop) const
// the object label
list << QString::fromLatin1("");
list << objName;
list << QString::fromLatin1(prop->getName());
varList << list;
}