Skip to content

Commit

Permalink
issue #1649: Changing names on Pads does not change them everywere
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Oct 21, 2016
1 parent c92dbb3 commit 58cb2e2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
32 changes: 24 additions & 8 deletions src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp
Expand Up @@ -122,10 +122,14 @@ void TaskMirroredParameters::setupUI()
std::vector<App::DocumentObject*> originals = pcMirrored->Originals.getValues();

// Fill data into dialog elements
for (std::vector<App::DocumentObject*>::const_iterator i = originals.begin(); i != originals.end(); ++i)
{
if ((*i) != NULL)
ui->listWidgetFeatures->addItem(QString::fromLatin1((*i)->getNameInDocument()));
for (std::vector<App::DocumentObject*>::const_iterator i = originals.begin(); i != originals.end(); ++i) {
const App::DocumentObject* obj = *i;
if (obj != NULL) {
QListWidgetItem* item = new QListWidgetItem();
item->setText(QString::fromUtf8(obj->Label.getValue()));
item->setData(Qt::UserRole, QString::fromLatin1(obj->getNameInDocument()));
ui->listWidgetFeatures->addItem(item);
}
}
// ---------------------

Expand Down Expand Up @@ -178,10 +182,22 @@ void TaskMirroredParameters::onSelectionChanged(const Gui::SelectionChanges& msg
if (msg.Type == Gui::SelectionChanges::AddSelection) {

if (originalSelected(msg)) {
if (selectionMode == addFeature)
ui->listWidgetFeatures->addItem(QString::fromLatin1(msg.pObjectName));
else
removeItemFromListWidget(ui->listWidgetFeatures, QString::fromLatin1(msg.pObjectName));
Gui::SelectionObject selObj(msg);
App::DocumentObject* obj = selObj.getObject();
Q_ASSERT(obj);

QString label = QString::fromUtf8(obj->Label.getValue());
QString objectName = QString::fromLatin1(msg.pObjectName);

if (selectionMode == addFeature) {
QListWidgetItem* item = new QListWidgetItem();
item->setText(label);
item->setData(Qt::UserRole, objectName);
ui->listWidgetFeatures->addItem(item);
}
else {
removeItemFromListWidget(ui->listWidgetFeatures, label);
}
exitSelectionMode();
} else {
if ( selectionMode == reference) {
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/PartDesign/Gui/TaskTransformedParameters.h
Expand Up @@ -64,7 +64,7 @@ class ComboLinks
* will go out of sync, and crashes may result.
*/
ComboLinks(QComboBox &combo);
ComboLinks() {_combo = 0; doc = 0;};
ComboLinks() {_combo = 0; doc = 0;}
void setCombo(QComboBox &combo) {assert(_combo == 0); this->_combo = &combo; _combo->clear();}

/**
Expand Down Expand Up @@ -97,9 +97,9 @@ class ComboLinks
*/
int setCurrentLink(const App::PropertyLinkSub &lnk);

QComboBox& combo(void) const {assert(_combo); return *_combo;};
QComboBox& combo(void) const {assert(_combo); return *_combo;}

~ComboLinks() {_combo = 0; clear();};
~ComboLinks() {_combo = 0; clear();}
private:
QComboBox* _combo;
App::Document* doc;
Expand Down

0 comments on commit 58cb2e2

Please sign in to comment.