> Am 24.03.2015 um 15:46 schrieb Agocs Laszlo <laszlo.ag...@theqtcompany.com>:
>
> Because Qt 3D most likely misses a few multiplications by devicePixelRatio().
> Probably easy to correct.
>
> See
> http://www.qtdeveloperdays.com/sites/default/files/presentation_pdf/AgocsLaszlo_opengl_enablers_news.pdf#26
>
Hi Laszlo,
Thanks for the slides! They seem to contain the (partial) answer I was looking
for: how to get notified when the screen (and hence possibly the resolution)
changes.
For QWindow based applications the answer seems to be
http://doc.qt.io/qt-5/qwindow.html#screenChanged
For QWidget based applications however your slides suggest to "watch out for
[...] ScreenChangeInternal event for QWidget". I assume this is "for Qt
internal use only".
In fact I found a change (by you ;)) from about 6 months ago which seems to
introduce that "ScreenChangeInternal" event:
https://qt.gitorious.org/qt/qtbase/commit/49194275e02a9d6373767d6485bd8ebeeb0abba5
"Unlike ordinary widgets, the ones that have OpenGL framebuffers must know
about screen changes because the device pixel ratio may be different on the new
screen. Add an internal event, ScreenChangeInternal, as the counterpart to
WindowChangeInternal."
Is or will this event be exposed to the public QWidget API?
Again, I am not sure whether I need to care (on an application level) at all
about this use case (switch between monitors/screens with different
resolution), but I strongly assume so: I create QPixmaps as needed (using a
QPainter) and store them ("cache") in the corresponding QGrapicsPixmapItem. So
when the resolution changes I would re-create those QPixmaps with the desired
resolution.
Then again, if I was to draw the QPixmap myself, I would use a QIcon (with the
app attribute "Qt::AA_UseHighDpiPixmaps" enabled) to choose between the desired
QPixmaps, as in:
QRect destinationRect = ...
QIcon icon = ...
painter.drawPixmap(destinationRect, icon.pixmap(destinationRect.size()));
[http://blog.qt.io/blog/2013/04/25/retina-display-support-for-mac-os-ios-and-x11/]
But since the QGraphicsPixmapItem is doing the drawing for me, I probably
really need to get informed about resolution changes, and replace the pixmaps
in the QGraphicsViewItem myself as needed (unless I am overseeing some other,
simpler solution here). Or maybe if I would overwrite the
QGraphicsPixmapItem::paint() method and use something like the above code...
but that would almost defy the reason why I would use a QGraphicsPixmapItem in
the first place... (I could derive from QGraphicsItem then directly instead).
Any thoughts or ideas?
Thanks, Oliver
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest