#include <QWidget>class MapView;class CreatePolyLineTool : public QWidget{ Q_OBJECTprotected: void paintEvent(QPaintEvent* ev); bool eventFilter(QObject *obj, QEvent *ev);public: CreatePolyLineTool(QWidget* parent);};
#include "CreatePolyLineTool.h"#include <QPainter>CreatePolyLineTool::CreatePolyLineTool(QWidget*parent) : QWidget(parent){ resize(parent->size()); parent->installEventFilter(this);}void CreatePolyLineTool::paintEvent(QPaintEvent* ev){ QPainter painter(this);//Рисуем, что хотим// painter.drawPolyline(_polygon);}bool CreatePolyLineTool::eventFilter(QObject* obj, QEvent* ev){ if(obj==parentWidget() && ev->type()==QEvent::Resize) resize(parentWidget()->size()); return false;}
void CreatePolyLineTool::wheelEvent ( QWheelEvent * event ) { event->ignore();}