Comments (10)
The font files should be bundled with the library as resources.
See components/resources.qrc
:
<RCC>
<qresource prefix="/fonts">
<file>../fonts/Roboto/Roboto-Black.ttf</file>
<file>../fonts/Roboto/Roboto-Bold.ttf</file>
<file>../fonts/Roboto/Roboto-Medium.ttf</file>
<file>../fonts/Roboto/Roboto-Regular.ttf</file>
<file>../fonts/Roboto/Roboto-Light.ttf</file>
<file>../fonts/Roboto/Roboto-Thin.ttf</file>
</qresource>
...
These are then loaded by the style class (QtMaterialStyle). See qtmaterialstyle.cpp
, line 23:
QFontDatabase::addApplicationFont(":/material/fonts/Roboto/Roboto-Regular.ttf");
QFontDatabase::addApplicationFont(":/material/fonts/Roboto/Roboto-Medium.ttf");
QFontDatabase::addApplicationFont(":/material/fonts/Roboto/Roboto-Bold.ttf");
from qt-material-widgets.
I don't have the font installed on my system, no.
from qt-material-widgets.
I used the unix switch for grep on a windows workstation... no dir recursion... sorry about this.
This evening I will try on my home notebook, and will try this code snippet to see what happens with the fonts:
https://bugreports.qt.io/browse/QTBUG-61520
I still think that setPointSize call should not be necessary it the correct font is returned from the FontDatabase.
from qt-material-widgets.
I confirm there is a problem with the font loading.
Which one is Roboto?
I think the problem is in the resource file... I'm not even sure you are using roboto font due to a mismatch in the path name...
QFontDatabase::addApplicationFont(":/material/fonts/Roboto/Roboto-Regular.ttf");
See the changes in the respource file:
fperillo@1bfb999
and where I add the fonts using the aliases
from qt-material-widgets.
What if you put the fonts in the same directory as the icons? I mean, just copy the whole fonts directory into components/
and then change the path in the resource file from ../fonts/Roboto
to fonts/Roboto
.
from qt-material-widgets.
The resource path is not a one-to-one mapping to the file system path, because of how the resource system works in Qt. See http://doc.qt.io/qt-5/resources.html. (The IDE complains if I try to use an incorrect resource path.)
from qt-material-widgets.
I'll try on a different machine also when I get the chance, to see if I can figure out what the problem is.
from qt-material-widgets.
An alias should be used in the resource file, in this way:
../fonts/Roboto/Roboto-Medium.ttf
then load in this way:
QFontDatabase::addApplicationFont( ":/fonts/rmedium" );
This is an official way to load resources via aliases.
I then created font via:
QFont font("Roboto", 14, iFontWeight )
where f.e.
iFontWeight = QFont::Bold
from qt-material-widgets.
Ok, I think I understand now. Does 2ee5d6d work or?
from qt-material-widgets.
It works now :-)
Thank you
from qt-material-widgets.
Related Issues (20)
- Add example of using different theme HOT 1
- About ListItem object HOT 1
- Checkable behavior is no longer working on Flat Button
- QtMaterialDialog: overlay gets wrong size and position
- QtMaterialDialog: dialog is invisible without calling QWidget::show()
- Headers and subheaders
- Error Compile in VS2013 Compiler
- Dropdown button (ComboBox)
- Examples don't link on windows with visual studio 2015 toolset
- The effects and shadows are CPU expensive. HOT 5
- idea of switch to CMake build system
- is this project dead? HOT 11
- Plz help
- Questions about deployment
- Anyone know, is there a port of this for PySide? HOT 1
- Python code for the widget in this repo. HOT 6
- The font size in theme HOT 1
- pip install <insert-package-name-here?>
- call ! call ! call !MAC + QT6.2.3 + QtCreator is compile false...... HOT 2
- the control of qt-material-widgets can't be self-adaption
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qt-material-widgets.