Skip to content

Commit aaeba9c

Browse files
committed
Font cleanup in demo plugins
1 parent 8b294a9 commit aaeba9c

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

plugins/HelloStelModule/src/HelloStelModule.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "HelloStelModule.hpp"
2626

2727
#include <QDebug>
28+
#include <QFont>
2829

2930
/*************************************************************************
3031
This method is the one called automatically by the StelModuleMgr just
@@ -49,10 +50,9 @@ StelPluginInfo HelloStelModuleStelPluginInterface::getPluginInfo() const
4950
/*************************************************************************
5051
Constructor
5152
*************************************************************************/
52-
HelloStelModule::HelloStelModule()
53+
HelloStelModule::HelloStelModule(): fontSize(25)
5354
{
5455
setObjectName("HelloStelModule");
55-
font.setPixelSize(25);
5656
}
5757

5858
/*************************************************************************
@@ -88,6 +88,8 @@ void HelloStelModule::draw(StelCore* core)
8888
{
8989
StelPainter painter(core->getProjection2d());
9090
painter.setColor(1,1,1,1);
91+
QFont font=QGuiApplication::font();
92+
font.setPixelSize(fontSize);
9193
painter.setFont(font);
9294
painter.drawText(300, 300, "Hello World!");
9395
}

plugins/HelloStelModule/src/HelloStelModule.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#define HELLOSTELMODULE_HPP
2121

2222
#include "StelModule.hpp"
23-
#include <QFont>
2423

2524
//! This is an example of a plug-in which can be dynamically loaded into stellarium
2625
class HelloStelModule : public StelModule
@@ -37,8 +36,8 @@ class HelloStelModule : public StelModule
3736
void draw(StelCore* core) override;
3837
double getCallOrder(StelModuleActionName actionName) const override;
3938
private:
40-
// Font used for displaying our text
41-
QFont font;
39+
// Fontsize used for displaying our text
40+
int fontSize;
4241
};
4342

4443

plugins/SimpleDrawLine/src/SimpleDrawLine.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ StelPluginInfo SimpleDrawLineStelPluginInterface::getPluginInfo() const
5252
/*************************************************************************
5353
Constructor
5454
*************************************************************************/
55-
SimpleDrawLine::SimpleDrawLine()
55+
SimpleDrawLine::SimpleDrawLine(): fontSize(25)
5656
{
5757
setObjectName("SimpleDrawLine");
58-
font.setPixelSize(25);
5958
}
6059

6160
/*************************************************************************

plugins/SimpleDrawLine/src/SimpleDrawLine.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#define SIMPLEDRAWLINE_HPP
2121

2222
#include "StelModule.hpp"
23-
#include <QFont>
2423

2524
//! This is an example of a plug-in which can be dynamically loaded into stellarium
2625
class SimpleDrawLine : public StelModule
@@ -35,8 +34,8 @@ class SimpleDrawLine : public StelModule
3534
void draw(StelCore* core) override;
3635
double getCallOrder(StelModuleActionName actionName) const override;
3736
private:
38-
// Font used for displaying our text
39-
QFont font;
37+
// Font size used for displaying our text
38+
int fontSize;
4039
};
4140

4241

0 commit comments

Comments
 (0)