Skip to content
This repository has been archived by the owner on May 24, 2019. It is now read-only.

QGIS not running in HiDPI by default on Retina display #5

Closed
nextstopsun opened this issue Dec 7, 2016 · 23 comments
Closed

QGIS not running in HiDPI by default on Retina display #5

nextstopsun opened this issue Dec 7, 2016 · 23 comments

Comments

@nextstopsun
Copy link
Contributor

A good reason to try out qgis3-dev is to get HiDPI support on OS X. I guess that wasn't possible for QT4-based versions, but ok for Qt5.
Could be great to have QGIS built with HiDPI enabled by default on retina displays.
Or maybe this should it be a configuration checkbox.

Meanwhile, how do I enable it manually?

@dakcarto
Copy link
Member

dakcarto commented Dec 7, 2016

Hi @nextstopsun, thanks for bringing this up. You can try the following:

  1. Edit /usr/local/opt/qgis3-dev/QGIS.app/Contents/Info.plist
  2. Change NSHighResolutionCapable key to True, then save Info.plist
  3. Run touch /usr/local/opt/qgis3-dev/QGIS.app to ensure launch services is notified of plist change

Looks like the qgis3-dev formula needs updated here, since it sets that key to False.

Note: I don't see any major changes here when I do that (this is a good thing). Also, the low resolution icon is due to a missing high-res one for Mac, not due to incompatible NSHighResolutionCapable settings.

@dakcarto
Copy link
Member

dakcarto commented Dec 7, 2016

If you change NSHighResolutionCapable as noted above, the Finder's Info dialog for the QGIS.app will now display the "Open in Low Resolution" checkbox, which should be unchecked by default.

@nextstopsun
Copy link
Contributor Author

@dakcarto Thanks. I'll try that. I'm mostly interested in getting map canvas display in HiDPI.
BTW, are missing menu icons related to this one, or it's a separate issue?

@dakcarto
Copy link
Member

dakcarto commented Dec 7, 2016

BTW, are missing menu icons related to this one, or it's a separate issue?

Separate issue, I think, possibly related to packaging and whether they are SVG or PNG. Haven't looked into it yet. Also here for me, the Options menu is replaced by the one from Processing. I'll work on fixing that upstream ASAP.

@nextstopsun
Copy link
Contributor Author

According to window elements, qgis started in HiDPI mode, however map canvas seems to be in low res still. @dakcarto Are you getting this also?

@dakcarto
Copy link
Member

dakcarto commented Dec 7, 2016

According to window elements, qgis started in HiDPI mode, however map canvas seems to be in low res still. @dakcarto Are you getting this also?

Sorry, don't have any more time right now to test. It may be that something in code has to be changed to fully enable HiDPI.

@m-kuhn
Copy link
Member

m-kuhn commented Dec 7, 2016

