mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01: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:
parent
8e0abeb1c1
commit
c67f527b0b
@ -47,7 +47,6 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFontDatabase>
|
|
||||||
#include <QLatin1String>
|
#include <QLatin1String>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
@ -577,7 +576,7 @@ int GuiMain(int argc, char* argv[])
|
|||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
|
|
||||||
BitcoinApplication app;
|
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
|
/// 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:
|
// Command-line options take precedence:
|
||||||
|
@ -493,6 +493,12 @@ bool hasEntryData(const QAbstractItemView *view, int column, int role)
|
|||||||
return !selection.at(0).data(role).toString().isEmpty();
|
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()
|
QString getDefaultDataDirectory()
|
||||||
{
|
{
|
||||||
return PathToQString(GetDefaultDataDir());
|
return PathToQString(GetDefaultDataDir());
|
||||||
|
@ -172,6 +172,11 @@ namespace GUIUtil
|
|||||||
|
|
||||||
void setClipboard(const QString& str);
|
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.
|
* Determine default data directory for operating system.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user