Qt: Only hide cursor if the display is the top widget

This commit is contained in:
Jeffrey Pfau 2015-07-13 22:09:20 -07:00
parent f50f98416b
commit b3cf9ec162
1 changed files with 4 additions and 1 deletions

View File

@ -129,7 +129,9 @@ Window::Window(ConfigController* config, int playerId, QWidget* parent)
connect(this, SIGNAL(fpsTargetChanged(float)), m_controller, SLOT(setFPSTarget(float))); connect(this, SIGNAL(fpsTargetChanged(float)), m_controller, SLOT(setFPSTarget(float)));
connect(&m_fpsTimer, SIGNAL(timeout()), this, SLOT(showFPS())); connect(&m_fpsTimer, SIGNAL(timeout()), this, SLOT(showFPS()));
connect(m_display, &Display::hideCursor, [this]() { connect(m_display, &Display::hideCursor, [this]() {
setCursor(Qt::BlankCursor); if (static_cast<QStackedLayout*>(m_screenWidget->layout())->currentWidget() == m_display) {
setCursor(Qt::BlankCursor);
}
}); });
connect(m_display, &Display::showCursor, [this]() { connect(m_display, &Display::showCursor, [this]() {
unsetCursor(); unsetCursor();
@ -1122,6 +1124,7 @@ void Window::setupMenu(QMenuBar* menubar) {
void Window::attachWidget(QWidget* widget) { void Window::attachWidget(QWidget* widget) {
m_screenWidget->layout()->addWidget(widget); m_screenWidget->layout()->addWidget(widget);
unsetCursor();
static_cast<QStackedLayout*>(m_screenWidget->layout())->setCurrentWidget(widget); static_cast<QStackedLayout*>(m_screenWidget->layout())->setCurrentWidget(widget);
} }