mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-21 22:15:59 +02:00
Merge bitcoin-core/gui#448: Add helper to load font
d54ec27bac388d7b84cf7b6cb4506bb0c25f2f88 qt: Add helper to load font (João Barbosa) Pull request description: Originally submitted as https://github.com/bitcoin-core/gui-qml/pull/49. ACKs for top commit: hebasto: re-ACK d54ec27bac388d7b84cf7b6cb4506bb0c25f2f88 stratospher: Tested ACK d54ec27. Refactoring the code and defining `loadFont()` in `src/qt/guiutil.cpp` reduces redundant imports of the `QFontDatabase` and is a better design. shaavan: ACK d54ec27bac388d7b84cf7b6cb4506bb0c25f2f88 Tree-SHA512: b156bb6ffb08dd57476f383a29bbb0a1108b62794d430debb77252f7d09df1409a7532b09d17d8836d1c2ab7c126a6618231164b9d0def1b8f361a81ef22d107
This commit is contained in:
commit
15587b4f1d
@ -46,7 +46,6 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QFontDatabase>
|
||||
#include <QLatin1String>
|
||||
#include <QLibraryInfo>
|
||||
#include <QLocale>
|
||||
@ -492,7 +491,7 @@ int GuiMain(int argc, char* argv[])
|
||||
#endif
|
||||
|
||||
BitcoinApplication app;
|
||||
QFontDatabase::addApplicationFont(":/fonts/monospace");
|
||||
GUIUtil::LoadFont(QStringLiteral(":/fonts/monospace"));
|
||||
|
||||
/// 2. Parse command-line options. We do this after qt in order to show an error if there are problems parsing these
|
||||
// Command-line options take precedence:
|
||||
|
@ -272,6 +272,12 @@ bool hasEntryData(const QAbstractItemView *view, int column, int role)
|
||||
return !selection.at(0).data(role).toString().isEmpty();
|
||||
}
|
||||
|
||||
void LoadFont(const QString& file_name)
|
||||
{
|
||||
const int id = QFontDatabase::addApplicationFont(file_name);
|
||||
assert(id != -1);
|
||||
}
|
||||
|
||||
QString getDefaultDataDirectory()
|
||||
{
|
||||
return boostPathToQString(GetDefaultDataDir());
|
||||
|
@ -113,6 +113,11 @@ namespace GUIUtil
|
||||
|
||||
void setClipboard(const QString& str);
|
||||
|
||||
/**
|
||||
* Loads the font from the file specified by file_name, aborts if it fails.
|
||||
*/
|
||||
void LoadFont(const QString& file_name);
|
||||
|
||||
/**
|
||||
* Determine default data directory for operating system.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user