hi,
du musst dein eigenes widget erstellen, das du dann von QWidget ( oder einer QWidgetsubclass ) ableitest:
class MyWidget : public QWidget {}
und in der klasse musst du die virtual funktion MousePressEvent reimplementieren.
Code:
void QWidget::mousePressEvent ( QMouseEvent * e ) [virtual protected]
This event handler, for event e, can be reimplemented in a subclass to receive mouse press events for the widget.
If you create new widgets in the mousePressEvent() the mouseReleaseEvent() may not end up where you expect, depending on the underlying window system (or X11 window manager), the widgets' location and maybe more.
The default implementation implements the closing of popup widgets when you click outside the window. For other widget types it does nothing.
See also mouseReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), event() and QMouseEvent.
Examples: biff/biff.cpp, drawlines/connect.cpp, iconview/simple_dd/main.cpp, life/life.cpp, qmag/qmag.cpp, scribble/scribble.cpp and tooltip/tooltip.cpp.
Reimplemented in QSizeGrip.
also:
void MyWidget::MousePressEvent( QMouseEvent * e ) {}
.... und da dann eben die states behandeln.
ciao tuxipuxi
( falls das net klar genug war kannst du ja mal im irc vorbeischauen ( siehe sig ) )
Lesezeichen