MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / PreferencePagePython

Method PreferencePagePython

src/Gui/WidgetFactory.cpp:274–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272using namespace Gui::Dialog;
273
274PreferencePagePython::PreferencePagePython(const Py::Object& p, QWidget* parent)
275 : PreferencePage(parent)
276 , page(p)
277{
278 Base::PyGILStateLocker lock;
279 Gui::PythonWrapper wrap;
280 if (wrap.loadCoreModule()) {
281
282 // old style class must have a form attribute while
283 // new style classes can be the widget itself
284 Py::Object widget;
285 if (page.hasAttr(std::string("form"))) {
286 widget = page.getAttr(std::string("form"));
287 }
288 else {
289 widget = page;
290 }
291
292 QObject* object = wrap.toQObject(widget);
293 if (object) {
294 QWidget* form = qobject_cast<QWidget*>(object);
295 if (form) {
296 this->setWindowTitle(form->windowTitle());
297 auto layout = new QVBoxLayout;
298 layout->addWidget(form);
299 setLayout(layout);
300 }
301 }
302 }
303}
304
305PreferencePagePython::~PreferencePagePython()
306{

Callers

nothing calls this directly

Calls 4

loadCoreModuleMethod · 0.80
toQObjectMethod · 0.80
setWindowTitleMethod · 0.45
addWidgetMethod · 0.45

Tested by

no test coverage detected