Showing the changes to interface/src/MainWindow.cpp (1 of 8 files). Show all
Unified · Split
| @@ -4,6 +4,10 @@ · 3 unmodified lines | |||
| 4 | // | 4 | // |
| 5 | // Created by Mohammed Nafees on 04/06/2014. | 5 | // Created by Mohammed Nafees on 04/06/2014. |
| 6 | // Copyright (c) 2014 High Fidelity, Inc. All rights reserved. | 6 | // Copyright (c) 2014 High Fidelity, Inc. All rights reserved. |
| 7 | // | ||
| 8 | // Distributed under the Apache License, Version 2.0. | ||
| 9 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | ||
| 10 | // | ||
| 7 | 11 | ||
| 8 | #include "MainWindow.h" | 12 | #include "MainWindow.h" |
| 9 | 13 | ||
| @@ -14,56 +18,50 @@ · 4 unmodified lines | |||
| 14 | #include <QHideEvent> | 18 | #include <QHideEvent> |
| 15 | #include <QWindowStateChangeEvent> | 19 | #include <QWindowStateChangeEvent> |
| 16 | 20 | ||
| 17 | MainWindow::MainWindow(QWidget *parent) : | 21 | MainWindow::MainWindow(QWidget* parent) : |
| 18 | QMainWindow(parent) | 22 | QMainWindow(parent) { |
| 19 | { | ||
| 20 | } | 23 | } |
| 21 | 24 | ||
| 22 | void MainWindow::moveEvent(QMoveEvent *e) | 25 | void MainWindow::moveEvent(QMoveEvent* event) { |
| 23 | { | 26 | emit windowGeometryChanged(QRect(event->pos(), size())); |
| 24 | emit windowGeometryChanged(QRect(e->pos(), size())); | 27 | QMainWindow::moveEvent(event); |
| 25 | QMainWindow::moveEvent(e); | ||
| 26 | } | 28 | } |
| 27 | 29 | ||
| 28 | void MainWindow::resizeEvent(QResizeEvent *e) | 30 | void MainWindow::resizeEvent(QResizeEvent* event) { |
| 29 | { | 31 | emit windowGeometryChanged(QRect(QPoint(x(), y()), event->size())); |
| 30 | emit windowGeometryChanged(QRect(QPoint(x(), y()), e->size())); | 32 | QMainWindow::resizeEvent(event); |
| 31 | QMainWindow::resizeEvent(e); | ||
| 32 | } | 33 | } |
| 33 | 34 | ||
| 34 | void MainWindow::showEvent(QShowEvent *e) | 35 | void MainWindow::showEvent(QShowEvent* event) { |
| 35 | { | 36 | if (event->spontaneous()) { |
| 36 | if (e->spontaneous()) { | ||
| 37 | emit windowShown(true); | 37 | emit windowShown(true); |
| 38 | } | 38 | } |
| 39 | QMainWindow::showEvent(e); | 39 | QMainWindow::showEvent(event); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | void MainWindow::hideEvent(QHideEvent *e) | 42 | void MainWindow::hideEvent(QHideEvent* event) { |
| 43 | { | 43 | if (event->spontaneous()) { |
| 44 | if (e->spontaneous()) { | ||
| 45 | emit windowShown(false); | 44 | emit windowShown(false); |
| 46 | } | 45 | } |
| 47 | QMainWindow::hideEvent(e); | 46 | QMainWindow::hideEvent(event); |
| 48 | } | 47 | } |
| 49 | 48 | ||
| 50 | void MainWindow::changeEvent(QEvent *e) | 49 | void MainWindow::changeEvent(QEvent* event) { |
| 51 | { | 50 | if (event->type() == QEvent::WindowStateChange) { |
| 52 | if (e->type() == QEvent::WindowStateChange) { | 51 | QWindowStateChangeEvent* stateChangeEvent = static_cast<QWindowStateChangeEvent*>(event); |
| 53 | QWindowStateChangeEvent *event = static_cast<QWindowStateChangeEvent*>(e); | 52 | if ((stateChangeEvent->oldState() == Qt::WindowNoState || |
| 54 | if ((event->oldState() == Qt::WindowNoState || | 53 | stateChangeEvent->oldState() == Qt::WindowMaximized) && |
| 55 | event->oldState() == Qt::WindowMaximized) && | ||
| 56 | windowState() == Qt::WindowMinimized) { | 54 | windowState() == Qt::WindowMinimized) { |
| 57 | emit windowShown(false); | 55 | emit windowShown(false); |
| 58 | } else { | 56 | } else { |
| 59 | emit windowShown(true); | 57 | emit windowShown(true); |
| 60 | } | 58 | } |
| 61 | } else if (e->type() == QEvent::ActivationChange) { | 59 | } else if (event->type() == QEvent::ActivationChange) { |
| 62 | if (isActiveWindow()) { | 60 | if (isActiveWindow()) { |
| 63 | emit windowShown(true); | 61 | emit windowShown(true); |
| 64 | } else { | 62 | } else { |
| 65 | emit windowShown(false); | 63 | emit windowShown(false); |
| 66 | } | 64 | } |
| 67 | } | 65 | } |
| 68 | QMainWindow::changeEvent(e); | 66 | QMainWindow::changeEvent(event); |
| 69 | } | 67 | } |