MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / availableFonts

Method availableFonts

app/src/Console/Handler.cpp:335–352  ·  view source on GitHub ↗

* @brief Returns the list of all available monospace fonts. */

Source from the content-addressed store, hash-verified

333 * @brief Returns the list of all available monospace fonts.
334 */
335QStringList Console::Handler::availableFonts() const
336{
337 QStringList monospaceFonts;
338 const auto allFonts = QFontDatabase::families();
339 auto defaultFamily = Misc::CommonFonts::instance().monoFont().family();
340 for (const auto& family : allFonts) {
341 QFontInfo fontInfo(family);
342 if (fontInfo.fixedPitch() && !monospaceFonts.contains(family))
343 monospaceFonts.append(family);
344 }
345
346 monospaceFonts.sort(Qt::CaseInsensitive);
347 const int idx = monospaceFonts.indexOf(defaultFamily);
348 if (idx > 0)
349 monospaceFonts.move(idx, 0);
350
351 return monospaceFonts;
352}
353
354/**
355 * @brief Returns the character width for the default monospace font.

Callers

nothing calls this directly

Calls 3

containsMethod · 0.45
appendMethod · 0.45
indexOfMethod · 0.45

Tested by

no test coverage detected