View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000150 | QElectroTech | website | public | 2018-01-20 11:27 | 2021-02-15 00:48 |
Reporter | gabberworld | Assigned To | |||
Priority | high | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | 64 | OS | windows | OS Version | 10 |
Summary | 0000150: monitor scale | ||||
Description | when using monitor scale example 200% at my monitor by default then text size too big because GUI not use fully the auto DPI for windows | ||||
Tags | No tags attached. | ||||
Attached Files | HiDPI.patch (759 bytes)
diff --git a/sources/main.cpp b/sources/main.cpp index .. 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -32,14 +32,10 @@ QCoreApplication::setApplicationName("QElectroTech"); //Creation and execution of the application //HighDPI -#if QT_VERSION >= QT_VERSION_CHECK (5, 6, 0) -#if defined Q_OS_MAC - QApplication::setAttribute (Qt::AA_EnableHighDpiScaling); -#elif !defined(Q_OS_MAC) - QApplication::setAttribute (Qt::AA_DisableHighDpiScaling); +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #else - qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("1")); + qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("auto")); #endif -#endif return(QETApp(argc, argv).exec()); } | ||||
|
What your QET version? https://qelectrotech.org/forum/viewtopic.php?id=717 |
|
Version 0.7 (development) |
|
In the past I have enabled Qt::AA_EnableHighDpiScaling only for macOS, a lot of windows users have many rendering problems with Qt::AA_EnableHighDpiScaling, see previous link. #if QT_VERSION >= QT_VERSION_CHECK (5, 6, 0) #if defined Q_OS_MAC QApplication::setAttribute (Qt::AA_EnableHighDpiScaling); #elif !defined(Q_OS_MAC) QApplication::setAttribute (Qt::AA_DisableHighDpiScaling); #else qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("1")); #endif #endif We don't have 4K screens for check, sorry. |
|
what problem it caused in windows users?, it seems works just fine in windows 10 at me when i use QApplication::setAttribute (Qt::AA_EnableHighDpiScaling); |
|
You could see topic here : https://qelectrotech.org/forum/viewtopic.php?pid=4573#p4573 https://qelectrotech.org/forum/viewtopic.php?id=1050 |
|
Have you see problem like this video when you enable Qt::AA_EnableHighDpiScaling? https://youtu.be/BIBMj2SSBXM |
|
yes it happens when i select the Print to a physical printer but it not happens when i select the Print to a PDF file |
|
https://bugreports.qt.io/issues/?jql=project+%3D+QTBUG+AND+component+%3D+%22GUI%3A+Windows+integration%22+AND+status+%3D+%22In+Progress%22+ORDER+BY+priority+DESC You could try this solution ? https://bugreports.qt.io/browse/QTBUG-49374?focusedCommentId=329338&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-329338 |
|
well, it seems it fix the Print to a physical printer |
|
there is one small issue with that code tho, text is no clear |
|
I have problem with ShellScalingApi.h where do you find it ? |
|
C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\shared |
|
http://doc.qt.io/qt-5/highdpi.html Qt applications by default are Per-Monitor DPI Aware on Windows 8.1 or System-DPI Aware on older versions of Windows. As of Qt 5.4, the level can be specified by passing a parameter to the platform plugin (see Using qt.conf): <application> -platform windows:dpiawareness=0,1,2 Or try https://groups.google.com/forum/#!searchin/opentoonz_en/DPI$20and$20qt%7Csort:relevance/opentoonz_en/4yWzTVQraDM/Oaa_6zM8BwAJ |
|
if there no #include "ShellScalingApi.h" then you can use this |
|
You could try it? |
|
with manifest it give same results as i posted code before in post 0000150:0000276 |
|
And you think I can commit this code now ? For now I saw no error in compiler with mxe cross-compiler. I found it at this url : Qt5 ????? |
|
that code not worked for me what you posted at 0000150:0000284 and i think it's better if you add manifest for the QElectroTech.exe as currently it not have that i added example to the QElectro.rar file how to include manifest to windows, then you don't need make changes in main.cpp |
|
made small change at manifest file |
|
if you add manifest then it may close this |
|
|
|
if you dont want use that icon then remove the +ID_ICON1 ICON DISCARDABLE "qelectrotech.ico" or it fill make build error |
|
or change that for ID_ICON1 ICON DISCARDABLE "ico\windows_icon\qelectrotech.ico" |
|
I build new packages for Windows, I put manifest file in bin folder, you could try it? Thanks. |
|
seems that it works just fine |
|
you could try this, thanks? #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #else qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("auto")); #endif |
|
sure, what it should todo anyway? better pixels in high resolution? |
|
by the way you should not use QT_DEVICE_PIXEL_RATIO anymore, it will be removed in future qt |
|
qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("auto")); this is if someone use lower QT_VERSION, i have new version soo i cant test that |
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); gives same effect like it give before with other code, if that what you want know. and like i understand QT is self full off bugs, soo i have no idea what it realy should todo or not |
|
Yes I try to clarify code and set Qt::AA_EnableHighDpiScaling for all other OS because manifest seem fix HIDPI on Windows.Yes I know but it's only if Qt version is < 5.6.0 https://github.com/ribtoks/xpiks/commit/981f3b1052824893f72cf86b8b9b47235b7cddb3 |
|
Well, I think we will leave it as it is for now. |
|
by default Qt::AA_EnableHighDpiScaling should work just fine even in windows, but if i understand QElectroTech uses custom made printview and i think it have bug at there somewhere, as it seems it draw lines right way and items wrong way. currently it fix this issue by using rc file, but it seems that it's wrong way todo |
|
and like i tell before print to pdf don't have this issue, that problem is only with print to physical printer |
|
if you use that then it make no changes in windows, because in windows mainfest overrides that |
|
it looks like i found out with 2 day searching that this print bug comes probably at qt QPrint self, i can't confirm that 100%, anyway i started look differences between pdf print and normal pdf print and i ended in printer resolution() in this HighDpi.patch i disabled the manifest as it seems we not need use that for now. HighDpi.patch (2,568 bytes)
Index: qelectrotech.pro =================================================================== --- qelectrotech.pro (revision 5241) +++ qelectrotech.pro (working copy) @@ -31,7 +31,7 @@ QET_LANG_PATH = 'lang/' QET_LICENSE_PATH = './' # Liste des ressources Windows - RC_FILE = qelectrotech.rc + #RC_FILE = qelectrotech.rc } macx { # Chemins MacOS X Index: sources/diagramprintdialog.cpp =================================================================== --- sources/diagramprintdialog.cpp (revision 5241) +++ sources/diagramprintdialog.cpp (working copy) @@ -354,7 +354,25 @@ */ void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page, const ExportProperties options) { //qDebug() << "Demande d'impression de " << diagrams.count() << "schemas."; - +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + #ifdef Q_OS_WIN + #ifdef QT_DEBUG + qDebug() << "--"; + qDebug() << "DiagramPrintDialog::print printer_->resolution() before " << printer_->resolution(); + qDebug() << "DiagramPrintDialog::print screennumber " << QApplication::desktop()->screenNumber(); + #endif + + QScreen *srn = QApplication::screens().at(QApplication::desktop()->screenNumber()); + qreal dotsPerInch = (qreal)srn->logicalDotsPerInch(); + printer_->setResolution(dotsPerInch); + + #ifdef QT_DEBUG + qDebug() << "DiagramPrintDialog::print dotsPerInch " << dotsPerInch; + qDebug() << "DiagramPrintDialog::print printer_->resolution() after" << printer_->resolution(); + qDebug() << "--"; + #endif + #endif +#endif // QPainter utiliser pour effectuer le rendu QPainter qp(printer_); Index: sources/main.cpp =================================================================== --- sources/main.cpp (revision 5241) +++ sources/main.cpp (working copy) @@ -32,14 +32,10 @@ QCoreApplication::setApplicationName("QElectroTech"); //Creation and execution of the application //HighDPI -#if QT_VERSION >= QT_VERSION_CHECK (5, 6, 0) -#if defined Q_OS_MAC - QApplication::setAttribute (Qt::AA_EnableHighDpiScaling); -#elif !defined(Q_OS_MAC) - QApplication::setAttribute (Qt::AA_DisableHighDpiScaling); +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #else - qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("1")); + qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("auto")); #endif -#endif return(QETApp(argc, argv).exec()); } |
|
Thanks. |
|
I think is a little typo ? |
|
+ QScreen *srn = QApplication::screens().at(QApplication::desktop()->screenNumber()); + qreal dotsPerInch = (qreal)srn->logicalDotsPerInch(); may not work at qt 4 soo i added there qt 5 |
|
QET no longer supports Qt4 libs since the beginning of 0.5 version. ;-) I do not know if your change can be applied to all platforms, for the moment it is very difficult to have users feedback with these screens. Thanks a lot for your help. like this : https://lists.debian.org/debian-kde/2018/02/msg00010.html |
Date Modified | Username | Field | Change |
---|---|---|---|
2018-01-20 11:27 | gabberworld | New Issue | |
2018-01-20 11:33 | gabberworld | File Added: qelectro.png | |
2018-01-20 19:04 | scorpio810_mantis | Note Added: 0000267 | |
2018-01-20 19:36 | scorpio810_mantis | Note Edited: 0000267 | |
2018-01-24 23:22 | gabberworld | Note Added: 0000268 | |
2018-01-25 11:30 | scorpio810_mantis | Note Added: 0000269 | |
2018-01-26 02:03 | gabberworld | Note Added: 0000271 | |
2018-01-26 02:14 | gabberworld | File Added: qelectro_dpi_enabled.png | |
2018-01-26 05:30 | scorpio810_mantis | Note Added: 0000272 | |
2018-01-26 05:38 | scorpio810_mantis | Note Edited: 0000272 | |
2018-01-26 05:38 | scorpio810_mantis | Note Edited: 0000272 | |
2018-01-28 18:55 | scorpio810_mantis | Note Added: 0000273 | |
2018-01-28 21:11 | gabberworld | Note Added: 0000274 | |
2018-01-29 02:14 | scorpio810_mantis | Note Added: 0000275 | |
2018-01-29 17:57 | gabberworld | Note Added: 0000276 | |
2018-01-30 12:52 | gabberworld | Note Added: 0000278 | |
2018-01-30 13:12 | gabberworld | File Added: blur_text_vs_high_res_txt.png | |
2018-01-30 17:10 | scorpio810_mantis | Note Added: 0000279 | |
2018-01-30 17:46 | gabberworld | Note Added: 0000280 | |
2018-01-30 18:22 | scorpio810_mantis | Note Added: 0000281 | |
2018-01-30 20:01 | gabberworld | Note Added: 0000282 | |
2018-01-31 18:33 | scorpio810_mantis | Note Added: 0000284 | |
2018-02-04 13:39 | gabberworld | File Added: QElectro.rar | |
2018-02-04 13:39 | gabberworld | Note Added: 0000285 | |
2018-02-04 15:43 | scorpio810_mantis | Note Added: 0000286 | |
2018-02-04 15:46 | scorpio810_mantis | Note Edited: 0000286 | |
2018-02-04 18:37 | gabberworld | Note Added: 0000287 | |
2018-02-04 19:14 | gabberworld | Note Added: 0000288 | |
2018-02-04 19:19 | gabberworld | Note Added: 0000289 | |
2018-02-04 19:35 | scorpio810_mantis | Note Added: 0000290 | |
2018-02-04 19:35 | scorpio810_mantis | Note Edited: 0000290 | |
2018-02-04 19:36 | scorpio810_mantis | Note Edited: 0000290 | |
2018-02-04 20:35 | gabberworld | Note Added: 0000291 | |
2018-02-04 20:45 | gabberworld | Note Added: 0000292 | |
2018-02-06 17:26 | scorpio810_mantis | Note Added: 0000294 | |
2018-02-06 18:55 | gabberworld | Note Added: 0000295 | |
2018-02-15 17:38 | scorpio810_mantis | Note Added: 0000301 | |
2018-02-15 18:56 | scorpio810_mantis | File Added: HiDPI.patch | |
2018-02-17 00:23 | gabberworld | Note Added: 0000302 | |
2018-02-17 00:39 | gabberworld | Note Added: 0000303 | |
2018-02-17 02:25 | gabberworld | Note Added: 0000304 | |
2018-02-17 04:19 | gabberworld | Note Added: 0000305 | |
2018-02-17 15:43 | scorpio810_mantis | Note Added: 0000306 | |
2018-02-17 16:38 | scorpio810_mantis | Note Added: 0000307 | |
2018-02-17 16:55 | gabberworld | Note Added: 0000308 | |
2018-02-17 17:10 | gabberworld | Note Added: 0000309 | |
2018-02-17 17:15 | gabberworld | Note Added: 0000310 | |
2018-02-19 14:52 | gabberworld | File Added: HighDpi.patch | |
2018-02-19 14:52 | gabberworld | Note Added: 0000311 | |
2018-02-19 17:18 | scorpio810_mantis | Note Added: 0000312 | |
2018-02-19 17:56 | scorpio810_mantis | Note Added: 0000313 | |
2018-02-19 19:45 | gabberworld | Note Added: 0000314 | |
2018-02-19 20:06 | scorpio810_mantis | Note Added: 0000315 | |
2018-03-29 16:42 | scorpio810_mantis | Status | new => resolved |
2018-03-29 16:42 | scorpio810_mantis | Resolution | open => fixed |
2018-03-29 16:42 | scorpio810_mantis | Product Version | => SVN/trunk |
2018-03-29 16:42 | scorpio810_mantis | Fixed in Version | => SVN/trunk |
2021-02-15 00:48 |
|
Category | Diagram Editor => website |