-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResizeHandler.h
More file actions
49 lines (37 loc) · 1.15 KB
/
ResizeHandler.h
File metadata and controls
49 lines (37 loc) · 1.15 KB
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
#pragma once
#include <array>
#include <QMouseEvent>
#include <QGraphicsItem>
#include "ResizeMode.h"
namespace sgv
{
class ResizeHandler: public QObject
{
Q_OBJECT
public:
ResizeHandler(class SignalerGraphicsView& a_view);
void mousePressEvent (const QMouseEvent* a_event);
void mouseMoveEvent (const QMouseEvent* a_event);
void mouseReleaseEvent(const QMouseEvent* a_event);
void setAreaSize(int a_size);
void setMinimumWidth (int a_width);
void setMinimumHeight(int a_height);
void setModes(sgv::ResizeMode a_mode);
bool isResizing() const;
private:
QRect resizeArea(const QGraphicsItem* a_item, sgv::ResizeMode a_mode) const;
class SignalerGraphicsView& m_view;
// Options
static constexpr int DefaultAreaSize = 3;
int m_area_size = DefaultAreaSize;
int m_minimum_item_width = 1;
int m_minimum_item_height = 1;
sgv::ResizeMode m_possible_resize_modes = sgv::All;
// Resizing process
sgv::ResizeMode m_current_mode = sgv::None;
bool m_processing = false;
QPointF m_pivot;
QList<QGraphicsItem*> m_items;
QList<QRectF> m_initial_sizes;
};
}