MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / MakeQFont

Function MakeQFont

plugins/scripting/utils/properties-view.cpp:976–1007  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

974}
975
976void MakeQFont(obs_data_t *font_obj, QFont &font, bool limit = false)
977{
978 const char *face = obs_data_get_string(font_obj, "face");
979 const char *style = obs_data_get_string(font_obj, "style");
980 int size = (int)obs_data_get_int(font_obj, "size");
981 uint32_t flags = (uint32_t)obs_data_get_int(font_obj, "flags");
982
983 if (face) {
984 font.setFamily(face);
985 font.setStyleName(style);
986 }
987
988 if (size) {
989 if (limit) {
990 int max_size = font.pointSize();
991 if (max_size < 28)
992 max_size = 28;
993 if (size > max_size)
994 size = max_size;
995 }
996 font.setPointSize(size);
997 }
998
999 if (flags & OBS_FONT_BOLD)
1000 font.setBold(true);
1001 if (flags & OBS_FONT_ITALIC)
1002 font.setItalic(true);
1003 if (flags & OBS_FONT_UNDERLINE)
1004 font.setUnderline(true);
1005 if (flags & OBS_FONT_STRIKEOUT)
1006 font.setStrikeOut(true);
1007}
1008
1009void OBSPropertiesView::AddFont(obs_property_t *prop, QFormLayout *layout,
1010 QLabel *&label)

Callers 2

AddFontMethod · 0.85
FontChangedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected