[qet] qet/qet: [5282] Backport HiDPI fix |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 5282
Author: scorpio810
Date: 2018-03-29 16:32:17 +0200 (Thu, 29 Mar 2018)
Log Message:
-----------
Backport HiDPI fix
Modified Paths:
--------------
branches/0.60/sources/diagramprintdialog.cpp
branches/0.60/sources/main.cpp
Modified: branches/0.60/sources/diagramprintdialog.cpp
===================================================================
--- branches/0.60/sources/diagramprintdialog.cpp 2018-03-27 19:04:43 UTC (rev 5281)
+++ branches/0.60/sources/diagramprintdialog.cpp 2018-03-29 14:32:17 UTC (rev 5282)
@@ -351,13 +351,31 @@
@param fit_page Booleen indiquant s'il faut adapter les schemas aux pages
ou non
@param options Options de rendu
-*/
-void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page, const ExportProperties options) {
- //qDebug() << "Demande d'impression de " << diagrams.count() << "schemas.";
-
- // QPainter utiliser pour effectuer le rendu
- QPainter qp(printer_);
-
+*/
+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_);
+
// cas special : il n'y a aucun schema a imprimer
if (!diagrams.count()) {
qp.end();
Modified: branches/0.60/sources/main.cpp
===================================================================
--- branches/0.60/sources/main.cpp 2018-03-27 19:04:43 UTC (rev 5281)
+++ branches/0.60/sources/main.cpp 2018-03-29 14:32:17 UTC (rev 5282)
@@ -29,17 +29,13 @@
//Some setup, notably to use with QSetting.
QCoreApplication::setOrganizationName("QElectroTech");
QCoreApplication::setOrganizationDomain("qelectrotech.org");
- 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);
-#else
- qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("1"));
-#endif
-#endif
- return(QETApp(argc, argv).exec());
-}
+ QCoreApplication::setApplicationName("QElectroTech");
+ //Creation and execution of the application
+ //HighDPI
+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+#else
+ qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("auto"));
+#endif
+ return(QETApp(argc, argv).exec());
+}