How to invoke QBrush.setTexture() with QPixmap on QGraphicsRectItem?
-
- But the png cannot be redraw immediately only I move the cursor or focus the window.
That is the part i dont understand.
It should trigger paint()!?!- So, is it possible to show the png in the GraphicsRectItem?
Yes , same as with QGraphicsItem , but i be surprised if that alters anything.
When calling update() it should draw the png. Else there is a bug in the code. or something im not aware of.
You should looking to this. Using break points. etc.item->update() should trigger paint() , else i have no idea what is going on.
-
Do not confuse paintEvent with paint.
paintEvent is for Widgets
paint is for GraphicsItems -
Hi all,
Finally, I solved this problems.
@mrjj, as you mentioned that useitem->update()
WORKs.
My code is a little bit complex, all the item were originated from a template:
template <typename T, typename Event> class DeviceEventHandler : public Event, public QObject
At the beginning, I try to update the from the template, it doesn't work.
Then I move theupdate()
method in the all the subclass, then the pixmap can be updated automatically.
So, really thanks for your patience and kindly support.
Have a nice weekend.
PS: Be honest, I am newbie in Qt area and I got so kindly support. I really appreciate your kindness. :)
BRs
Kevin -
Hi all,
Finally, I solved this problems.
@mrjj, as you mentioned that useitem->update()
WORKs.
My code is a little bit complex, all the item were originated from a template:
template <typename T, typename Event> class DeviceEventHandler : public Event, public QObject
At the beginning, I try to update the from the template, it doesn't work.
Then I move theupdate()
method in the all the subclass, then the pixmap can be updated automatically.
So, really thanks for your patience and kindly support.
Have a nice weekend.
PS: Be honest, I am newbie in Qt area and I got so kindly support. I really appreciate your kindness. :)
BRs
KevinHi
You are most welcome. we do like Qt newbies here :)It was a bit odd with update() but good you found the solution.
Still not sure why it didn't trigger inside SetStatus :)
Good weekend to you too