GAMainWindow::GAMainWindow(){
scene = new MapScene();
view = new MapView(scene, this);
view->centerOn(1000, 1000);
connect(view, SIGNAL(changeFullScreen()), this, SLOT(changeFullScreen()));
connect(this,
SIGNAL(mouseMovedOutOfView
(QPoint)), view,
SLOT(mouseMovedOutOfWindow
(QPoint)));
layout->addWidget(view);
view->setMouseTracking(true);
view->grabMouse();
panel = new MapPanel();
layout->addWidget(panel);
widget->setLayout(layout);
setCentralWidget(widget);
connect(scene, SIGNAL(sendData(int)), panel, SLOT(showID(int)));
}
GAMainWindow::GAMainWindow(){
QHBoxLayout* layout = new QHBoxLayout();
scene = new MapScene();
view = new MapView(scene, this);
view->centerOn(1000, 1000);
connect(view, SIGNAL(changeFullScreen()), this, SLOT(changeFullScreen()));
connect(this, SIGNAL(mouseMovedOutOfView(QPoint)), view, SLOT(mouseMovedOutOfWindow(QPoint)));
layout->addWidget(view);
view->setMouseTracking(true);
view->grabMouse();
panel = new MapPanel();
layout->addWidget(panel);
connect(view, SIGNAL(mouseMoved(QPointF,QPointF)), panel, SLOT(newCoordinates(QPointF,QPointF)));
QWidget* widget = new QWidget();
widget->setLayout(layout);
setCentralWidget(widget);
connect(scene, SIGNAL(sendData(int)), panel, SLOT(showID(int)));
}
To copy to clipboard, switch view to plain text mode
void MapView
::keyPressEvent(QKeyEvent* event
){ switch (event->key()){
case Qt::Key_B:
this->grabMouse();
break;
}
}
void MapView::keyPressEvent(QKeyEvent* event){
switch (event->key()){
case Qt::Key_B:
this->grabMouse();
break;
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks