diff --git a/mscore/exampleview.cpp b/mscore/exampleview.cpp index 8727b1be973e1..5d5a44d1f4d03 100644 --- a/mscore/exampleview.cpp +++ b/mscore/exampleview.cpp @@ -31,9 +31,10 @@ ExampleView::ExampleView(QWidget* parent) _score = 0; setAcceptDrops(true); setFocusPolicy(Qt::StrongFocus); - double mag = 1.0; - qreal _spatium = SPATIUM20; - _matrix = QTransform(mag, 0.0, 0.0, mag, _spatium, -_spatium * 6); + double mag = 0.9 * guiScaling * (DPI_DISPLAY / DPI); // 90% of nominal + qreal _spatium = SPATIUM20 * mag; + // example would normally be 10sp from top of page; this leaves 3sp margin above + _matrix = QTransform(mag, 0.0, 0.0, mag, _spatium, -_spatium * 7.0); imatrix = _matrix.inverted(); } @@ -336,9 +337,10 @@ void ExampleView::mousePressEvent(QMouseEvent* event) QSize ExampleView::sizeHint() const { - return QSize( - 1000 * guiScaling * (DPI / 90), - 80 * guiScaling * (DPI / 90)); + qreal mag = 0.9 * guiScaling * (DPI_DISPLAY / DPI); + qreal _spatium = SPATIUM20 * mag; + // staff is 4sp tall with 3sp margin above; this leaves 3sp margin below + return QSize(1000 * mag, _spatium * 10.0); } diff --git a/mscore/globals.h b/mscore/globals.h index 954b0ca9b7f8d..8d6bdb87e55a7 100644 --- a/mscore/globals.h +++ b/mscore/globals.h @@ -95,8 +95,9 @@ struct MidiRemote { extern const char* stateName(ScoreState); -static constexpr qreal DPMM_DISPLAY = 4; // 100 DPI -static constexpr qreal PALETTE_SPATIUM = 1.9 * DPMM_DISPLAY; +static constexpr qreal DPI_DISPLAY = 96.0; // 96 DPI nominal resolution +static constexpr qreal DPMM_DISPLAY = DPI_DISPLAY / 25.4; +static constexpr qreal PALETTE_SPATIUM = 1.764 * DPMM_DISPLAY; extern QPaintDevice* pdev; diff --git a/mscore/musescore.cpp b/mscore/musescore.cpp index acff936b16f3e..3dd47f6334dba 100644 --- a/mscore/musescore.cpp +++ b/mscore/musescore.cpp @@ -130,7 +130,7 @@ bool externalIcons = false; bool pluginMode = false; static bool startWithNewScore = false; double converterDpi = 0; -double guiScaling = 1.0; +double guiScaling = 0.0; int trimMargin = -1; bool noWebView = false; bool exportScoreParts = false; @@ -347,8 +347,22 @@ MuseScore::MuseScore() : QMainWindow() { QScreen* screen = QGuiApplication::primaryScreen(); +#if defined(Q_OS_WIN) + if (QSysInfo::WindowsVersion <= QSysInfo::WV_WINDOWS7) + _physicalDotsPerInch = screen->logicalDotsPerInch() * screen->devicePixelRatio(); + else + _physicalDotsPerInch = screen->physicalDotsPerInch(); // physical resolution +#else _physicalDotsPerInch = screen->physicalDotsPerInch(); // physical resolution - _physicalDotsPerInch *= guiScaling; +#endif + if (guiScaling == 0.0) { + // set scale for icons, palette elements, window sizes, etc + // the default values are hard coded in pixel sizes and assume ~96 DPI + if (qAbs(_physicalDotsPerInch - DPI_DISPLAY) > 6.0) + guiScaling = _physicalDotsPerInch / DPI_DISPLAY; + else + guiScaling = 1.0; + } _sstate = STATE_INIT; setWindowTitle(QString(MUSESCORE_NAME_VERSION)); diff --git a/mscore/note_groups.ui b/mscore/note_groups.ui index e00e385c79ea9..52fab55b747e0 100644 --- a/mscore/note_groups.ui +++ b/mscore/note_groups.ui @@ -47,7 +47,7 @@ - + 0 0 @@ -152,7 +152,7 @@ - + 0 0 @@ -238,7 +238,7 @@ - + 0 0