From 7bbaf026f3d5ded6b039545bc0d2ae5649e2e574 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Thu, 18 Jun 2015 13:33:37 -0700 Subject: [PATCH] use a monospace font on all platforms --- interface/resources/qml/Stats.qml | 4 ++-- interface/src/ui/Stats.cpp | 3 +++ interface/src/ui/Stats.h | 7 ++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/Stats.qml b/interface/resources/qml/Stats.qml index c77ab8ec27..e52c07dda3 100644 --- a/interface/resources/qml/Stats.qml +++ b/interface/resources/qml/Stats.qml @@ -239,8 +239,8 @@ Hifi.Stats { x: 4; y: 4 id: perfText color: root.fontColor - font.family: "Lucida Console" - text: "-------------------------------------------------------- Function " + + font.family: root.monospaceFont + text: "-------------------------------------------------------- Function " + "------------------------------------------------------- --msecs- -calls--\n" + root.timingStats; } diff --git a/interface/src/ui/Stats.cpp b/interface/src/ui/Stats.cpp index f541357486..c1d77b5fc2 100644 --- a/interface/src/ui/Stats.cpp +++ b/interface/src/ui/Stats.cpp @@ -14,6 +14,7 @@ #include "Stats.h" #include +#include #include #include @@ -50,6 +51,8 @@ Stats* Stats::getInstance() { Stats::Stats(QQuickItem* parent) : QQuickItem(parent) { INSTANCE = this; + const QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont); + _monospaceFont = font.family(); } bool Stats::includeTimingRecord(const QString& name) { diff --git a/interface/src/ui/Stats.h b/interface/src/ui/Stats.h index efe340ed18..58d920d9a5 100644 --- a/interface/src/ui/Stats.h +++ b/interface/src/ui/Stats.h @@ -32,6 +32,8 @@ class Stats : public QQuickItem { HIFI_QML_DECL Q_PROPERTY(bool expanded READ isExpanded WRITE setExpanded NOTIFY expandedChanged) Q_PROPERTY(bool timingExpanded READ isTimingExpanded NOTIFY timingExpandedChanged) + Q_PROPERTY(QString monospaceFont READ monospaceFont) + STATS_PROPERTY(int, serverCount, 0) STATS_PROPERTY(int, framerate, 0) STATS_PROPERTY(int, avatarCount, 0) @@ -79,7 +81,9 @@ public: Stats(QQuickItem* parent = nullptr); bool includeTimingRecord(const QString& name); void setRenderDetails(const RenderDetails& details); - + const QString& monospaceFont() { + return _monospaceFont; + } void updateStats(); bool isExpanded() { return _expanded; } @@ -141,6 +145,7 @@ private: bool _resetRecentMaxPacketsSoon{ true }; bool _expanded{ false }; bool _timingExpanded{ false }; + QString _monospaceFont; }; #endif // hifi_Stats_h