Exemplo n.º 1
0
void Tray::catchEvent(QEvent *e)
{
    if(e->type() == QEvent::Wheel) {
        if(((QWheelEvent*)e)->delta() > 0)
            Q_EMIT wheelUp();
        else
            Q_EMIT wheelDown();
    } else {
        e->accept();
    }
}
Exemplo n.º 2
0
void MplayerWindow::wheelEvent( QWheelEvent * e ) {

    e->accept();

	if (e->orientation() == Qt::Vertical) {
	    if (e->delta() >= 0)
	        emit wheelUp();
	    else
	        emit wheelDown();
	} else {
	}
}
Exemplo n.º 3
0
void TTimeSlider::wheelEvent(QWheelEvent* e) {

	e->accept();
	if (e->orientation() == Qt::Vertical) {
		if (e->delta() >= 0)
			emit wheelUp();
		else
			emit wheelDown();
	} else {
        logger()->debug("wheelEvent: ignoring horizontal wheel event");
	}
}
Exemplo n.º 4
0
void MplayerWindow::wheelEvent( QWheelEvent * e ) {
    qDebug("MplayerWindow::wheelEvent: delta: %d", e->delta());
    e->accept();

    if (e->orientation() == Qt::Vertical) {
        if (e->delta() >= 0)
            emit wheelUp();
        else
            emit wheelDown();
    } else {
        qDebug("MplayerWindow::wheelEvent: horizontal event received, doing nothing");
    }
}
Exemplo n.º 5
0
void BiomeView::wheelEvent(QWheelEvent * a_Event)
{
	m_MouseWheelDelta += a_Event->delta();
	while (m_MouseWheelDelta >= DELTA_STEP)
	{
		emit wheelUp();
		m_MouseWheelDelta -= DELTA_STEP;
	}
	while (m_MouseWheelDelta <= -DELTA_STEP)
	{
		emit wheelDown();
		m_MouseWheelDelta += DELTA_STEP;
	}
}
Exemplo n.º 6
0
void TimeSlider::wheelEvent(QWheelEvent * e) {
	//e->ignore();

	qDebug("TimeSlider::wheelEvent: delta: %d", e->delta());
	e->accept();

	if (e->orientation() == Qt::Vertical) {
	    if (e->delta() >= 0)
	        emit wheelUp();
	    else
	        emit wheelDown();
	} else {
		qDebug("Timeslider::wheelEvent: horizontal event received, doing nothing");
	}
}
Exemplo n.º 7
0
void QtRenderer::ConnectPlugin( UpWindSceneInterface* scene, QWidget* frame, CoreChartProvider* model ){
    CoreViewRenderer::ConnectPlugin(scene, frame, model);
    QGraphicsScene *graphicsScene = new QGraphicsScene;
    QRectF chartBoundaries = model->getChartBoundaries();
    n_chartGraphicsObject = new ChartGraphicsObject(frame->size());
    routeWidget = new RouteWidget(frame->size(),scene,chartBoundaries);
    boatWidget = new BoatWidget(frame->size(), scene, chartBoundaries);

    // Make sure the view gets mouse events for dragging
    n_chartGraphicsObject->setAcceptedMouseButtons(Qt::NoButton);
    // Set routepoints with right mouse buttons
    routeWidget->setAcceptedMouseButtons(Qt::RightButton);

    graphicsScene->addItem(n_chartGraphicsObject);
    graphicsScene->addItem(routeWidget);

    Boat *boat = new Boat(frame->size(), chartBoundaries);
    scene->setBoat(boat);

    graphicsScene->addItem(scene->getBoat()->getBoatImage());    // put boat image on screen.
    graphicsScene->addItem(scene->getBoat()->getBoatCompass());
    //graphicsScene->addItem(scene->getBoat()->getBoatGPS());
    graphicsScene->addItem(scene->getBoat()->getPortLayline());
    graphicsScene->addItem(scene->getBoat()->getStarBoardLayline());

    connect(scene->getBoat(), SIGNAL(boatPositionChanged()), this, SLOT(handleBoatPositionChanged()));

    boatWidget->setBoat(scene->getBoat());
    boatWidget->updateBoatPosition();

    view = new ChartView(graphicsScene, frame);
    connect(view, SIGNAL(wheelUp()), this, SLOT(zoomOut()));
    connect(view, SIGNAL(wheelDown()), this, SLOT(zoomIn()));
    view->setResizeAnchor(QGraphicsView::AnchorViewCenter);

    view->setGeometry(0, 0, frame->size().width(), frame->size().height());
    n_chartGraphicsObject->setModel(model);
    view->lower();
    view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view->setDragMode(QGraphicsView::ScrollHandDrag);
    view->setInteractive(true);
    view->setScene(graphicsScene);

    QPixmapCache::setCacheLimit(1024 * 320);
}
Exemplo n.º 8
0
MainWindow::MainWindow(QWidget * parent) :
	QMainWindow(parent),
	m_GeneratorSetup(nullptr),
	m_LineSeparator(nullptr),
	m_CurrentZoomLevel(2)
{
	initMinecraftPath();

	m_BiomeView = new BiomeView();
	connect(m_BiomeView, SIGNAL(increaseZoom()), this, SLOT(increaseZoom()));
	connect(m_BiomeView, SIGNAL(decreaseZoom()), this, SLOT(decreaseZoom()));
	connect(m_BiomeView, SIGNAL(wheelUp()),      this, SLOT(increaseZoom()));
	connect(m_BiomeView, SIGNAL(wheelDown()),    this, SLOT(decreaseZoom()));
	m_BiomeView->setZoomLevel(m_ViewZooms[m_CurrentZoomLevel]);

	m_StatusBar = new QStatusBar();
	this->setStatusBar(m_StatusBar);
	m_StatusBlockX = new QLabel(tr("X"));
	m_StatusBlockZ = new QLabel(tr("Z"));
	m_StatusBiome = new QLabel(tr("B"));
	m_StatusBar->addPermanentWidget(m_StatusBlockX);
	m_StatusBar->addPermanentWidget(m_StatusBlockZ);
	m_StatusBar->addPermanentWidget(m_StatusBiome);

	m_MainLayout = new QHBoxLayout();
	m_MainLayout->addWidget(m_BiomeView, 1);
	m_MainLayout->setMenuBar(menuBar());
	m_MainLayout->setMargin(0);
	QWidget * central = new QWidget();
	central->setLayout(m_MainLayout);
	setCentralWidget(central);

	createActions();
	createMenus();

	connect(m_BiomeView, SIGNAL(hoverChanged(int, int, int)), this, SLOT(hoverChanged(int, int, int)));
}