Fem: added signals and slots to notify when first function is added
This commit is contained in:
@@ -236,6 +236,27 @@ QDialogButtonBox::StandardButtons TaskDlgPost::getStandardButtons(void) const {
|
||||
return QDialogButtonBox::Ok;
|
||||
}
|
||||
|
||||
void TaskDlgPost::connectSlots()
|
||||
{
|
||||
// Connect emitAddedFunction() with slotAddedFunction()
|
||||
QObject* sender = nullptr;
|
||||
for (const auto dlg : m_boxes) {
|
||||
int indexSignal = dlg->metaObject()->indexOfSignal(QMetaObject::normalizedSignature("emitAddedFunction()"));
|
||||
if (indexSignal >= 0) {
|
||||
sender = dlg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (sender) {
|
||||
for (const auto dlg : m_boxes) {
|
||||
int indexSlot = dlg->metaObject()->indexOfSlot(QMetaObject::normalizedSignature("slotAddedFunction()"));
|
||||
if (indexSlot >= 0) {
|
||||
connect(sender, SIGNAL(emitAddedFunction()), dlg, SLOT(slotAddedFunction()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TaskDlgPost::appendBox(TaskPostBox* box) {
|
||||
|
||||
@@ -374,6 +395,11 @@ TaskPostDisplay::~TaskPostDisplay()
|
||||
{
|
||||
}
|
||||
|
||||
void TaskPostDisplay::slotAddedFunction()
|
||||
{
|
||||
updateEnumerationList(getTypedView<ViewProviderFemPostObject>()->Field, ui->Field);
|
||||
}
|
||||
|
||||
void TaskPostDisplay::on_Representation_activated(int i) {
|
||||
|
||||
getTypedView<ViewProviderFemPostObject>()->DisplayMode.setValue(i);
|
||||
@@ -501,18 +527,19 @@ void TaskPostClip::collectImplicitFunctions() {
|
||||
|
||||
void TaskPostClip::on_CreateButton_triggered(QAction*) {
|
||||
|
||||
int numFuncs = ui->FunctionBox->count();
|
||||
int currentItem = ui->FunctionBox->currentIndex();
|
||||
collectImplicitFunctions();
|
||||
|
||||
// if a new function was successfuly added use it
|
||||
int indexCount = ui->FunctionBox->count();
|
||||
if (indexCount > currentItem + 1)
|
||||
ui->FunctionBox->setCurrentIndex(ui->FunctionBox->count() - 1);
|
||||
ui->FunctionBox->setCurrentIndex(indexCount - 1);
|
||||
|
||||
// FIXME: when the first function ever was added, a signal must be emit
|
||||
// that is received by TaskPostDisplay to trigger
|
||||
// updateEnumerationList(getTypedView<ViewProviderFemPostObject>()->Field, ui->Field);
|
||||
// at it is the Field combo keeps empty and the user must reopen the task dialog to get
|
||||
// it filled
|
||||
// When the first function ever was added, a signal must be emitted
|
||||
if (numFuncs == 0) {
|
||||
Q_EMIT emitAddedFunction();
|
||||
}
|
||||
|
||||
recompute();
|
||||
}
|
||||
@@ -1451,18 +1478,19 @@ void TaskPostCut::collectImplicitFunctions() {
|
||||
|
||||
void TaskPostCut::on_CreateButton_triggered(QAction*) {
|
||||
|
||||
int numFuncs = ui->FunctionBox->count();
|
||||
int currentItem = ui->FunctionBox->currentIndex();
|
||||
collectImplicitFunctions();
|
||||
|
||||
// if a new function was successfuly added use it
|
||||
int indexCount = ui->FunctionBox->count();
|
||||
if (indexCount > currentItem + 1)
|
||||
ui->FunctionBox->setCurrentIndex(ui->FunctionBox->count() - 1);
|
||||
ui->FunctionBox->setCurrentIndex(indexCount - 1);
|
||||
|
||||
// FIXME: when the first function ever was added, a signal must be emit
|
||||
// that is received by TaskPostDisplay to trigger
|
||||
// updateEnumerationList(getTypedView<ViewProviderFemPostObject>()->Field, ui->Field);
|
||||
// at it is the Field combo keeps empty and the user must reopen the task dialog to get
|
||||
// it filled
|
||||
// When the first function ever was added, a signal must be emitted
|
||||
if (numFuncs == 0) {
|
||||
Q_EMIT emitAddedFunction();
|
||||
}
|
||||
|
||||
recompute();
|
||||
}
|
||||
|
||||
@@ -181,6 +181,7 @@ class TaskDlgPost : public Gui::TaskView::TaskDialog
|
||||
public:
|
||||
TaskDlgPost(Gui::ViewProviderDocumentObject *view);
|
||||
~TaskDlgPost();
|
||||
void connectSlots();
|
||||
|
||||
void appendBox(TaskPostBox* box);
|
||||
Gui::ViewProviderDocumentObject* getView() const {
|
||||
@@ -229,6 +230,7 @@ private Q_SLOTS:
|
||||
void on_Field_activated(int i);
|
||||
void on_VectorMode_activated(int i);
|
||||
void on_Transparency_valueChanged(int i);
|
||||
void slotAddedFunction();
|
||||
|
||||
private:
|
||||
QWidget* proxy;
|
||||
@@ -264,6 +266,9 @@ private Q_SLOTS:
|
||||
void on_InsideOut_toggled(bool val);
|
||||
void on_CutCells_toggled(bool val);
|
||||
|
||||
Q_SIGNALS:
|
||||
void emitAddedFunction();
|
||||
|
||||
private:
|
||||
void collectImplicitFunctions();
|
||||
|
||||
@@ -393,6 +398,9 @@ private Q_SLOTS:
|
||||
void on_CreateButton_triggered(QAction*);
|
||||
void on_FunctionBox_currentIndexChanged(int idx);
|
||||
|
||||
Q_SIGNALS:
|
||||
void emitAddedFunction();
|
||||
|
||||
private:
|
||||
void collectImplicitFunctions();
|
||||
|
||||
|
||||
@@ -626,6 +626,7 @@ bool ViewProviderFemPostObject::setEdit(int ModNum) {
|
||||
else {
|
||||
postDlg = new TaskDlgPost(this);
|
||||
setupTaskDialog(postDlg);
|
||||
postDlg->connectSlots();
|
||||
Gui::Control().showDialog(postDlg);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user