BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
StyleUtils Namespace Reference

Functions

QWidget * createDetailsWidget (QLayout *content, const QString &name, bool expanded=true)
 Creates details widget holding user layout inside. More...
 
QWidget * createDetailsWidget (QWidget *content, const QString &name, bool expanded=true)
 Creates details widget holding user content inside. More...
 
QFont labelFont (bool bold=false)
 Returns font for labels. More...
 
int PropertyPanelWidth ()
 Returns typical width of the vertical property panel. More...
 
QString propertyTreeStyle ()
 Returns string representing the style of QTreeView intended for property editor. More...
 
QFont sectionFont (bool bold=false)
 Returns font for sections. More...
 
void setPropertyStyle (QTreeView *tree)
 Sets style for the tree to use in property editors. More...
 
void setResizable (QDialog *dialog)
 Make modal dialog resizable. More...
 
QSize SizeOfLetterM (const QWidget *widget=nullptr)
 Returns size of largest letter of default system font. More...
 
int SystemPointSize ()
 Returns size in points of default system font. More...
 

Function Documentation

◆ createDetailsWidget() [1/2]

QWidget * StyleUtils::createDetailsWidget ( QLayout *  content,
const QString &  name,
bool  expanded = true 
)

Creates details widget holding user layout inside.

Definition at line 103 of file StyleUtils.cpp.

104 {
105  auto placeholder = new QWidget();
106  placeholder->setLayout(layout);
107  return createDetailsWidget(placeholder, name, expanded);
108 }
QString const & name(EShape k)
Definition: particles.cpp:21
QWidget * createDetailsWidget(QWidget *content, const QString &name, bool expanded=true)
Creates details widget holding user content inside.
Definition: StyleUtils.cpp:96

References createDetailsWidget(), and RealSpace::Particles::name().

Here is the call graph for this function:

◆ createDetailsWidget() [2/2]

QWidget * StyleUtils::createDetailsWidget ( QWidget *  content,
const QString &  name,
bool  expanded = true 
)

Creates details widget holding user content inside.

Definition at line 96 of file StyleUtils.cpp.

97 {
98  auto result = createEmptyDetailsWidget(name, expanded);
99  result->setWidget(content);
100  return result;
101 }

References RealSpace::Particles::name().

Referenced by DepthProbeInstrumentEditor::DepthProbeInstrumentEditor(), GISASInstrumentEditor::GISASInstrumentEditor(), OffSpecularInstrumentEditor::OffSpecularInstrumentEditor(), SpecularInstrumentEditor::SpecularInstrumentEditor(), and createDetailsWidget().

Here is the call graph for this function:

◆ labelFont()

QFont StyleUtils::labelFont ( bool  bold = false)

Returns font for labels.

Definition at line 78 of file StyleUtils.cpp.

79 {
80  QFont result;
81  result.setPointSize(DesignerHelper::getLabelFontSize());
82  result.setBold(bold);
83 
84  return result;
85 }
static int getLabelFontSize()

References DesignerHelper::getLabelFontSize().

Referenced by WelcomeView::generateRecentProjectList().

Here is the call graph for this function:

◆ PropertyPanelWidth()

int StyleUtils::PropertyPanelWidth ( )

Returns typical width of the vertical property panel.

Definition at line 121 of file StyleUtils.cpp.

122 {
123  return SizeOfLetterM().width() * 16;
124 }
QSize SizeOfLetterM(const QWidget *widget=nullptr)
Returns size of largest letter of default system font.
Definition: StyleUtils.cpp:110

References SizeOfLetterM().

Referenced by IntensityDataPropertyWidget::minimumSizeHint(), JobListWidget::minimumSizeHint(), JobPropertiesWidget::minimumSizeHint(), JobSelectorWidget::minimumSizeHint(), IntensityDataPropertyWidget::sizeHint(), JobListWidget::sizeHint(), JobPropertiesWidget::sizeHint(), and JobSelectorWidget::sizeHint().

Here is the call graph for this function:

◆ propertyTreeStyle()

QString StyleUtils::propertyTreeStyle ( )

Returns string representing the style of QTreeView intended for property editor.

Definition at line 43 of file StyleUtils.cpp.

44 {
45  QString result;
46 
47  // lines arount cell content
48  result += "QTreeView::item {"
49  " border-bottom: 1px solid #c7c8c9; "
50  " border-right: 1px solid #c7c8c9;}"
51  "QTreeView::branch {border-bottom: 1px solid #c7c8c9;}";
52 
53  // styling of branch to restore open/closed signs eliminated by previous styling
54  result += "QTreeView::branch:has-children:!has-siblings:closed,"
55  "QTreeView::branch:closed:has-children:has-siblings {"
56  "padding:2px 2px 2px 2px;border-image: none;"
57  "image: url(:/images/caret-right.svg);}"
58  "QTreeView::branch:open:has-children:!has-siblings,"
59  "QTreeView::branch:open:has-children:has-siblings {"
60  "padding:2px 2px 2px 2px;border-image: none; image: url(:/images/caret-down.svg);"
61  "}";
62 
63  // background of selected rows restored
64  result += "QTreeView::item:selected{background:#3daee9;}";
65 
66  return result;
67 }

Referenced by setPropertyStyle().

◆ sectionFont()

QFont StyleUtils::sectionFont ( bool  bold = false)

Returns font for sections.

Definition at line 69 of file StyleUtils.cpp.

70 {
71  QFont result;
72  result.setPointSize(DesignerHelper::getSectionFontSize());
73  result.setBold(bold);
74 
75  return result;
76 }
static int getSectionFontSize()

References DesignerHelper::getSectionFontSize().

Referenced by WelcomeView::createCurrentProjectLayout(), and WelcomeView::generateRecentProjectList().

Here is the call graph for this function:

◆ setPropertyStyle()

void StyleUtils::setPropertyStyle ( QTreeView *  tree)

Sets style for the tree to use in property editors.

Definition at line 36 of file StyleUtils.cpp.

37 {
38  ASSERT(tree);
39  tree->setStyleSheet(StyleUtils::propertyTreeStyle());
40  tree->setAlternatingRowColors(true);
41 }
#define ASSERT(condition)
Definition: Assert.h:31
QString propertyTreeStyle()
Returns string representing the style of QTreeView intended for property editor.
Definition: StyleUtils.cpp:43

References ASSERT, and propertyTreeStyle().

Referenced by ComponentTreeView::ComponentTreeView(), ModelTreeView::ModelTreeView(), and TestComponentView::TestComponentView().

Here is the call graph for this function:

◆ setResizable()

void StyleUtils::setResizable ( QDialog *  dialog)

Make modal dialog resizable.

Definition at line 87 of file StyleUtils.cpp.

88 {
90  dialog->setWindowFlags(Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint
91  | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint
92  | Qt::Window);
93  }
94 }
static bool isMacHost()
Definition: hostosinfo.h:69

References GUI_OS_Utils::HostOsInfo::isMacHost().

Referenced by DataSelector::DataSelector(), DistributionDialog::DistributionDialog(), MaterialEditorDialog::MaterialEditorDialog(), and PythonScriptWidget::PythonScriptWidget().

Here is the call graph for this function:

◆ SizeOfLetterM()

◆ SystemPointSize()

int StyleUtils::SystemPointSize ( )