Reputation: 591
I want to create a program like MS Paint using the Qt Framework and I was wondering how to connect the "clicked" signal, that is activated every time the user click the program window in the client area. Something like WM_LBUTTONDOWN in Win32 API.
Upvotes: 1
Views: 294
Reputation: 45715
There is no clicked()
signal in QWidget.
You have to subclass QWidget and reimplement mousePressEvent(QMouseEvent *event);
which will give you the coordinates (in the widget's coordinate system) via event->pos();
or event->x();
and event->y();
after including the header: #include <QMouseEvent>
.
You might be interested in the Scribble Example.
Upvotes: 3