How parent object affect painting to child object?
-
How about you start out with a call to <code>QWidget::paintEvent(event);</code> between your lines 2 and 3? Replace the QWidget with whatever is the base class of your widget. That way, the base class also gets a chance to do painting.
-
[quote author="Andre" date="1325150742"]How about you start out with a call to <code>QWidget::paintEvent(event);</code> between your lines 2 and 3? Replace the QWidget with whatever is the base class of your widget. That way, the base class also gets a chance to do painting. [/quote]
I have tried this also but same problem persists. Do you have mac system? If you have i will post you the sample code so that you can check.
-
No, I do not have a mac.
-
[quote author="Andre" date="1325158806"]No, I do not have a mac.[/quote]
now the problem is little bit solved. I was using Qmainwindow as a child of other QMainwindow. So the problem was coming. Now i have replaced child window with Qmdisubwindow so the painting problem is now solved. Does it is necessary to keep Qmdisubwindow in Qmdiarea or we can use it independently?Now only one problem is there the focus rect which i have drawn for button is not appearing in mac. I am using Qstyleoption for that does i have to write different style for mac or there would be some other problem? This is the code which i am using for drawing rect
@
QStyleOptionFocusRect option;
if (this->hasFocus ()) {// Draw the focus frame for the widget having focus. this->style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter, this); }@
-
Is there a reason you are not using QWidget instead of QMainWindow or QMdiSubWindow if you are using it as a widget anyway? These classes are not mend to be used as normal widgets.
I know nothing of the styles on mac, so I cannot guide you there.
-
An MDI subwindow is meant to be used in an MDI area. There's no gain to use it outside. And a main window as child of something else is pure nonsense. As is every window - those are toplevel by design.
Why do you paint yourself at all? What is wrong with the default provided widgets?
-
[quote author="Andre" date="1325162997"]Is there a reason you are not using QWidget instead of QMainWindow or QMdiSubWindow if you are using it as a widget anyway? These classes are not mend to be used as normal widgets.
I know nothing of the styles on mac, so I cannot guide you there. [/quote]
I want to make generic window which may appear inside another window or as pop up window according to provided option. I was not using QWidget because in case of pop up window i want dockable property which i can found only on QMainwindow
-
[quote author="Volker" date="1325183040"]An MDI subwindow is meant to be used in an MDI area. There's no gain to use it outside. And a main window as child of something else is pure nonsense. As is every window - those are toplevel by design.
Why do you paint yourself at all? What is wrong with the default provided widgets?[/quote]
I have painted myself because this is the requirement provided to me. -
[quote author="pratik041" date="1325220949"]
[quote author="Volker" date="1325183040"]
Why do you paint yourself at all? What is wrong with the default provided widgets?[/quote]
I have painted myself because this is the requirement provided to me.
[/quote]And did you try to achieve your goal using standard widgets without painting yourself?
-
[quote author="Volker" date="1325243008"]
[quote author="pratik041" date="1325220949"]
[quote author="Volker" date="1325183040"]
Why do you paint yourself at all? What is wrong with the default provided widgets?[/quote]
I have painted myself because this is the requirement provided to me.
[/quote]And did you try to achieve your goal using standard widgets without painting yourself?[/quote]
I am now getting proper output with both painting and without it also.