fix gui scaling regressions for high DPI displays
This commit is contained in:
parent
77e980d95d
commit
2ff95d58f0
3 changed files with 16 additions and 9 deletions
|
@ -31,8 +31,8 @@ ExampleView::ExampleView(QWidget* parent)
|
|||
_score = 0;
|
||||
setAcceptDrops(true);
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
double mag = 1.0;
|
||||
qreal _spatium = SPATIUM20;
|
||||
double mag = guiScaling * (DPI_DISPLAY / DPI); // default is same as scoreview
|
||||
qreal _spatium = SPATIUM20 * mag;
|
||||
_matrix = QTransform(mag, 0.0, 0.0, mag, _spatium, -_spatium * 6);
|
||||
imatrix = _matrix.inverted();
|
||||
}
|
||||
|
@ -336,9 +336,8 @@ void ExampleView::mousePressEvent(QMouseEvent* event)
|
|||
|
||||
QSize ExampleView::sizeHint() const
|
||||
{
|
||||
return QSize(
|
||||
1000 * guiScaling * (DPI / 90),
|
||||
80 * guiScaling * (DPI / 90));
|
||||
qreal mag = guiScaling * (DPI_DISPLAY / DPI); // same as example itself
|
||||
return QSize(1000 * mag, 80 * mag);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
@ -348,7 +348,14 @@ MuseScore::MuseScore()
|
|||
{
|
||||
QScreen* screen = QGuiApplication::primaryScreen();
|
||||
_physicalDotsPerInch = screen->physicalDotsPerInch(); // physical resolution
|
||||
_physicalDotsPerInch *= guiScaling;
|
||||
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));
|
||||
|
|
Loading…
Reference in a new issue