Qt 5.10 Book Examples
MouseObserver.h
Go to the documentation of this file.
1 // ======================================================================
2 // MouseObserver.h --
3 // ======================================================================
4 // This file is a part of the book
5 // "Qt 5.10 Professional programming with C++"
6 // http://qt-book.com
7 // ======================================================================
8 // Copyright (c) 2017 by Max Schlee
9 // ======================================================================
10 
11 #pragma once
12 
13 #include <QtWidgets>
14 
15 // ======================================================================
16 class MouseObserver : public QLabel {
17 public:
18  MouseObserver(QWidget* pwgt = 0);
19 
20 protected:
21  virtual void mousePressEvent (QMouseEvent* pe);
22  virtual void mouseReleaseEvent(QMouseEvent* pe);
23  virtual void mouseMoveEvent (QMouseEvent* pe);
24 
25  void dumpEvent (QMouseEvent* pe, const QString& strMessage);
26  QString modifiersInfo (QMouseEvent* pe );
27  QString buttonsInfo (QMouseEvent* pe );
28 };
29 
QString modifiersInfo(QMouseEvent *pe)
void dumpEvent(QMouseEvent *pe, const QString &strMessage)
virtual void mouseReleaseEvent(QMouseEvent *pe)
QString buttonsInfo(QMouseEvent *pe)
virtual void mouseMoveEvent(QMouseEvent *pe)
MouseObserver(QWidget *pwgt=0)
virtual void mousePressEvent(QMouseEvent *pe)