/* * Copyright (C) 2021 CutefishOS Team. * * Author: revenmartin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef RUBBERBAND_H #define RUBBERBAND_H #include class RubberBand : public QQuickPaintedItem { Q_OBJECT Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) public: explicit RubberBand(QQuickItem *parent = nullptr); ~RubberBand() override; void paint(QPainter *painter) override; Q_INVOKABLE bool intersects(const QRectF &rect) const; QColor color() const; void setColor(QColor color); signals: void colorChanged(); protected: void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; private: QRectF m_geometry; QColor m_color; }; #endif