mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-01 14:45:42 +08:00
First version of CRadarComponent
This commit is contained in:
committed by
Mat Sutcliffe
parent
e0d04e7b92
commit
4273eb4260
48
src/blackgui/views/radarview.cpp
Normal file
48
src/blackgui/views/radarview.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
/* Copyright (C) 2019
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "radarview.h"
|
||||
|
||||
#include <QResizeEvent>
|
||||
#include <QWheelEvent>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Views
|
||||
{
|
||||
CRadarView::CRadarView(QWidget *parent)
|
||||
: QGraphicsView(parent)
|
||||
{
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setBackgroundBrush(Qt::black);
|
||||
setRenderHint(QPainter::Antialiasing);
|
||||
}
|
||||
|
||||
void CRadarView::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
emit radarViewResized();
|
||||
QGraphicsView::resizeEvent(event);
|
||||
}
|
||||
|
||||
void CRadarView::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
QPoint delta = event->angleDelta();
|
||||
if (delta.y() > 0)
|
||||
{
|
||||
emit zoomEvent(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
emit zoomEvent(false);
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user