Daniel Bencik
Daniel Bencik

Reputation: 969

Qt drawing with Qt designer

I have tried to search on the internet and here as well, without success though. I am using Qt 4.8.2 and design my app in the Designer, then I write code in VS2010. I would like to show a chart on the application window, e.g. like http://www.infocaptor.com/user_help/help_img/dashboard_line_chart_screen.png , based on some data that are created by the app.

In the Widget Box of the Designer, I can't find any widget related to drawing. So I tried creating a QTextEdit and drawing on that using QPainter. However, this does not work. I can draw on the whole appwindow, but not just on the text edit. So the question is: what widget can be added onto the app window in the designer and that is going to allow me to draw on it using QPainter?

I'm eluded as the documentation says specifically that QPainter can draw on any QWidget which a QTextEdit is...

Any help is much appreciated, Daniel

Upvotes: 1

Views: 1472

Answers (1)

Herr von Wurst
Herr von Wurst

Reputation: 2621

The function of "drawing" is tooo complex/unspecific to be included as a specialized widget. You'll have to create it yourself and implement the desired drawing functions.

Here is an example which you can learn from, the scribblearea class could be pretty much what you are looking for. In that case you can copy it to your project and use in in the Qt-Designer by promoting a widget to this class.

Upvotes: 1

Related Questions