Made global font setting at app start.

This commit is contained in:
Andrew Lalis 2018-03-31 22:45:19 +02:00
parent 4b51029d70
commit d7653465e9
7 changed files with 118 additions and 28 deletions

View File

@ -19,6 +19,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Noto Sans</family>
</font>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
@ -32,7 +37,13 @@
<property name="windowOpacity">
<double>1.000000000000000</double>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QWidget" name="mainWidget">
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
@ -111,6 +122,11 @@
<height>80</height>
</size>
</property>
<property name="font">
<font>
<pointsize>20</pointsize>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
@ -148,6 +164,11 @@ QPushButton#newButton:pressed{
<height>80</height>
</size>
</property>
<property name="font">
<font>
<pointsize>20</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton#openButton {
background-color: rgb(222, 226, 255);
@ -176,6 +197,11 @@ QPushButton#openButton:pressed{
<height>80</height>
</size>
</property>
<property name="font">
<font>
<pointsize>20</pointsize>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
@ -213,6 +239,11 @@ QPushButton#editButton:pressed{
<height>80</height>
</size>
</property>
<property name="font">
<font>
<pointsize>20</pointsize>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
@ -317,11 +348,7 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
</property>
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>30</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
@ -344,6 +371,11 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>20</pointsize>
</font>
</property>
<property name="text">
<string>By Unknown Author</string>
</property>
@ -405,6 +437,11 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
</property>
<item>
<widget class="QLabel" name="prepTimeLabel">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>Prep Time:</string>
</property>
@ -418,6 +455,11 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
<property name="enabled">
<bool>true</bool>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>Cook Time:</string>
</property>
@ -428,6 +470,11 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
</item>
<item>
<widget class="QLabel" name="servingsLabel">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>Servings:</string>
</property>
@ -507,6 +554,11 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(194, 196, 233);</string>
</property>
@ -526,6 +578,11 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(232, 232, 232);</string>
</property>
@ -605,6 +662,11 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(218, 219, 234);</string>
</property>
@ -618,6 +680,11 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
</item>
<item>
<widget class="QTextEdit" name="instructionsTextEdit">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(244, 244, 244);</string>
</property>
@ -649,7 +716,7 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Liberation Serif Bold'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Liberation Serif Bold'; font-size:12pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; color:#00ff40;&quot;&gt;This is some &lt;/span&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:16pt; color:#a33c3e;&quot;&gt;colored text and &lt;/span&gt;&lt;a href=&quot;https://www.google.com&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;link&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textInteractionFlags">
@ -771,6 +838,11 @@ p, li { white-space: pre-wrap; }
</property>
<item>
<widget class="QLabel" name="tagsLabel">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>Tags</string>
</property>

View File

@ -22,12 +22,14 @@
<iconset resource="../../res.qrc">
<normaloff>:/images/images/icon.png</normaloff>:/images/images/icon.png</iconset>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>12</pointsize>
</font>
</property>
@ -43,7 +45,6 @@
<widget class="QLineEdit" name="lineEdit">
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>12</pointsize>
</font>
</property>

View File

@ -18,7 +18,7 @@
<normaloff>:/images/images/icon.png</normaloff>:/images/images/icon.png</iconset>
</property>
<property name="styleSheet">
<string notr="true">font: 25 &quot;Noto Sans CJK KR Light&quot;;</string>
<string notr="true"/>
</property>
<property name="modal">
<bool>true</bool>
@ -31,7 +31,8 @@
<widget class="QLabel" name="tagLabel">
<property name="font">
<font>
<weight>3</weight>
<pointsize>13</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -48,7 +49,8 @@
<widget class="QLineEdit" name="tagEdit">
<property name="font">
<font>
<weight>3</weight>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>

View File

@ -18,7 +18,7 @@
<normaloff>:/images/images/icon.png</normaloff>:/images/images/icon.png</iconset>
</property>
<property name="styleSheet">
<string notr="true">font: 25 &quot;Noto Sans CJK KR Light&quot;;</string>
<string notr="true"/>
</property>
<property name="modal">
<bool>true</bool>
@ -31,7 +31,8 @@
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>3</weight>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -51,7 +52,8 @@
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>3</weight>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -71,7 +73,8 @@
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>3</weight>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -112,7 +115,8 @@
</property>
<property name="font">
<font>
<weight>3</weight>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -142,7 +146,8 @@
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<weight>3</weight>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>

View File

@ -27,7 +27,7 @@
<normaloff>:/images/images/icon.png</normaloff>:/images/images/icon.png</iconset>
</property>
<property name="styleSheet">
<string notr="true">font: 25 &quot;Noto Sans CJK KR&quot;;</string>
<string notr="true"/>
</property>
<property name="modal">
<bool>true</bool>
@ -103,7 +103,8 @@
<widget class="QLineEdit" name="recipeNameEdit">
<property name="font">
<font>
<weight>3</weight>
<pointsize>14</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -126,7 +127,8 @@
<widget class="QLineEdit" name="authorNameEdit">
<property name="font">
<font>
<weight>3</weight>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -626,7 +628,7 @@ QPushButton#deleteTagButton:pressed{
<widget class="QLabel" name="amountLabel">
<property name="font">
<font>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -898,7 +900,7 @@ QPushButton#removeIngredientButton:pressed{
<widget class="QToolButton" name="italicsButton">
<property name="font">
<font>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -918,7 +920,7 @@ QPushButton#removeIngredientButton:pressed{
<widget class="QToolButton" name="boldButton">
<property name="font">
<font>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>

View File

@ -18,7 +18,7 @@
<normaloff>:/images/images/icon.png</normaloff>:/images/images/icon.png</iconset>
</property>
<property name="styleSheet">
<string notr="true">font: 25 &quot;Noto Sans CJK KR Light&quot;;</string>
<string notr="true"/>
</property>
<property name="modal">
<bool>true</bool>
@ -63,7 +63,7 @@
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>1</number>
<number>2</number>
</property>
<widget class="QWidget" name="Tags">
<attribute name="icon">
@ -237,7 +237,8 @@
<widget class="QLineEdit" name="nameEdit">
<property name="font">
<font>
<weight>3</weight>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -369,7 +370,8 @@ QPushButton#exitButton:pressed{
<widget class="QTableView" name="recipeTableView">
<property name="font">
<font>
<weight>3</weight>
<pointsize>14</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>

View File

@ -41,9 +41,11 @@ Recipe checkForFirstRun(RecipeDatabase *recipeDB){
}
void loadAndSetFonts(){
int id = QFontDatabase::addApplicationFont(":/fonts/NotoSans-Light.ttf");
int id = QFontDatabase::addApplicationFont(":/fonts/fonts/NotoSans-Light.ttf");
if (id == -1){
return;
}
QString family = QFontDatabase::applicationFontFamilies(id).at(0);
printf("%s\n", family.toStdString().c_str());
}
int main(int argc, char *argv[])
@ -53,6 +55,10 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
loadAndSetFonts();
QFont notoFont("Noto Sans");
notoFont.setStyleHint(QFont::SansSerif);
notoFont.setWeight(QFont::Thin);
a.setFont(notoFont);
MainWindow w(&recipeDB);
w.loadFromRecipe(checkForFirstRun(&recipeDB));