mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
By default show controls on output on if it is hovered by mouse
This commit is contained in:
@@ -27,7 +27,8 @@ namespace mmp {
|
||||
OutputGLCanvas::OutputGLCanvas(MainWindow* mainWindow, QWidget* parent, const QGLWidget* shareWidget, QGraphicsScene* scene)
|
||||
: MapperGLCanvas(mainWindow, true, parent, shareWidget, scene),
|
||||
_displayCrosshair(false),
|
||||
_displayTestSignal(false)
|
||||
_displayTestSignal(false),
|
||||
_windowIsHovered(false)
|
||||
{
|
||||
// Disable scrollbars.
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
@@ -68,7 +69,7 @@ void OutputGLCanvas::drawForeground(QPainter *painter , const QRectF &rect)
|
||||
painter->restore();
|
||||
glPopMatrix();
|
||||
}
|
||||
else
|
||||
else if (MainWindow::window()->displayControls() && _windowIsHovered)
|
||||
{
|
||||
MapperGLCanvas::drawForeground(painter, rect);
|
||||
|
||||
@@ -107,6 +108,18 @@ void OutputGLCanvas::drawForeground(QPainter *painter , const QRectF &rect)
|
||||
|
||||
}
|
||||
|
||||
void OutputGLCanvas::enterEvent(QEvent *event)
|
||||
{
|
||||
_windowIsHovered = true;
|
||||
QGraphicsView::enterEvent(event);
|
||||
}
|
||||
|
||||
void OutputGLCanvas::leaveEvent(QEvent *event)
|
||||
{
|
||||
_windowIsHovered = false;
|
||||
QGraphicsView::leaveEvent(event);
|
||||
}
|
||||
|
||||
void OutputGLCanvas::_drawClassicTestSignal(QPainter* painter)
|
||||
{
|
||||
const QRect& geo = geometry();
|
||||
|
||||
@@ -62,6 +62,7 @@ private:
|
||||
QBrush _brush_test_signal;
|
||||
QImage _palTestCard;
|
||||
QImage _ntscTestCard;
|
||||
bool _windowIsHovered;
|
||||
|
||||
protected:
|
||||
// overriden from QGlWidget:
|
||||
@@ -69,6 +70,8 @@ protected:
|
||||
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void enterEvent(QEvent * event);
|
||||
void leaveEvent(QEvent *event);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user