mirror of https://github.com/mgba-emu/mgba.git
Qt: Don't use a static QFont
This commit is contained in:
parent
40c3fc63cc
commit
6154ed91cb
|
@ -20,7 +20,7 @@ void AssetInfo::addCustomProperty(const QString& id, const QString& visibleName)
|
||||||
QHBoxLayout* newLayout = new QHBoxLayout;
|
QHBoxLayout* newLayout = new QHBoxLayout;
|
||||||
newLayout->addWidget(new QLabel(visibleName));
|
newLayout->addWidget(new QLabel(visibleName));
|
||||||
QLabel* value = new QLabel;
|
QLabel* value = new QLabel;
|
||||||
value->setFont(GBAApp::monospaceFont());
|
value->setFont(GBAApp::app()->monospaceFont());
|
||||||
value->setAlignment(Qt::AlignRight);
|
value->setAlignment(Qt::AlignRight);
|
||||||
newLayout->addWidget(value);
|
newLayout->addWidget(value);
|
||||||
m_customProperties[id] = value;
|
m_customProperties[id] = value;
|
||||||
|
|
|
@ -31,7 +31,7 @@ AssetTile::AssetTile(QWidget* parent)
|
||||||
|
|
||||||
connect(m_ui.preview, &Swatch::indexPressed, this, &AssetTile::selectColor);
|
connect(m_ui.preview, &Swatch::indexPressed, this, &AssetTile::selectColor);
|
||||||
|
|
||||||
const QFont font = GBAApp::monospaceFont();
|
const QFont font = GBAApp::app()->monospaceFont();
|
||||||
|
|
||||||
m_ui.tileId->setFont(font);
|
m_ui.tileId->setFont(font);
|
||||||
m_ui.paletteId->setFont(font);
|
m_ui.paletteId->setFont(font);
|
||||||
|
|
|
@ -20,7 +20,7 @@ CheatsModel::CheatsModel(mCheatDevice* device, QObject* parent)
|
||||||
: QAbstractItemModel(parent)
|
: QAbstractItemModel(parent)
|
||||||
, m_device(device)
|
, m_device(device)
|
||||||
{
|
{
|
||||||
m_font = GBAApp::monospaceFont();
|
m_font = GBAApp::app()->monospaceFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CheatsModel::data(const QModelIndex& index, int role) const {
|
QVariant CheatsModel::data(const QModelIndex& index, int role) const {
|
||||||
|
|
|
@ -36,14 +36,12 @@ static GBAApp* g_app = nullptr;
|
||||||
|
|
||||||
mLOG_DEFINE_CATEGORY(QT, "Qt", "platform.qt");
|
mLOG_DEFINE_CATEGORY(QT, "Qt", "platform.qt");
|
||||||
|
|
||||||
QFont GBAApp::s_monospace;
|
|
||||||
|
|
||||||
GBAApp::GBAApp(int& argc, char* argv[], ConfigController* config)
|
GBAApp::GBAApp(int& argc, char* argv[], ConfigController* config)
|
||||||
: QApplication(argc, argv)
|
: QApplication(argc, argv)
|
||||||
, m_configController(config)
|
, m_configController(config)
|
||||||
|
, m_monospace(QFontDatabase::systemFont(QFontDatabase::FixedFont))
|
||||||
{
|
{
|
||||||
g_app = this;
|
g_app = this;
|
||||||
s_monospace = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
|
||||||
|
|
||||||
#ifdef BUILD_SDL
|
#ifdef BUILD_SDL
|
||||||
SDL_Init(SDL_INIT_NOPARACHUTE);
|
SDL_Init(SDL_INIT_NOPARACHUTE);
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
|
|
||||||
static QString dataDir();
|
static QString dataDir();
|
||||||
|
|
||||||
static QFont monospaceFont() { return s_monospace; }
|
QFont monospaceFont() { return m_monospace; }
|
||||||
|
|
||||||
QList<Window*> windows() { return m_windows; }
|
QList<Window*> windows() { return m_windows; }
|
||||||
Window* newWindow();
|
Window* newWindow();
|
||||||
|
@ -114,7 +114,7 @@ private:
|
||||||
QThreadPool m_workerThreads;
|
QThreadPool m_workerThreads;
|
||||||
qint64 m_nextJob = 1;
|
qint64 m_nextJob = 1;
|
||||||
|
|
||||||
static QFont s_monospace;
|
QFont m_monospace;
|
||||||
|
|
||||||
NoIntroDB* m_db = nullptr;
|
NoIntroDB* m_db = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1594,7 +1594,7 @@ IOViewer::IOViewer(std::shared_ptr<CoreController> controller, QWidget* parent)
|
||||||
m_ui.regSelect->addItem("0x" + QString("%1: %2").arg((i << m_width) + m_base, 4, 16, QChar('0')).toUpper().arg(reg), i << m_width);
|
m_ui.regSelect->addItem("0x" + QString("%1: %2").arg((i << m_width) + m_base, 4, 16, QChar('0')).toUpper().arg(reg), i << m_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QFont font = GBAApp::monospaceFont();
|
const QFont font = GBAApp::app()->monospaceFont();
|
||||||
m_ui.regValue->setFont(font);
|
m_ui.regValue->setFont(font);
|
||||||
|
|
||||||
connect(m_ui.buttonBox, &QDialogButtonBox::clicked, this, &IOViewer::buttonPressed);
|
connect(m_ui.buttonBox, &QDialogButtonBox::clicked, this, &IOViewer::buttonPressed);
|
||||||
|
|
|
@ -28,7 +28,7 @@ using namespace QGBA;
|
||||||
MemoryModel::MemoryModel(QWidget* parent)
|
MemoryModel::MemoryModel(QWidget* parent)
|
||||||
: QAbstractScrollArea(parent)
|
: QAbstractScrollArea(parent)
|
||||||
{
|
{
|
||||||
m_font = GBAApp::monospaceFont();
|
m_font = GBAApp::app()->monospaceFont();
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
m_font.setPointSize(12);
|
m_font.setPointSize(12);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -16,7 +16,7 @@ using namespace QGBA;
|
||||||
MessagePainter::MessagePainter(QObject* parent)
|
MessagePainter::MessagePainter(QObject* parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
m_messageFont = GBAApp::monospaceFont();
|
m_messageFont = GBAApp::app()->monospaceFont();
|
||||||
m_messageFont.setPixelSize(13);
|
m_messageFont.setPixelSize(13);
|
||||||
connect(&m_messageTimer, &QTimer::timeout, this, &MessagePainter::clearMessage);
|
connect(&m_messageTimer, &QTimer::timeout, this, &MessagePainter::clearMessage);
|
||||||
m_messageTimer.setSingleShot(true);
|
m_messageTimer.setSingleShot(true);
|
||||||
|
|
|
@ -33,7 +33,7 @@ ObjView::ObjView(std::shared_ptr<CoreController> controller, QWidget* parent)
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
m_ui.tile->setController(controller);
|
m_ui.tile->setController(controller);
|
||||||
|
|
||||||
const QFont font = GBAApp::monospaceFont();
|
const QFont font = GBAApp::app()->monospaceFont();
|
||||||
|
|
||||||
m_ui.x->setFont(font);
|
m_ui.x->setFont(font);
|
||||||
m_ui.y->setFont(font);
|
m_ui.y->setFont(font);
|
||||||
|
|
|
@ -47,7 +47,7 @@ PaletteView::PaletteView(std::shared_ptr<CoreController> controller, QWidget* pa
|
||||||
m_ui.selected->setDimensions(QSize(1, 1));
|
m_ui.selected->setDimensions(QSize(1, 1));
|
||||||
updatePalette();
|
updatePalette();
|
||||||
|
|
||||||
const QFont font = GBAApp::monospaceFont();
|
const QFont font = GBAApp::app()->monospaceFont();
|
||||||
|
|
||||||
m_ui.hexcode->setFont(font);
|
m_ui.hexcode->setFont(font);
|
||||||
m_ui.value->setFont(font);
|
m_ui.value->setFont(font);
|
||||||
|
|
|
@ -74,7 +74,7 @@ RegisterView::RegisterView(std::shared_ptr<CoreController> controller, QWidget*
|
||||||
|
|
||||||
void RegisterView::addRegisters(const QStringList& names) {
|
void RegisterView::addRegisters(const QStringList& names) {
|
||||||
QFormLayout* form = static_cast<QFormLayout*>(layout());
|
QFormLayout* form = static_cast<QFormLayout*>(layout());
|
||||||
const QFont font = GBAApp::monospaceFont();
|
const QFont font = GBAApp::app()->monospaceFont();
|
||||||
for (const auto& reg : names) {
|
for (const auto& reg : names) {
|
||||||
QLabel* value = new QLabel;
|
QLabel* value = new QLabel;
|
||||||
value->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
value->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||||
|
|
Loading…
Reference in New Issue