File indexing completed on 2024-05-12 15:27:35

0001 /***************************************************************************
0002     File                 : WorksheetElementContainerPrivate.h
0003     Project              : LabPlot
0004     Description          : Private members of WorksheetElementContainer.
0005     --------------------------------------------------------------------
0006     Copyright            : (C) 2009 Tilman Benkert (thzs@gmx.net)
0007     Copyright            : (C) 2012-2015 by Alexander Semke (alexander.semke@web.de)
0008 
0009  ***************************************************************************/
0010 
0011 /***************************************************************************
0012  *                                                                         *
0013  *  This program is free software; you can redistribute it and/or modify   *
0014  *  it under the terms of the GNU General Public License as published by   *
0015  *  the Free Software Foundation; either version 2 of the License, or      *
0016  *  (at your option) any later version.                                    *
0017  *                                                                         *
0018  *  This program is distributed in the hope that it will be useful,        *
0019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0021  *  GNU General Public License for more details.                           *
0022  *                                                                         *
0023  *   You should have received a copy of the GNU General Public License     *
0024  *   along with this program; if not, write to the Free Software           *
0025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0026  *   Boston, MA  02110-1301  USA                                           *
0027  *                                                                         *
0028  ***************************************************************************/
0029 
0030 #ifndef WORKSHEETELEMENTCONTAINERPRIVATE_H
0031 #define WORKSHEETELEMENTCONTAINERPRIVATE_H
0032 
0033 #include <QGraphicsItem>
0034 
0035 class QGraphicsSceneContextMenuEvent;
0036 class WorksheetElementContainer;
0037 
0038 class WorksheetElementContainerPrivate : public QGraphicsItem {
0039 
0040 public:
0041     explicit WorksheetElementContainerPrivate(WorksheetElementContainer*);
0042     ~WorksheetElementContainerPrivate() override= default;
0043 
0044     QString name() const;
0045     QRectF boundingRect() const override;
0046     void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget* widget = nullptr) override;
0047     void hoverEnterEvent(QGraphicsSceneHoverEvent*) override;
0048     void hoverLeaveEvent(QGraphicsSceneHoverEvent*) override;
0049 
0050     bool swapVisible(bool on);
0051     void prepareGeometryChangeRequested();
0052     void recalcShapeAndBoundingRect();
0053     void contextMenuEvent(QGraphicsSceneContextMenuEvent*) override;
0054 
0055     WorksheetElementContainer* q;
0056     QRectF boundingRectangle;
0057     QPainterPath containerShape;
0058     QRectF rect;
0059     bool m_hovered{false};
0060     bool m_printing{false};
0061 
0062 signals:
0063     void selectedChange(QGraphicsItem*);
0064 };
0065 
0066 #endif