qTox
Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
src
widget
tool
movablewidget.h
Go to the documentation of this file.
1
/*
2
Copyright © 2015-2019 by The qTox Project Contributors
3
4
This file is part of qTox, a Qt-based graphical interface for Tox.
5
6
qTox is libre software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
qTox is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with qTox. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#pragma once
21
22
#include <QWidget>
23
24
class
MovableWidget
:
public
QWidget
25
{
26
public
:
27
explicit
MovableWidget
(QWidget* parent);
28
void
resetBoundary
(QRect newBoundary);
29
void
setBoundary
(QRect newBoundary);
30
float
getRatio
()
const
;
31
void
setRatio
(
float
r);
32
33
protected
:
34
void
mousePressEvent
(QMouseEvent* event);
35
void
mouseMoveEvent
(QMouseEvent* event);
36
void
mouseReleaseEvent
(QMouseEvent* event);
37
void
mouseDoubleClickEvent
(QMouseEvent* event);
38
39
private
:
40
void
checkBoundary
(QPoint& point)
const
;
41
void
checkBoundaryLeft
(
int
& x)
const
;
42
43
typedef
uint8_t
Modes
;
44
45
enum
Mode
:
Modes
46
{
47
Moving
= 0x01,
48
ResizeLeft
= 0x02,
49
ResizeRight
= 0x04,
50
ResizeUp
= 0x08,
51
ResizeDown
= 0x10,
52
Resize
=
ResizeLeft
|
ResizeRight
|
ResizeUp
|
ResizeDown
53
};
54
55
Modes
mode
= 0;
56
QPoint
lastPoint
;
57
QRect
boundaryRect
;
58
QSizeF
actualSize
;
59
QPointF
actualPos
;
60
float
ratio
;
61
};
MovableWidget::lastPoint
QPoint lastPoint
Definition:
movablewidget.h:56
MovableWidget::ResizeRight
@ ResizeRight
Definition:
movablewidget.h:49
MovableWidget::Resize
@ Resize
Definition:
movablewidget.h:52
MovableWidget::mouseDoubleClickEvent
void mouseDoubleClickEvent(QMouseEvent *event)
Definition:
movablewidget.cpp:237
MovableWidget::mode
Modes mode
Definition:
movablewidget.h:55
MovableWidget::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event)
Definition:
movablewidget.cpp:110
MovableWidget::actualPos
QPointF actualPos
Definition:
movablewidget.h:59
MovableWidget::ResizeUp
@ ResizeUp
Definition:
movablewidget.h:50
MovableWidget::Mode
Mode
Definition:
movablewidget.h:45
MovableWidget::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *event)
Definition:
movablewidget.cpp:231
MovableWidget
Definition:
movablewidget.h:24
MovableWidget::mousePressEvent
void mousePressEvent(QMouseEvent *event)
Definition:
movablewidget.cpp:100
MovableWidget::ResizeLeft
@ ResizeLeft
Definition:
movablewidget.h:48
MovableWidget::resetBoundary
void resetBoundary(QRect newBoundary)
Definition:
movablewidget.cpp:37
MovableWidget::MovableWidget
MovableWidget(QWidget *parent)
Definition:
movablewidget.cpp:25
MovableWidget::setRatio
void setRatio(float r)
Definition:
movablewidget.cpp:88
MovableWidget::ResizeDown
@ ResizeDown
Definition:
movablewidget.h:51
MovableWidget::getRatio
float getRatio() const
Definition:
movablewidget.cpp:83
MovableWidget::ratio
float ratio
Definition:
movablewidget.h:60
MovableWidget::Modes
uint8_t Modes
Definition:
movablewidget.h:43
MovableWidget::actualSize
QSizeF actualSize
Definition:
movablewidget.h:58
MovableWidget::setBoundary
void setBoundary(QRect newBoundary)
Definition:
movablewidget.cpp:48
MovableWidget::Moving
@ Moving
Definition:
movablewidget.h:47
MovableWidget::checkBoundaryLeft
void checkBoundaryLeft(int &x) const
MovableWidget::boundaryRect
QRect boundaryRect
Definition:
movablewidget.h:57
MovableWidget::checkBoundary
void checkBoundary(QPoint &point) const
Definition:
movablewidget.cpp:251
Generated by
1.8.17