File indexing completed on 2024-05-05 04:35:18

0001 /* This file is part of the TikZKit project.
0002  *
0003  * Copyright (C) 2013-2014 Dominik Haumann <dhaumann@kde.org>
0004  *
0005  * This library is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU Library General Public License as published
0007  * by the Free Software Foundation, either version 2 of the License, or
0008  * (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  * GNU Library General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Library General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, see
0017  * <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 #ifndef TIKZ_UI_ITEM_H
0021 #define TIKZ_UI_ITEM_H
0022 
0023 #include <QGraphicsObject>
0024 
0025 #include "tikzui_export.h"
0026 
0027 class TikzItemPrivate;
0028 
0029 class TIKZKITUI_EXPORT TikzItem : public QGraphicsObject
0030 {
0031     Q_OBJECT
0032 
0033     public:
0034         /**
0035          * Default constructor.
0036          */
0037         TikzItem(QGraphicsItem * parent = nullptr);
0038 
0039         /**
0040          * Destructor
0041          */
0042         virtual ~TikzItem();
0043 
0044         /**
0045          * Reimplment to return a proper UserType + 1.
0046          */
0047         int type() const override;
0048 
0049     //
0050     // Hovering
0051     //
0052     public:
0053         /**
0054          * Returns @p true, if the item is hovered.
0055          * This function uses contains() internally.
0056          * If the item isSelected(), isHovered() returns @p false.
0057          */
0058         bool isHovered() const;
0059 
0060     protected:
0061         void hoverEnterEvent(QGraphicsSceneHoverEvent * event) override;
0062         void hoverLeaveEvent(QGraphicsSceneHoverEvent * event) override;
0063 
0064     private:
0065         TikzItemPrivate * const d;
0066 };
0067 
0068 #endif // TIKZ_UI_ITEM_H
0069 
0070 // kate: indent-width 4; replace-tabs on;