<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to set a font from a ini file?]]></title><description><![CDATA[<p dir="auto">So? How to set a front from a ini file? Because i have some problems with the qt fonts(because the error: font database cannot find font directory - is qt installed correctly) . So i want use fonts default of system.</p>
<p dir="auto">Here what i did:<br />
[General]<br />
Fonts=QCoreApplication::applicationDirPath()/fonts/Ubuntu-R<br />
Is the folder content with the ttf font. How do i set on my qt project?</p>
<p dir="auto">Any tips?</p>
]]></description><link>https://forum.qt.io/topic/55469/how-to-set-a-font-from-a-ini-file</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 16:24:52 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/55469.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 20 Jun 2015 02:55:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to set a font from a ini file? on Sat, 20 Jun 2015 04:39:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jksh">@<bdi>JKSH</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> Well, i did this in my code in main.cpp<br />
QString fontPath = ":/Fonts/Ubuntu-R.ttf";<br />
int fontId = QFontDatabase::addApplicationFont(fontPath);<br />
if (fontId != -1)<br />
{<br />
QFont font("MyFont");<br />
app.setFont(font);<br />
}</p>
<p dir="auto">It did works, but the error appears, this time only the first line terminal (Before appeared n times). But the program normally performs. Can anyone tell me why the error (FontDatabase) persist?<br />
Ps.: I build my app with qt libraries STATIC. Exists another way to fix the font problem in the project without this way that i did?</p>
]]></description><link>https://forum.qt.io/post/278875</link><guid isPermaLink="true">https://forum.qt.io/post/278875</guid><dc:creator><![CDATA[Lays147]]></dc:creator><pubDate>Sat, 20 Jun 2015 04:39:39 GMT</pubDate></item></channel></rss>