diff --git a/src/ui/MainWindow.cpp b/src/ui/MainWindow.cpp index b19ff92..dcaf520 100644 --- a/src/ui/MainWindow.cpp +++ b/src/ui/MainWindow.cpp @@ -49,8 +49,8 @@ MainWindow::MainWindow(Simulation* sim, const std::string& configDir, m_sidePanel = new QWidget(this); QVBoxLayout* sideLayout = new QVBoxLayout(m_sidePanel); - sideLayout->setContentsMargins(0, 0, 0, 0); - sideLayout->setSpacing(0); + sideLayout->setContentsMargins(1, 1, 1, 1); + sideLayout->setSpacing(1); m_selectedBuildingPanel = new SelectedBuildingPanel(sim, &sim->config(), m_sidePanel); m_buildButtonGrid = new BuildButtonGrid(&sim->config(), m_sidePanel); @@ -60,6 +60,20 @@ MainWindow::MainWindow(Simulation* sim, const std::string& configDir, sideLayout->addWidget(m_buildButtonGrid, 1); sideLayout->addWidget(m_blueprintPanel, 1); + // Draw a thin border around each of the three side-panel sections. The class + // scoped selectors keep the border on the panels themselves rather than + // cascading onto their child widgets; WA_StyledBackground lets the plain + // QWidget subclasses honor the stylesheet box (border/background). + for (QWidget* panel : { static_cast(m_selectedBuildingPanel), + static_cast(m_buildButtonGrid), + static_cast(m_blueprintPanel) }) + { + panel->setAttribute(Qt::WA_StyledBackground, true); + } + m_sidePanel->setStyleSheet(QStringLiteral( + "SelectedBuildingPanel, BuildButtonGrid, BlueprintPanel {" + " border: 1px solid palette(mid); }")); + m_gameWorldView->setFocus(); connect(qApp, &QApplication::focusChanged, this, [this](QWidget*, QWidget* newWidget) {