mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
update: disalbe hight dpi scale when scale > 150%
This commit is contained in:
parent
d43d00c542
commit
dfb30a8dec
@ -24,12 +24,11 @@
|
|||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QTranslator>
|
|
||||||
#include <QDesktopServices>
|
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QScreen>
|
||||||
|
|
||||||
#include "dsapplication.h"
|
#include "dsapplication.h"
|
||||||
#include "mystyle.h"
|
#include "mystyle.h"
|
||||||
@ -58,19 +57,33 @@ void usage()
|
|||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// sr_test_usb_api();return 0;
|
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
const char *open_file = NULL;
|
const char *open_file = NULL;
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
|
#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.
|
bool bHighScale = true;
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
#ifdef _WIN32
|
||||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
int argc1 = 0;
|
||||||
#endif // QT_VERSION
|
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.
|
// 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.
|
// This prevents data loss if there are any characters that wouldn't fit in the local ANSI code page.
|
||||||
int argcUTF16 = 0;
|
int argcUTF16 = 0;
|
||||||
@ -111,6 +124,7 @@ int main(int argc, char *argv[])
|
|||||||
QApplication::setOrganizationDomain("www.DreamSourceLab.com");
|
QApplication::setOrganizationDomain("www.DreamSourceLab.com");
|
||||||
|
|
||||||
qDebug()<<"\n----------------- version:"<<DS_VERSION_STRING<<"-----------------\n";
|
qDebug()<<"\n----------------- version:"<<DS_VERSION_STRING<<"-----------------\n";
|
||||||
|
qDebug()<<"Qt:"<<QT_VERSION_STR;
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
// Use low version qt plugins, for able to debug
|
// Use low version qt plugins, for able to debug
|
||||||
|
@ -177,7 +177,7 @@ void DecoderOptionsDlg::load_options(view::DecodeTrace *trace)
|
|||||||
int w = tsize.width();
|
int w = tsize.width();
|
||||||
int h = tsize.height();
|
int h = tsize.height();
|
||||||
|
|
||||||
double sk = QGuiApplication::primaryScreen()->devicePixelRatio();
|
float sk = QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96;
|
||||||
int srcHeight = QGuiApplication::primaryScreen()->availableSize().height();
|
int srcHeight = QGuiApplication::primaryScreen()->availableSize().height();
|
||||||
if (srcHeight > 500)
|
if (srcHeight > 500)
|
||||||
srcHeight = 500;
|
srcHeight = 500;
|
||||||
|
@ -709,7 +709,7 @@ void DeviceOptions::try_resize_scroll()
|
|||||||
int contentHeight = _groupHeight1 + _groupHeight2 + 10; // +space
|
int contentHeight = _groupHeight1 + _groupHeight2 + 10; // +space
|
||||||
//dialog height
|
//dialog height
|
||||||
int dlgHeight = contentHeight + 95; // +bottom buttton
|
int dlgHeight = contentHeight + 95; // +bottom buttton
|
||||||
double sk = QGuiApplication::primaryScreen()->devicePixelRatio();
|
float sk = QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96;
|
||||||
|
|
||||||
int srcHeight = 550;
|
int srcHeight = 550;
|
||||||
int w = _width;
|
int w = _width;
|
||||||
|
@ -79,7 +79,7 @@ MainFrame::MainFrame()
|
|||||||
|
|
||||||
// Set the window icon
|
// Set the window icon
|
||||||
QIcon 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);
|
setWindowIcon(icon);
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
@ -208,7 +208,7 @@ void MainFrame::showMaximized()
|
|||||||
hide_border();
|
hide_border();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
double sk = QGuiApplication::primaryScreen()->devicePixelRatio();
|
float sk = QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96;
|
||||||
if (sk >= 1.5)
|
if (sk >= 1.5)
|
||||||
{
|
{
|
||||||
auto rect = QGuiApplication::primaryScreen()->availableGeometry();
|
auto rect = QGuiApplication::primaryScreen()->availableGeometry();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user