QCustomPlot Discussion and Comments

How to plot a rectangularReturn to overview

Hello everyone,

I am a very beginner in qt, the problem I've got is that I cann't figure out how to draw a rectangular with 4 points using QCP. Moreover, these rectangular are perhaps overwrite each other, and I wish to give them with different colours.

Anyone has a solution for me, please? It's very difficult for me. I can not find an example in the guide.

Would anyone be kindly put all the code below and with a little explanation, please.

Thank you very much.


If you just want to draw rectangles, you don't need QCustomPlot. Just use QPainter (Qt has good QPainter tutorials in their documentation).

However, if you need the plot context with axes etc, have a look at QCPItemRect. Of course, you should look at the basic plotting and items tutorials first.

Thank you for your reply.
Yes, I know there are something that I missed.
I will check them out.