mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Enable Qt::AA_EnableHighDpiScaling and fix print bug, thanks Gabberworld for this patch.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5242 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -1,26 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
||||||
|
|
||||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity
|
|
||||||
type="win32"
|
|
||||||
name="Microsoft.Windows.Common-Controls"
|
|
||||||
version="6.0.0.0" processorArchitecture="*"
|
|
||||||
publicKeyToken="6595b64144ccf1df"
|
|
||||||
language="*">
|
|
||||||
</assemblyIdentity>
|
|
||||||
</dependentAssembly>
|
|
||||||
</dependency>
|
|
||||||
<asmv3:application>
|
|
||||||
<asmv3:windowsSettings>
|
|
||||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
|
|
||||||
<!-- fallback for Windows 7 and 8 -->
|
|
||||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness>
|
|
||||||
<!-- falls back to per-monitor if per-monitor v2 is not supported -->
|
|
||||||
<gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">true</gdiScaling>
|
|
||||||
<!-- enables GDI DPI scaling -->
|
|
||||||
</asmv3:windowsSettings>
|
|
||||||
</asmv3:application>
|
|
||||||
</assembly>
|
|
||||||
@@ -31,7 +31,7 @@ win32 {
|
|||||||
QET_LANG_PATH = 'lang/'
|
QET_LANG_PATH = 'lang/'
|
||||||
QET_LICENSE_PATH = './'
|
QET_LICENSE_PATH = './'
|
||||||
# Liste des ressources Windows
|
# Liste des ressources Windows
|
||||||
RC_FILE = qelectrotech.rc
|
#RC_FILE = qelectrotech.rc
|
||||||
}
|
}
|
||||||
macx {
|
macx {
|
||||||
# Chemins MacOS X
|
# Chemins MacOS X
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
#include <windows.h>
|
|
||||||
|
|
||||||
ID_ICON1 ICON DISCARDABLE "ico/windows_icon/qelectrotech.ico"
|
|
||||||
1 RT_MANIFEST "qelectrotech.exe.manifest"
|
|
||||||
@@ -354,7 +354,25 @@ void DiagramPrintDialog::browseFilePrintTypeDialog() {
|
|||||||
*/
|
*/
|
||||||
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)
|
||||||
|
#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 utiliser pour effectuer le rendu
|
||||||
QPainter qp(printer_);
|
QPainter qp(printer_);
|
||||||
|
|
||||||
|
|||||||
@@ -32,14 +32,10 @@ int main(int argc, char **argv)
|
|||||||
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);
|
|
||||||
#elif !defined(Q_OS_MAC)
|
|
||||||
QApplication::setAttribute (Qt::AA_DisableHighDpiScaling);
|
|
||||||
#else
|
#else
|
||||||
qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("1"));
|
qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("auto"));
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
return(QETApp(argc, argv).exec());
|
return(QETApp(argc, argv).exec());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user