diff --git a/DSView/main.cpp b/DSView/main.cpp index 8d08b0c7..d24fd51b 100755 --- a/DSView/main.cpp +++ b/DSView/main.cpp @@ -24,12 +24,11 @@ #include #include -#include -#include +#include #include -#include -#include #include +#include +#include #include "dsapplication.h" #include "mystyle.h" @@ -58,19 +57,33 @@ void usage() int main(int argc, char *argv[]) -{ - // sr_test_usb_api();return 0; - +{ int ret = 0; const char *open_file = NULL; - #if QT_VERSION >= QT_VERSION_CHECK(5,6,0) - //On Windows, need to compile with the QT5 version of the library, which makes the interface slightly larger. - QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); - #endif // QT_VERSION +#if QT_VERSION >= QT_VERSION_CHECK(5,6,0) +bool bHighScale = true; +#ifdef _WIN32 + int argc1 = 0; + QApplication *a1 = new QApplication(argc1, NULL); + float sk = QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96; + int sy = QGuiApplication::primaryScreen()->size().height(); //screen rect height + delete a1; + a1 = NULL; - #ifdef _WIN32 + if (sk >= 1.5 && sy <= 1080){ + QApplication::setAttribute(Qt::AA_DisableHighDpiScaling); + QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); + bHighScale = false; + } +#endif + if (bHighScale){ + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); + } +#endif + +#ifdef _WIN32 // Under Windows, we need to manually retrieve the command-line arguments and convert them from UTF-16 to UTF-8. // This prevents data loss if there are any characters that wouldn't fit in the local ANSI code page. int argcUTF16 = 0; @@ -111,6 +124,7 @@ int main(int argc, char *argv[]) QApplication::setOrganizationDomain("www.DreamSourceLab.com"); qDebug()<<"\n----------------- version:"<devicePixelRatio(); + float sk = QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96; int srcHeight = QGuiApplication::primaryScreen()->availableSize().height(); if (srcHeight > 500) srcHeight = 500; diff --git a/DSView/pv/dialogs/deviceoptions.cpp b/DSView/pv/dialogs/deviceoptions.cpp index b768bf90..9af34d4b 100755 --- a/DSView/pv/dialogs/deviceoptions.cpp +++ b/DSView/pv/dialogs/deviceoptions.cpp @@ -709,7 +709,7 @@ void DeviceOptions::try_resize_scroll() int contentHeight = _groupHeight1 + _groupHeight2 + 10; // +space //dialog height int dlgHeight = contentHeight + 95; // +bottom buttton - double sk = QGuiApplication::primaryScreen()->devicePixelRatio(); + float sk = QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96; int srcHeight = 550; int w = _width; diff --git a/DSView/pv/mainframe.cpp b/DSView/pv/mainframe.cpp index 36bd26a6..7d2e03b1 100644 --- a/DSView/pv/mainframe.cpp +++ b/DSView/pv/mainframe.cpp @@ -79,7 +79,7 @@ MainFrame::MainFrame() // Set the window icon QIcon icon; - icon.addFile(QString::fromUtf8(":/icons/logo.svg"), QSize(), QIcon::Normal, QIcon::Off); + icon.addFile(QString::fromUtf8(":/icons/logo.svg"), QSize(), QIcon::Normal, QIcon::Off); setWindowIcon(icon); // Title @@ -208,7 +208,7 @@ void MainFrame::showMaximized() hide_border(); #ifdef _WIN32 - double sk = QGuiApplication::primaryScreen()->devicePixelRatio(); + float sk = QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96; if (sk >= 1.5) { auto rect = QGuiApplication::primaryScreen()->availableGeometry();