-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
34 lines (27 loc) · 965 Bytes
/
mainwindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->factor->setText(QString("%1").arg(qApp->screens().at(0)->logicalDotsPerInch()));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::resizeEvent(QResizeEvent *e)
{
//qDebug() << "resize EVENT " << QTime::currentTime();
ui->width->setText(QString("%1 px").arg(e->size().width()));
ui->height->setText(QString("%1 px").arg(e->size().height()));
}
void MainWindow::moveEvent(QMoveEvent *)
{
// qDebug() << e->pos();
// qDebug() << QCursor::pos();
// ui->ldpi->setText(QString("%1 ldpi").arg(qApp->screenAt(QCursor::pos())->logicalDotsPerInch()));
// ui->pdpi->setText(QString("%1 ddpi").arg(qApp->screenAt(QCursor::pos())->physicalDotsPerInch()));
ui->factor->setText(QString("%1").arg(qApp->screenAt(QCursor::pos())->devicePixelRatio()));
}