Viewport::Viewport(View &parent) :
QWidget(&parent),
- _view(parent),
+ _view(parent),
_mouse_down_valid(false),
_pinch_zoom_active(false)
{
bool Viewport::event(QEvent *event)
{
- switch(event->type()) {
+ switch (event->type()) {
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
{
assert(event);
- if (event->button() == Qt::LeftButton)
- {
+ if (event->button() == Qt::LeftButton) {
_mouse_down_point = event->pos();
_mouse_down_offset = _view.offset();
_mouse_down_valid = true;
assert(event);
if (event->button() == Qt::LeftButton)
- {
_mouse_down_valid = false;
- }
}
void Viewport::mouseMoveEvent(QMouseEvent *event)
{
assert(event);
- if (event->buttons() & Qt::LeftButton)
- {
- if (! _mouse_down_valid) {
+ if (event->buttons() & Qt::LeftButton) {
+ if (!_mouse_down_valid) {
_mouse_down_point = event->pos();
_mouse_down_offset = _view.offset();
_mouse_down_valid = true;