#include "outputwindow.h" #include #include OutputWindow::OutputWindow(QWindow* parent) : QWindow(parent) { m_fullScreenCursorTimer = new QTimer(this); m_fullScreenCursorTimer->setSingleShot(true); connect(m_fullScreenCursorTimer, &QTimer::timeout, [this]() { setCursor(Qt::BlankCursor); }); connect(this, SIGNAL(activeChanged()), this, SLOT(activeStateChanged())); } void OutputWindow::ShowFullScreenCursor() { m_fullScreenCursorTimer->start(2000); m_fullScreenCursorActive = true; setCursor(Qt::ArrowCursor); } void OutputWindow::DismissFullScreenCursor() { m_fullScreenCursorTimer->stop(); m_fullScreenCursorActive = false; setCursor(Qt::ArrowCursor); } void OutputWindow::keyPressEvent(QKeyEvent* ev) { emit keyDown(ev); } void OutputWindow::keyReleaseEvent(QKeyEvent* ev) { emit keyUp(ev); } void OutputWindow::exposeEvent(QExposeEvent* ev) { if(!ev->region().isNull()) { emit widthChanged(size().width()); } QWindow::exposeEvent(ev); } void OutputWindow::focusOutEvent(QFocusEvent* event) { emit focusOut(event); } void OutputWindow::focusInEvent(QFocusEvent* event) { emit focusIn(event); } void OutputWindow::activeStateChanged() { if(isActive()) { emit focusIn(new QFocusEvent(QEvent::FocusIn)); } else { emit focusOut(new QFocusEvent(QEvent::FocusOut)); } } void OutputWindow::mouseMoveEvent(QMouseEvent* ev) { if(m_fullScreenCursorActive) { ShowFullScreenCursor(); } onMouseMoveEvent(ev); } void OutputWindow::mouseDoubleClickEvent(QMouseEvent* ev) { emit doubleClick(ev); } void OutputWindow::mousePressEvent(QMouseEvent* ev) { onMousePressEvent(ev); } void OutputWindow::wheelEvent(QWheelEvent* ev) { onMouseWheelEvent(ev); }