mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
qt: Add helper to load font
This commit is contained in:
parent
c0b6c96eee
commit
d54ec27bac
3 changed files with 12 additions and 2 deletions
|
@ -46,7 +46,6 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFontDatabase>
|
|
||||||
#include <QLatin1String>
|
#include <QLatin1String>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
|
@ -492,7 +491,7 @@ int GuiMain(int argc, char* argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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:
|
||||||
|
|
|
@ -272,6 +272,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 boostPathToQString(GetDefaultDataDir());
|
return boostPathToQString(GetDefaultDataDir());
|
||||||
|
|
|
@ -113,6 +113,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…
Add table
Reference in a new issue