mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 19:50:05 +00:00
Add toolbox for radar display control
This commit is contained in:
parent
cd5d60bc0b
commit
7c606b85ff
8 changed files with 325 additions and 6 deletions
|
|
@ -2,6 +2,12 @@
|
|||
#include "./ui_main_window.h"
|
||||
|
||||
#include <scwx/qt/map/map_widget.hpp>
|
||||
#include <scwx/qt/ui/flow_layout.hpp>
|
||||
#include <scwx/common/products.hpp>
|
||||
|
||||
#include <QToolButton>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
|
|
@ -10,6 +16,8 @@ namespace qt
|
|||
namespace main
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "[scwx::qt::main::main_window] ";
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent) :
|
||||
QMainWindow(parent), ui(new Ui::MainWindow)
|
||||
{
|
||||
|
|
@ -20,6 +28,20 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||
settings.setCacheDatabaseMaximumSize(20 * 1024 * 1024);
|
||||
|
||||
ui->centralwidget->layout()->addWidget(new map::MapWidget(settings));
|
||||
|
||||
// Add Level2 Products
|
||||
QLayout* level2Layout = new ui::FlowLayout();
|
||||
ui->level2Products->setLayout(level2Layout);
|
||||
|
||||
for (common::Level2Product product : common::Level2ProductIterator())
|
||||
{
|
||||
QToolButton* toolButton = new QToolButton();
|
||||
toolButton->setText(
|
||||
QString::fromStdString(common::GetLevel2Name(product)));
|
||||
toolButton->setStatusTip(
|
||||
tr(common::GetLevel2Description(product).c_str()));
|
||||
level2Layout->addWidget(toolButton);
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
|
@ -27,6 +49,33 @@ MainWindow::~MainWindow()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::showEvent(QShowEvent* event)
|
||||
{
|
||||
QMainWindow::showEvent(event);
|
||||
|
||||
// Cycle through each item in the toolbox to render
|
||||
QToolBox* toolbox = ui->radarToolbox;
|
||||
int currentIndex = toolbox->currentIndex();
|
||||
for (int i = 0; i < toolbox->count(); i++)
|
||||
{
|
||||
toolbox->setCurrentIndex(i);
|
||||
}
|
||||
toolbox->setCurrentIndex(currentIndex);
|
||||
|
||||
// Set each level 2 product's tool button to the same size
|
||||
int level2MaxWidth = 0;
|
||||
for (QWidget* widget : ui->level2Products->findChildren<QWidget*>())
|
||||
{
|
||||
level2MaxWidth = std::max(level2MaxWidth, widget->width());
|
||||
}
|
||||
for (QWidget* widget : ui->level2Products->findChildren<QWidget*>())
|
||||
{
|
||||
widget->setMinimumWidth(level2MaxWidth);
|
||||
}
|
||||
|
||||
resizeDocks({ui->radarToolboxDock}, {150}, Qt::Horizontal);
|
||||
}
|
||||
|
||||
} // namespace main
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ public:
|
|||
MainWindow(QWidget* parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
void showEvent(QShowEvent* event) override;
|
||||
|
||||
private:
|
||||
Ui::MainWindow* ui;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,15 +6,15 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
<width>1024</width>
|
||||
<height>768</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
|
@ -34,12 +34,117 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<width>1024</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<widget class="QDockWidget" name="radarToolboxDock">
|
||||
<property name="windowTitle">
|
||||
<string>Toolbox</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>1</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="radarToolboxDockContents">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolBox" name="radarToolbox">
|
||||
<widget class="QWidget" name="radarSitesPage">
|
||||
<attribute name="label">
|
||||
<string>Radar Sites</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="radarSitesSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="radarProductsPage">
|
||||
<attribute name="label">
|
||||
<string>Radar Products</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="level2Products">
|
||||
<property name="title">
|
||||
<string>Level 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="radarProductsSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="productSettingsPage">
|
||||
<attribute name="label">
|
||||
<string>Product Settings</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="elevationSettings">
|
||||
<property name="title">
|
||||
<string>Elevation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="productSettingsSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue