2017-04-27 18:26:36 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2014-01-14 16:59:24 +00:00
|
|
|
#ifndef DIVEPIXMAPITEM_H
|
|
|
|
#define DIVEPIXMAPITEM_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QGraphicsPixmapItem>
|
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
class DivePixmapItem : public QObject, public QGraphicsPixmapItem {
|
2014-01-14 16:59:24 +00:00
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(qreal opacity WRITE setOpacity READ opacity)
|
|
|
|
Q_PROPERTY(QPointF pos WRITE setPos READ pos)
|
|
|
|
Q_PROPERTY(qreal x WRITE setX READ x)
|
|
|
|
Q_PROPERTY(qreal y WRITE setY READ y)
|
|
|
|
public:
|
2014-02-28 04:09:57 +00:00
|
|
|
DivePixmapItem(QObject *parent = 0);
|
2014-01-14 16:59:24 +00:00
|
|
|
};
|
|
|
|
|
2014-06-08 15:43:04 +00:00
|
|
|
class DivePictureItem : public DivePixmapItem {
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(qreal scale WRITE setScale READ scale)
|
|
|
|
public:
|
2014-07-30 01:13:14 +00:00
|
|
|
DivePictureItem(QObject *parent = 0);
|
2014-08-06 21:05:54 +00:00
|
|
|
virtual ~DivePictureItem();
|
2014-06-08 15:43:04 +00:00
|
|
|
void setPixmap(const QPixmap& pix);
|
2014-07-11 00:15:20 +00:00
|
|
|
public slots:
|
|
|
|
void settingsChanged();
|
2014-07-30 00:56:45 +00:00
|
|
|
void removePicture();
|
2014-07-30 01:13:14 +00:00
|
|
|
void setFileUrl(const QString& s);
|
2014-06-08 15:43:04 +00:00
|
|
|
protected:
|
|
|
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
|
|
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
2014-06-27 21:00:42 +00:00
|
|
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
private:
|
2014-07-30 01:13:14 +00:00
|
|
|
QString fileUrl;
|
2015-01-16 20:12:02 +00:00
|
|
|
QGraphicsRectItem *canvas;
|
|
|
|
QGraphicsRectItem *shadow;
|
2014-06-08 15:43:04 +00:00
|
|
|
};
|
|
|
|
|
2014-07-30 00:56:45 +00:00
|
|
|
class DiveButtonItem : public DivePixmapItem {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
DiveButtonItem(QObject *parent = 0);
|
|
|
|
protected:
|
|
|
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
signals:
|
|
|
|
void clicked();
|
|
|
|
};
|
|
|
|
|
|
|
|
class CloseButtonItem : public DiveButtonItem {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
CloseButtonItem(QObject *parent = 0);
|
|
|
|
public slots:
|
|
|
|
void hide();
|
|
|
|
void show();
|
|
|
|
};
|
|
|
|
|
2014-02-11 18:14:46 +00:00
|
|
|
#endif // DIVEPIXMAPITEM_H
|