Hi Hamza,

I think there is some confusion between the Graphics View framework (which
handles the use of QGraphicsItems, which is ~98% of where pyqtgraph
operates in), and QtWidgets, which are the more generic UI components.  You
can embed a graphics view within a QtWidget (that's how we get plots in
windows), but there is no way*  to put a QWidget within a Graphics View
(not technically true, there is QGraphcisProxyWidget, but you want no part
of that as it will kill any performance).

If you're using a GraphicsLayoutWidget, and are looking to display text
within the plot, you want to be using a TextItem (which is a
QGraphicsItem).  LabelItem is a QWidget, which I believe is used as a
helper object for ParameterTrees.

In addition to the crosshair example that Martin linked, there is also
the InfiniteLine
example
<https://github.com/pyqtgraph/pyqtgraph/blob/master/examples/InfiniteLine.py>
which
likely has some similar behavior to what you're looking for.


On Mon, May 3, 2021 at 2:12 PM Hamza Khan <[email protected]>
wrote:

> Hi,
> In the example of crosshair.py Window is created using
> GraphicsLayoutWidget which support LabelItem.
> In my code i used QVBoxLayout, wo don't know how to implement cross hair
> in my code.
> If you can you help i will be very thankful to you
> Thanks
>
> On Tue, May 4, 2021, 2:06 AM Martin Chase <[email protected]> wrote:
>
>> Hamza,
>>
>> Have a look at the mouse interaction example:
>> https://github.com/pyqtgraph/pyqtgraph/blob/master/examples/crosshair.py
>>
>> Does that get you what you need?
>>
>> Good luck,
>>  - Martin @outofculture he/him
>>
>> --
>> 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/CAD_p8v1eZmpXhqOL%2B7nNHr_TLn0_KZbEAzQhh%3DJw0P_k0Oab-A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/pyqtgraph/CAD_p8v1eZmpXhqOL%2B7nNHr_TLn0_KZbEAzQhh%3DJw0P_k0Oab-A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CAJgAyZS%2B-YpSUVepBtHMncqqZa55MVd-kC0M_i5SmesSa8CSdQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/pyqtgraph/CAJgAyZS%2B-YpSUVepBtHMncqqZa55MVd-kC0M_i5SmesSa8CSdQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CA%2BnduTG37pGq4TNza%2Bj0_0z1%2BwmGSCQ2MfhPVew5M_wvDOnwng%40mail.gmail.com.

Reply via email to