Thanks for reply Luc!
Any thoughs on whether using QGraphicsTextItem would be preferable to
modifying the paint() of ImageItem?

Kuba

On Wed, Dec 20, 2017 at 7:01 AM, Luke Campagnola <[email protected]>
wrote:

> In the past I have used QGraphicsTextItem with a monospace font for
> displaying grids of characters.
> That should yield good performance, depending on the size of your image.
>
> On Fri, Dec 15, 2017 at 7:33 AM, Kuba Raczkowski <[email protected]
> > wrote:
>
>> Ok, well, managed to do it based on https://stackoverflow.com/q
>> uestions/4763992/finding-out-what-portion-of-a-qgraphicsitem
>> -is-visible-in-a-qgraphicsview#
>>
>> FYI, this gives a visible rectangle inside an imageitem, in its
>> coordinates:
>>
>>             view = self.getViewBox().getViewWidget()
>>             portRect = view.viewport().rect()
>>             sceneRect = view.mapToScene(portRect).boundingRect()
>>             itemRect = self.mapRectFromScene(sceneRect)
>>             isec = itemRect.intersected(self.boundingRect())
>>
>>
>> Kuba
>>
>> On Friday, December 15, 2017 at 4:10:09 PM UTC+1, Kuba Raczkowski wrote:
>>>
>>> Hi,
>>>
>>> I'm trying to annotate the ImageItem's pixels by a textual value on top
>>> of every pixel.
>>> Got it working by extending the paint() and adding necessary drawText()
>>> calls, however, the performance is (obviously?) terrible.
>>>
>>> This is only meant to be useful when zooming in deeply - that I can
>>> treshold by figuring out pixelSize() of ImageItem.
>>>
>>> However, all labels seem to be painted even if only a few pixels are
>>> visible in the view.
>>> Any idea how to figure out the pixels (or a rectangle) that are actually
>>> visible in the view? I'm getting lost in all the coordinate mappings :/
>>>
>>>
>>> Best regards,
>>> Kuba
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pyqtgraph" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/pyqtgraph/8a620fae-e972-4761-89da-25bf2490d095%40googlegroups.com
>> <https://groups.google.com/d/msgid/pyqtgraph/8a620fae-e972-4761-89da-25bf2490d095%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "pyqtgraph" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/pyqtgraph/vR8t4JAlhVA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/pyqtgraph/CACZXET9QCrUQEnNWE_c5nksYBug2OQ_vcdKUnr8t%
> 3D7aVQsr7SA%40mail.gmail.com
> <https://groups.google.com/d/msgid/pyqtgraph/CACZXET9QCrUQEnNWE_c5nksYBug2OQ_vcdKUnr8t%3D7aVQsr7SA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/CAFFUSEOBZS_vFBF%2BRE7ijdUvhoQ_z8PnD22dTnFHxHZfobu0NQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to