mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Backport HiDPI fix
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.60@5282 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -351,13 +351,31 @@ void DiagramPrintDialog::browseFilePrintTypeDialog() {
|
|||||||
@param fit_page Booleen indiquant s'il faut adapter les schemas aux pages
|
@param fit_page Booleen indiquant s'il faut adapter les schemas aux pages
|
||||||
ou non
|
ou non
|
||||||
@param options Options de rendu
|
@param options Options de rendu
|
||||||
*/
|
*/
|
||||||
void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page, const ExportProperties options) {
|
void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page, const ExportProperties options) {
|
||||||
//qDebug() << "Demande d'impression de " << diagrams.count() << "schemas.";
|
//qDebug() << "Demande d'impression de " << diagrams.count() << "schemas.";
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||||
// QPainter utiliser pour effectuer le rendu
|
#ifdef Q_OS_WIN
|
||||||
QPainter qp(printer_);
|
#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
|
// cas special : il n'y a aucun schema a imprimer
|
||||||
if (!diagrams.count()) {
|
if (!diagrams.count()) {
|
||||||
qp.end();
|
qp.end();
|
||||||
|
|||||||
@@ -29,17 +29,13 @@ int main(int argc, char **argv)
|
|||||||
//Some setup, notably to use with QSetting.
|
//Some setup, notably to use with QSetting.
|
||||||
QCoreApplication::setOrganizationName("QElectroTech");
|
QCoreApplication::setOrganizationName("QElectroTech");
|
||||||
QCoreApplication::setOrganizationDomain("qelectrotech.org");
|
QCoreApplication::setOrganizationDomain("qelectrotech.org");
|
||||||
QCoreApplication::setApplicationName("QElectroTech");
|
QCoreApplication::setApplicationName("QElectroTech");
|
||||||
//Creation and execution of the application
|
//Creation and execution of the application
|
||||||
//HighDPI
|
//HighDPI
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 6, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||||
#if defined Q_OS_MAC
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
QApplication::setAttribute (Qt::AA_EnableHighDpiScaling);
|
#else
|
||||||
#elif !defined(Q_OS_MAC)
|
qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("auto"));
|
||||||
QApplication::setAttribute (Qt::AA_DisableHighDpiScaling);
|
#endif
|
||||||
#else
|
return(QETApp(argc, argv).exec());
|
||||||
qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("1"));
|
}
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
return(QETApp(argc, argv).exec());
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user