By default show controls on output on if it is hovered by mouse

This commit is contained in:
baydam
2018-04-07 20:50:46 +00:00
parent 1563bbf53f
commit c19f97629f
2 changed files with 18 additions and 2 deletions
+15 -2
View File
@@ -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();
+3
View File
@@ -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);
};
}