-
Notifications
You must be signed in to change notification settings - Fork 4
/
itemimage.h
73 lines (59 loc) · 1.74 KB
/
itemimage.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef ITEMIMAGE_H
#define ITEMIMAGE_H
#include <QImage>
#include <QFrame>
#include <QMutexLocker>
#include <QMap>
#include <QUrl>
#include "tibiaresource.h"
class QDropEvent;
class QDragEnterEvent;
class QDragLeaveEvent;
class QDragMoveEvent;
class QPaintEvent;
class QDropEvent;
class ItemImage : public QFrame
{
Q_OBJECT
public:
ItemImage( QWidget *parent );
ItemImage( QWidget *parent, const QImage& img );
ItemImage( const QImage& img = QImage() );
~ItemImage( void );
void setMimeDropType( const QString& type );
const QString& getMimeDropType( void ) const;
void setColor( const QColor& color );
const QImage *image( void ) const;
const QImage getImage( void );
void clear( void );
signals:
void imageChanged( const QImage& );
void droppedSprite( SharedResource&, quint8, quint8 ); // Sprite resource dropped | #Rect dropped onto
void droppedFile( const QString& );
public slots:
void setImage( const QImage& );
void showNumbers( bool );
void setAcceptFiles( bool );
private:
void drawGradientRectangle( QPainter& painter, QRect& rect, QColor baseColor );
void updatePieces( void );
void clearRectangles( void );
void clearContents( void );
mutable QMutex mutex;
protected:
virtual void dragEnterEvent( QDragEnterEvent * );
virtual void dragLeaveEvent( QDragLeaveEvent * );
virtual void dragMoveEvent( QDragMoveEvent * );
virtual void dropEvent( QDropEvent * );
virtual void paintEvent( QPaintEvent * );
QFont m_font;
QColor m_color;
QRect m_highlighted;
QMap<QPoint *, QRect> m_pieces;
QVector<QRect> m_indexes;
QString m_droptype;
bool m_shownumbers;
bool m_acceptFiles;
QImage *m_image;
};
#endif // ITEMIMAGE_H