16 #include "Base/Util/Assert.h"
18 #include <QApplication>
27 QSize FindSizeOfLetterM(
const QWidget* widget)
29 QFontMetrics fontMetric(widget->font());
30 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
31 auto em = fontMetric.horizontalAdvance(
'M');
33 auto em = fontMetric.width(
'M');
35 auto fontAscent = fontMetric.ascent();
37 return QSize(em, fontAscent);
40 QSize DefaultSizeOfLetterM()
43 return FindSizeOfLetterM(&widget);
53 tree->setAlternatingRowColors(
true);
61 result +=
"QTreeView::item {"
62 " border-bottom: 1px solid #c7c8c9; "
63 " border-right: 1px solid #c7c8c9;}"
64 "QTreeView::branch {border-bottom: 1px solid #c7c8c9;}";
67 result +=
"QTreeView::branch:has-children:!has-siblings:closed,"
68 "QTreeView::branch:closed:has-children:has-siblings {"
69 "padding:2px 2px 2px 2px;border-image: none;"
70 "image: url(:/images/caret-right.svg);}"
71 "QTreeView::branch:open:has-children:!has-siblings,"
72 "QTreeView::branch:open:has-children:has-siblings {"
73 "padding:2px 2px 2px 2px;border-image: none; image: url(:/images/caret-down.svg);"
77 result +=
"QTreeView::item:selected{background:#3daee9;}";
107 dialog->setWindowFlags(Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint
108 | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint
115 static QSize default_size = DefaultSizeOfLetterM();
116 return widget ? FindSizeOfLetterM(widget) : default_size;
121 return QApplication::font().pointSize();
Defines class DesignerHelper.
Defines GUI::StyleUtils namespace.
static int getLabelFontSize()
static int getSectionFontSize()
Returns system dependent font size.
int SystemPointSize()
Returns size in points of default system font.
QSize SizeOfLetterM(const QWidget *widget=nullptr)
Returns size of largest letter of default system font.
QFont sectionFont(bool bold=false)
Returns font for sections.
QFont labelFont(bool bold=false)
Returns font for labels.
void setPropertyStyle(QTreeView *tree)
Sets style for the tree to use in property editors.
int PropertyPanelWidth()
Returns typical width of the vertical property panel.
QString propertyTreeStyle()
Returns string representing the style of QTreeView intended for property editor.
void setResizable(QDialog *dialog)
Make modal dialog resizable.