yes we need to have QMainWindow functionality there. please a small snippet of code i have done to get some thick boarders where am i going wrong.
yes we need to have QMainWindow functionality there. please a small snippet of code i have done to get some thick boarders where am i going wrong.
Painting using a QPainter on a QWidget can only take place in a QWidget::paintEvent().
J-P Nurmi
Hi,Thanks for the info.
please find the implementation.
though i am able to get various colours., my purpose still is not done,.
please find attached my code and snapshot of what i got and what i need to obtain.
I still have problems understanding what is the goal. How do you want it to look like?
Maybe you could simply use a QFrame as the central widget of the QMainWindow? QFrame has various properties to adjust the look and feel of the frame. You can change the color of the frame by using style sheets or QPalette.
J-P Nurmi
Hi,
please find the image attached that contains the part of my window i need to paint.
is it so tricky to do and beyonds the capabilities of Qt.
Qt Code:
pen.setWidth(10); pen.setColor(Qt::red); p.setPen(pen); p.drawRect(rect()); }To copy to clipboard, switch view to plain text mode
Doesn't this work?
Thank you very much!
It worked only in the interior of wndow. i actually want the frame to be drawn. the frame which holds the windows.
Also how to draw the frame in different colours. please see the out put that i have obtained with your code, Wysota.
the painted red rectangle is now movable with the window. but any mouse event is repainting the window and the red rectangle is disappearing. how to over come this?
Oh, you mean the window decoration? That's not possible, the window manager handles that. You can only turn off the decoration and draw one yourself, but it's quite hard and doesn't really give satisfactory results.
Did you reimplement any of the mouse events?the painted red rectangle is now movable with the window. but any mouse event is repainting the window and the red rectangle is disappearing. how to over come this?
Sorry for the delay in response Wysota, i am on vacation.
First of all thank you :-)
I have not re implemented the mouse event.
shall i have to do that.
No, but something is causing the rectangle to disappear. Could you prepare a minimal compilable example reproducing the problem?
Bookmarks