Can you try to insert the following code in src/gui/qgsmapcanvas.cpp at line 585 (after mSettings.setExpressionContext( expressionContext );

mSettings.setOutputDpi( logicalDpiX() );

@dakcarto
Copy link
Member

dakcarto commented Dec 8, 2016

If looking to edit QGIS source during a build of qgis3-dev, one will need to:

  1. Edit the formula and put a raise statement just prior to the run of cmake ...
  2. Build with brew install qgis3-dev -dv (or at least -d)
  3. When raise is thrown, drop into a debug shell, edit the file, then exit debug shell
  4. Choose to 'ignore' thrown raise, which will continue building

This is because any changes to ~/Library/Caches/Homebrew/qgis3-dev--git/* will probably be reset prior to building QGIS inside the formula.

...
==> Checking out branch master
git checkout -f master --
Already on 'master'
Your branch is behind 'origin/master' by 119 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
git reset --hard origin/master <-- !!!
...

Alternatively, @nextstopsun, you could use the dependencies to do your own build.

@nextstopsun
Copy link
Contributor Author

@dakcarto I have all the deps installed, I think I'm going to setup QT Creator build. On a second thought, what if I just clone master and edit the formula to build from a local repo?

@dakcarto
Copy link
Member

dakcarto commented Dec 8, 2016

On a second thought, what if I just clone master and edit the formula to build from a local repo?

@nextstopsun that should work, though I recommend adding a revision 1 just under version "2.99" and then use brew upgrade -dv qgis3-dev, so you do not loose your current build. Later, you can just brew uninstall qgis3-dev to clear the most recent, edited build.

Qt Creator setup is better and will be added soon to the tutorial.

@m-kuhn
Copy link
Member

m-kuhn commented Dec 8, 2016

If anyone can test this patch, that would be much appreciated.

qgis/QGIS#3847

@brncsk
Copy link

brncsk commented Dec 8, 2016

@m-kuhn No changes for me: UI chrome shows up in high res when NSHighResolutionCapable is set, but the map canvas is still rendering pixelated.

@m-kuhn
Copy link
Member

m-kuhn commented Dec 8, 2016

@brncsk any chance you could find the value reported by logicalDpiX() - either with a debugger or temporarily add

qWarning() << "Logical DPI X " << logicalDpiX();

@brncsk
Copy link

brncsk commented Dec 8, 2016 via email

@brncsk
Copy link

brncsk commented Dec 8, 2016

@m-kuhn:

logicalDpiX() reports 72.
physicalDpiX() reports 111, though, which yields a somewhat better, albeit still suboptimal result.

I also tried multiplying that by devicePixelRatio() == 2 but it still feels a bit rough.

@brncsk
Copy link

brncsk commented Dec 8, 2016

In fact, increasing the argument of setOutputDpi() only seems to increase outline width (given in millimeters) and label font size (given in pts) but does not help with the rendering problem itself.

Screenshots at different setOutputDpi() resolutions:

72 (logicalDpiX()):
72

111 (physicalDpiX()):
111

222 (physicalDpiX() * devicePixelRatio()):
222

444 (physicalDpiX() * devicePixelRatio() * 2):
444

@m-kuhn
Copy link
Member

m-kuhn commented Dec 9, 2016

In fact, increasing the argument of setOutputDpi() only seems to increase outline width

Correct, that's exactly what needs to be done in the rendering engine - but each pixel of the screen should be used (I guess now there are 4 equal pixels sitting next to each other on your map).

There's an issue in Qt with QGraphicsView and HiDpi: https://bugreports.qt.io/browse/QTBUG-26795 but it looks like caching is not explicitly enabled and defaults to disabled and I don't think we use the GL version, so this shouldn't affect us.

@dakcarto
Copy link
Member

Hi. Can someone retest the rendering issue with latest qgis3-dev, which now fully builds against Qt 5.8.0? See known issues in #22.

Fixed with Qt 5.8.0: SVG menu icons now show properly (sweet!).

Also, I have updated the dock and app switcher icon to 1024x1024.

@brncsk
Copy link

brncsk commented Mar 16, 2017

It does not seem to fix the rendering issue, output is still pixellated. The 1024x1024 icon is a nice touch, though!

@Malauch
Copy link

Malauch commented Nov 8, 2017

I just want to report, that problem with pixelated output on canvas is still here. In addition plugin description (in plugin manager window) is oversized.
zrzut ekranu 2017-11-08 o 09 46 26
zrzut ekranu 2017-11-08 o 09 04 48

@dakcarto
Copy link
Member

dakcarto commented Nov 8, 2017

Hi. I am closing this as it is an issue to be discussed on the main QGIS issue tracker:
https://issues.qgis.org

I believe I have done what can be via the Homebrew formula and something more needs addressed in the core codebase.

@dakcarto dakcarto closed this as completed Nov 8, 2017
@dakcarto
Copy link
Member

dakcarto commented Nov 8, 2017

This is the only current issue of similar topic I could find:
https://issues.qgis.org/issues/15357

@dakcarto
Copy link
Member

dakcarto commented Nov 8, 2017

I also created a saved query on the tracker for "Subjects with dpi":
https://issues.qgis.org/projects/qgis/issues?query_id=145

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants