FEM: Include code quality improvements from review

This commit is contained in:
Stefan Tröger
2025-06-15 10:56:40 +02:00
parent 66f8674e63
commit 3e3e6a2c7b
4 changed files with 22 additions and 24 deletions

View File

@@ -407,16 +407,18 @@ void TaskDlgPost::modifyStandardButtons(QDialogButtonBox* box)
void TaskDlgPost::processCollapsedWidgets() {
for (auto& widget : Content) {
if(auto task_box = dynamic_cast<Gui::TaskView::TaskBox*>(widget)) {
// get the task widget and check if it is a post widget
auto widget = task_box->groupLayout()->itemAt(0)->widget();
if(auto post_widget = dynamic_cast<TaskPostWidget*>(widget)) {
if(post_widget->initiallyCollapsed()) {
post_widget->setGeometry(QRect(QPoint(0,0), post_widget->sizeHint()));
task_box->hideGroupBox();
}
}
auto* task_box = dynamic_cast<Gui::TaskView::TaskBox*>(widget);
if (!task_box) {
continue;
}
// get the task widget and check if it is a post widget
auto* taskwidget = task_box->groupLayout()->itemAt(0)->widget();
auto* post_widget = dynamic_cast<TaskPostWidget*>(taskwidget);
if (!post_widget || !post_widget->initiallyCollapsed()) {
continue;
}
post_widget->setGeometry(QRect(QPoint(0,0), post_widget->sizeHint()));
task_box->hideGroupBox();
}
}

View File

@@ -82,17 +82,13 @@ TaskPostExtraction::TaskPostExtraction(ViewProviderFemPostObject* view, QWidget*
Gui::PythonWrapper wrap;
if (wrap.loadCoreModule()) {
QObject* object = wrap.toQObject(pywidget);
if (object) {
QWidget* widget = qobject_cast<QWidget*>(object);
if (widget) {
// finally we have the usable QWidget. Add to us!
if (auto* widget = qobject_cast<QWidget*>(wrap.toQObject(pywidget))) {
// finally we have the usable QWidget. Add to us!
auto layout = new QVBoxLayout();
layout->addWidget(widget);
setLayout(layout);
return;
}
auto layout = new QVBoxLayout();
layout->addWidget(widget);
setLayout(layout);
return;
}
}
}

View File

@@ -1023,12 +1023,12 @@ bool ViewProviderFemPostObject::setEdit(int ModNum)
void ViewProviderFemPostObject::setupTaskDialog(TaskDlgPost* dlg)
{
assert(dlg->getView() == this);
auto disp_panel = new TaskPostDisplay(this);
dlg->addTaskBox(disp_panel->windowIcon().pixmap(32), disp_panel);
auto dispPanel = new TaskPostDisplay(this);
dlg->addTaskBox(dispPanel->windowIcon().pixmap(32), dispPanel);
#ifdef FC_USE_VTK_PYTHON
auto extr_panel = new TaskPostExtraction(this);
dlg->addTaskBox(extr_panel->windowIcon().pixmap(32), extr_panel);
auto extrPanel = new TaskPostExtraction(this);
dlg->addTaskBox(extrPanel->windowIcon().pixmap(32), extrPanel);
#endif
}

View File

@@ -379,7 +379,7 @@ class CommandManager:
# like add_obj_on_gui_selobj_noset_edit but the selection is kept
# and the selobj is expanded in the tree to see the added obj
# check if we should use python fitler
# check if we should use python filter
from femguiutils.vtk_module_handling import vtk_compatibility_abort
if vtk_compatibility_abort(True):
return