Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent clicking on HUD widgets from acting on the map #689

Merged
merged 1 commit into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions client/gui-qt/citydlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,11 @@ city_dialog::city_dialog(QWidget *parent) : QWidget(parent)
small_font = fcFont::instance()->getFont(fonts::notify_label);
ui.setupUi(this);

// Prevent mouse events from going through the panels to the main map
for (auto child : findChildren<QWidget *>()) {
child->setAttribute(Qt::WA_NoMousePropagation);
}

setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
setMouseTracking(true);
selected_row_p = -1;
Expand Down
7 changes: 7 additions & 0 deletions client/gui-qt/page_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,27 @@ pageGame::pageGame(QWidget *parent)
sidebar_wdg->addWidget(sw_endturn);

civ_status = new civstatus(mapview_wdg);
civ_status->setAttribute(Qt::WA_NoMousePropagation);
civ_status->show();

city_overlay = new city_dialog(mapview_wdg);
city_overlay->hide();
minimapview_wdg = new minimap_view(mapview_wdg);
minimapview_wdg->setAttribute(Qt::WA_NoMousePropagation);
minimapview_wdg->show();
unitinfo_wdg = new hud_units(mapview_wdg);
unitinfo_wdg->setAttribute(Qt::WA_NoMousePropagation);
battlelog_wdg = new hud_battle_log(mapview_wdg);
battlelog_wdg->setAttribute(Qt::WA_NoMousePropagation);
battlelog_wdg->hide();
infotab = new info_tab(mapview_wdg);
infotab->setAttribute(Qt::WA_NoMousePropagation);
infotab->show();
x_vote = new xvote(mapview_wdg);
x_vote->setAttribute(Qt::WA_NoMousePropagation);
x_vote->hide();
gtd = new goto_dialog(mapview_wdg);
gtd->setAttribute(Qt::WA_NoMousePropagation);
gtd->hide();

game_layout->addWidget(mapview_wdg, 1, 0);
Expand Down