File indexing completed on 2024-05-12 13:04:45
0001 /* 0002 * This file is part of the KDE project 0003 * 0004 * SPDX-FileCopyrightText: 2013 Dan Leinir Turthra Jensen <admin@leinir.dk> 0005 * 0006 * SPDX-License-Identifier: LGPL-2.0-or-later 0007 * 0008 */ 0009 0010 #ifndef CQLINKAREA_H 0011 #define CQLINKAREA_H 0012 0013 #include <QDeclarativeItem> 0014 0015 class CQLinkArea : public QDeclarativeItem 0016 { 0017 Q_OBJECT 0018 Q_PROPERTY(QVariantList links READ links WRITE setLinks NOTIFY linksChanged) 0019 Q_PROPERTY(QSizeF sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged) 0020 Q_PROPERTY(QColor linkColor READ linkColor WRITE setLinkColor NOTIFY linkColorChanged) 0021 0022 public: 0023 explicit CQLinkArea(QDeclarativeItem* parent = 0); 0024 virtual ~CQLinkArea(); 0025 virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget* ); 0026 0027 QVariantList links() const; 0028 void setLinks(const QVariantList& newLinks); 0029 0030 QSizeF sourceSize() const; 0031 void setSourceSize( const QSizeF& size ); 0032 0033 QColor linkColor() const; 0034 void setLinkColor( const QColor& color ); 0035 0036 Q_SIGNALS: 0037 void linksChanged(); 0038 void clicked(); 0039 void doubleClicked(); 0040 void linkClicked(QUrl linkTarget); 0041 void sourceSizeChanged(); 0042 void linkColorChanged(); 0043 0044 protected: 0045 virtual void mousePressEvent(QGraphicsSceneMouseEvent* event); 0046 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event); 0047 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event); 0048 0049 private: 0050 class Private; 0051 Private* const d; 0052 }; 0053 0054 #endif // CQLINKAREA_H