Can't those widgets draw themselves?
Can't those widgets draw themselves?
No I cannot. if i draw next custom widget , then previous custom widget ll disappear.
I can draw without Style option. But Widget still doesnt get the focus. Is there any way to get the focus???
Last edited by navi1084; 29th September 2008 at 07:52.
drawing focus:
jacek is right, all widgets have to draw own content by itself.Qt Code:
{ .... if (hasFocus()) { painter.save(); QStyleOptionFocusRect option; option.initFrom(this); painter.restore(); } .... }To copy to clipboard, switch view to plain text mode
Thank you for the reply.
I have came across my problem. Actually my widget is meant for rectangles. i.e in parent widget we can draw transparent rectangle widgets which is rectangle in shape of certain colors. when i draw first rect then all the parent widget area is occupied by this and get the focus. When i draw one more rect widget then this rect get focus and previous rect loses its focus. since the rect widgets are transparent all the rect widget can be showned.
I have handled mouseEvent to rect widgets. But when i add a new rect widget mouseEvent comes only for this widget. Other rect widgets will loses its focus(mouseEvents).
So is there any way to make all the widget gets mouseEvent.
(Actually curser should change when the mouse hovers to perticular rect widget)
Bookmarks