Use qreal to store return value of devicePixelRatioF
parent
7cf1aac419
commit
40ed2011bf
|
@ -1630,7 +1630,7 @@ void CelestiaAppWindow::setCustomFPS()
|
||||||
|
|
||||||
void CelestiaAppWindow::requestContextMenu(float x, float y, Selection sel)
|
void CelestiaAppWindow::requestContextMenu(float x, float y, Selection sel)
|
||||||
{
|
{
|
||||||
float scale = devicePixelRatioF();
|
qreal scale = devicePixelRatioF();
|
||||||
SelectionPopup* menu = new SelectionPopup(sel, m_appCore, this);
|
SelectionPopup* menu = new SelectionPopup(sel, m_appCore, this);
|
||||||
connect(menu, SIGNAL(selectionInfoRequested(Selection&)),
|
connect(menu, SIGNAL(selectionInfoRequested(Selection&)),
|
||||||
this, SLOT(slotShowObjectInfo(Selection&)));
|
this, SLOT(slotShowObjectInfo(Selection&)));
|
||||||
|
|
|
@ -133,18 +133,18 @@ void CelestiaGlWidget::initializeGL()
|
||||||
|
|
||||||
void CelestiaGlWidget::resizeGL(int w, int h)
|
void CelestiaGlWidget::resizeGL(int w, int h)
|
||||||
{
|
{
|
||||||
float scale = devicePixelRatioF();
|
qreal scale = devicePixelRatioF();
|
||||||
int width = static_cast<int>(static_cast<float>(w) * scale);
|
auto width = static_cast<int>(w * scale);
|
||||||
int height = static_cast<int>(static_cast<float>(h) * scale);
|
auto height = static_cast<int>(h * scale);
|
||||||
appCore->resize(width, height);
|
appCore->resize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CelestiaGlWidget::mouseMoveEvent(QMouseEvent* m)
|
void CelestiaGlWidget::mouseMoveEvent(QMouseEvent* m)
|
||||||
{
|
{
|
||||||
float scale = devicePixelRatioF();
|
qreal scale = devicePixelRatioF();
|
||||||
int x = (int)(m->x() * scale);
|
auto x = static_cast<int>(m->x() * scale);
|
||||||
int y = (int)(m->y() * scale);
|
auto y = static_cast<int>(m->y() * scale);
|
||||||
|
|
||||||
int buttons = 0;
|
int buttons = 0;
|
||||||
if (m->buttons() & LeftButton)
|
if (m->buttons() & LeftButton)
|
||||||
|
@ -201,9 +201,9 @@ void CelestiaGlWidget::mouseMoveEvent(QMouseEvent* m)
|
||||||
|
|
||||||
void CelestiaGlWidget::mousePressEvent( QMouseEvent* m )
|
void CelestiaGlWidget::mousePressEvent( QMouseEvent* m )
|
||||||
{
|
{
|
||||||
float scale = devicePixelRatioF();
|
qreal scale = devicePixelRatioF();
|
||||||
int x = (int)(m->x() * scale);
|
auto x = static_cast<int>(m->x() * scale);
|
||||||
int y = (int)(m->y() * scale);
|
auto y = static_cast<int>(m->y() * scale);
|
||||||
|
|
||||||
if (m->button() == LeftButton)
|
if (m->button() == LeftButton)
|
||||||
appCore->mouseButtonDown(x, y, CelestiaCore::LeftButton);
|
appCore->mouseButtonDown(x, y, CelestiaCore::LeftButton);
|
||||||
|
@ -216,9 +216,9 @@ void CelestiaGlWidget::mousePressEvent( QMouseEvent* m )
|
||||||
|
|
||||||
void CelestiaGlWidget::mouseReleaseEvent( QMouseEvent* m )
|
void CelestiaGlWidget::mouseReleaseEvent( QMouseEvent* m )
|
||||||
{
|
{
|
||||||
float scale = devicePixelRatioF();
|
qreal scale = devicePixelRatioF();
|
||||||
int x = (int)(m->x() * scale);
|
auto x = static_cast<int>(m->x() * scale);
|
||||||
int y = (int)(m->y() * scale);
|
auto y = static_cast<int>(m->y() * scale);
|
||||||
|
|
||||||
if (m->button() == LeftButton)
|
if (m->button() == LeftButton)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue