BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
qdesigner_internal::Utils Namespace Reference

Functions

bool isCentralWidget (QDesignerFormWindowInterface *fw, QWidget *widget)
 
bool isObjectAncestorOf (QObject *ancestor, QObject *child)
 
int valueOf (const QVariant &value, bool *ok=0)
 

Function Documentation

◆ isCentralWidget()

bool qdesigner_internal::Utils::isCentralWidget ( QDesignerFormWindowInterface *  fw,
QWidget *  widget 
)
inline

Definition at line 478 of file qdesigner_utils_p.h.

479 {
480  if (!fw || !widget)
481  return false;
482 
483  if (widget == fw->mainContainer())
484  return true;
485 
486  // ### generalize for other containers
487  if (QMainWindow* mw = qobject_cast<QMainWindow*>(fw->mainContainer())) {
488  return mw->centralWidget() == widget;
489  }
490 
491  return false;
492 }

◆ isObjectAncestorOf()

bool qdesigner_internal::Utils::isObjectAncestorOf ( QObject *  ancestor,
QObject *  child 
)
inline

Definition at line 467 of file qdesigner_utils_p.h.

468 {
469  QObject* obj = child;
470  while (obj != 0) {
471  if (obj == ancestor)
472  return true;
473  obj = obj->parent();
474  }
475  return false;
476 }
const SessionItem * ancestor(const SessionItem *item, const QString &requiredModelType)
Returns ancestor of given modelType for given item.
Definition: ModelPath.cpp:87

References ModelPath::ancestor().

Here is the call graph for this function:

◆ valueOf()

int qdesigner_internal::Utils::valueOf ( const QVariant &  value,
bool *  ok = 0 
)
inline

Definition at line 453 of file qdesigner_utils_p.h.

454 {
455  if (value.canConvert<PropertySheetEnumValue>()) {
456  if (ok)
457  *ok = true;
458  return qvariant_cast<PropertySheetEnumValue>(value).value;
459  } else if (value.canConvert<PropertySheetFlagValue>()) {
460  if (ok)
461  *ok = true;
462  return qvariant_cast<PropertySheetFlagValue>(value).value;
463  }
464  return value.toInt(ok);
465 }