用于测试dpi适配

master
DESKTOP-4RNDQIC\29019 2020-12-07 00:01:38 +08:00
parent 31266646ba
commit f19e079467
3 changed files with 29 additions and 9 deletions

View File

@ -4,10 +4,11 @@
#include <QTimer>
#include "CameraCapture.h"
#include "mainwindow.h"
#include <qlibrary.h>
#include <qsysinfo.h>
#include <qt_windows.h>
#include <Tlhelp32.h>
void CameraDataCallback(double ts, BYTE *dat, LONG size){
qDebug()<<"reieve cnt"<<size;
}
void initQss()
{
QFile file(":/qss/css/qss.css");
@ -26,7 +27,10 @@ int RegiesterOwnType(){
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QssEventFilter filter;
QApplication app(argc, argv);
app.installNativeEventFilter(&filter);
initQss(); //step 2
MainWindow main;
@ -34,5 +38,5 @@ int main(int argc, char *argv[])
main.setWindowTitle("视频采集rtmp推流工具");
main.show();
return a.exec();
return app.exec();
}

View File

@ -1,6 +1,7 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDesktopWidget>
#include <QPaintDevice>
MainWindow::MainWindow(QWidget *parent) :
QssMainWindow(parent),
@ -11,7 +12,8 @@ MainWindow::MainWindow(QWidget *parent) :
mPlayerWidget(nullptr),
mVideoCoder(nullptr),
mPusher(nullptr),
mAudioCapture(nullptr)
mAudioCapture(nullptr),
mTimer(nullptr)
{
ui->setupUi(this);
this->move(50,50);
@ -38,6 +40,10 @@ MainWindow::MainWindow(QWidget *parent) :
//mAudioCapture->InitCapture(0, 44100, 2);
//mAudioCapture->StartCapture();
mPusher = new H264RtmpPuser();
mTimer = new QTimer(this);
connect(mTimer, SIGNAL(timeout()), this, SLOT(DetectDpi()));
mTimer->start(1000);
}
MainWindow::~MainWindow(){
@ -123,3 +129,13 @@ void MainWindow::on_pushButton_3_clicked()
{
qDebug()<<ui->comboBox_2->currentText();
}
void MainWindow::DetectDpi()
{
qDebug()<<"detect dpi";
int horizontalDPI = logicalDpiX();
int verticalDPI = logicalDpiY();
qDebug()<<horizontalDPI<<verticalDPI<<physicalDpiX()<<physicalDpiY();
}

View File

@ -28,11 +28,9 @@ public:
private slots:
void on_pushButton_clicked();
void on_pushButton_2_clicked();
void on_pushButton_3_clicked();
void DetectDpi();
private:
Ui::MainWindow *ui;
Camera *mCamera;
@ -44,6 +42,8 @@ private:
H264RtmpPuser *mPusher;
CaptureAudioFfmpeg *mAudioCapture;
vector<CaptureAudioFfmpeg::MICInfo> mMic;
QTimer *mTimer;
};
#endif // MAINWINDOW_H