2019-09-12 15:11:52 -04:00
|
|
|
#include "outputwindow.h"
|
|
|
|
#include <QResizeEvent>
|
2020-11-13 17:00:58 -05:00
|
|
|
#include <QTimer>
|
2019-09-12 15:11:52 -04:00
|
|
|
|
|
|
|
OutputWindow::OutputWindow(QWindow* parent)
|
|
|
|
: QWindow(parent)
|
|
|
|
{
|
2020-11-13 17:00:58 -05:00
|
|
|
m_fullScreenCursorTimer = new QTimer(this);
|
|
|
|
m_fullScreenCursorTimer->setSingleShot(true);
|
|
|
|
connect(m_fullScreenCursorTimer, &QTimer::timeout, [this]() { setCursor(Qt::BlankCursor); });
|
2019-09-12 15:11:52 -04:00
|
|
|
connect(this, SIGNAL(activeChanged()), this, SLOT(activeStateChanged()));
|
|
|
|
}
|
|
|
|
|
2020-11-13 17:00:58 -05:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2019-09-12 15:11:52 -04:00
|
|
|
void OutputWindow::keyPressEvent(QKeyEvent* ev)
|
|
|
|
{
|
|
|
|
emit keyDown(ev);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OutputWindow::keyReleaseEvent(QKeyEvent* ev)
|
|
|
|
{
|
|
|
|
emit keyUp(ev);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OutputWindow::exposeEvent(QExposeEvent* ev)
|
|
|
|
{
|
2020-01-31 18:31:34 -05:00
|
|
|
if(!ev->region().isNull())
|
|
|
|
{
|
|
|
|
emit widthChanged(size().width());
|
|
|
|
}
|
2019-09-12 15:11:52 -04:00
|
|
|
QWindow::exposeEvent(ev);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OutputWindow::focusOutEvent(QFocusEvent* event)
|
|
|
|
{
|
|
|
|
emit focusOut(event);
|
|
|
|
}
|
2023-03-01 20:15:27 -05:00
|
|
|
|
2019-09-12 15:11:52 -04:00
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-13 17:00:58 -05:00
|
|
|
void OutputWindow::mouseMoveEvent(QMouseEvent* ev)
|
|
|
|
{
|
|
|
|
if(m_fullScreenCursorActive)
|
|
|
|
{
|
|
|
|
ShowFullScreenCursor();
|
|
|
|
}
|
2023-03-01 20:15:27 -05:00
|
|
|
emit mouseMove(ev);
|
2020-11-13 17:00:58 -05:00
|
|
|
}
|
|
|
|
|
2023-04-20 19:03:13 -04:00
|
|
|
void OutputWindow::mousePressEvent(QMouseEvent* ev)
|
2019-09-12 15:11:52 -04:00
|
|
|
{
|
2023-04-20 19:03:13 -04:00
|
|
|
emit mousePress(ev);
|
2019-09-12 15:11:52 -04:00
|
|
|
}
|
2020-02-02 19:21:22 +00:00
|
|
|
|
2023-04-20 19:03:13 -04:00
|
|
|
void OutputWindow::mouseReleaseEvent(QMouseEvent* ev)
|
2020-02-02 19:21:22 +00:00
|
|
|
{
|
2023-04-20 19:03:13 -04:00
|
|
|
emit mouseRelease(ev);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OutputWindow::mouseDoubleClickEvent(QMouseEvent* ev)
|
|
|
|
{
|
|
|
|
emit doubleClick(ev);
|
2020-02-02 19:21:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OutputWindow::wheelEvent(QWheelEvent* ev)
|
|
|
|
{
|
2023-03-01 20:15:27 -05:00
|
|
|
emit mouseWheel(ev);
|
2020-02-02 19:21:22 +00:00
|
|
|
}
|