GUI: Re-add button to object selection
The button was inadvertently lost in a recent PR. This commit adds it back.
This commit is contained in:
@@ -141,6 +141,15 @@ void DlgObjectSelection::init(const std::vector<App::DocumentObject*> &objs,
|
||||
}
|
||||
onItemSelectionChanged();
|
||||
|
||||
/**
|
||||
* create useOriginalsBtn and add to the button box
|
||||
* tried adding to .ui file, but could never get the
|
||||
* formatting exactly the way I wanted it. -- <TheMarkster>
|
||||
*/
|
||||
useOriginalsBtn = new QPushButton(tr("&Use Original Selections"));
|
||||
useOriginalsBtn->setToolTip(tr("Ignore dependencies and proceed with objects\noriginally selected prior to opening this dialog"));
|
||||
ui->buttonBox->addButton(useOriginalsBtn, QDialogButtonBox::ResetRole);
|
||||
|
||||
connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
|
||||
this, SLOT(onObjItemChanged(QTreeWidgetItem*,int)));
|
||||
connect(ui->depList, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
|
||||
@@ -149,6 +158,8 @@ void DlgObjectSelection::init(const std::vector<App::DocumentObject*> &objs,
|
||||
this, SLOT(onDepItemChanged(QTreeWidgetItem*,int)));
|
||||
connect(ui->treeWidget, SIGNAL(itemSelectionChanged()),
|
||||
this, SLOT(onItemSelectionChanged()));
|
||||
connect(useOriginalsBtn, SIGNAL(clicked()),
|
||||
this, SLOT(onUseOriginalsBtnClicked()));
|
||||
|
||||
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
@@ -321,6 +332,10 @@ void DlgObjectSelection::setItemState(App::DocumentObject *obj,
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> DlgObjectSelection::getSelections(SelectionOptions options) const {
|
||||
|
||||
if (returnOriginals)
|
||||
return initSels;
|
||||
|
||||
std::vector<App::DocumentObject*> res;
|
||||
Base::Flags<SelectionOptions> flags(options);
|
||||
if (!flags.testFlag(SelectionOptions::Invert)) {
|
||||
@@ -592,6 +607,11 @@ void DlgObjectSelection::onItemSelectionChanged() {
|
||||
ui->inList->setSortingEnabled(true);
|
||||
}
|
||||
|
||||
void DlgObjectSelection::onUseOriginalsBtnClicked() {
|
||||
returnOriginals = true;
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void DlgObjectSelection::accept() {
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user