mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 20:20:06 +00:00
Refining radar toolbox layout. Tool box is not a good use of the available space.
This commit is contained in:
parent
e76ac3bc36
commit
1aa9a9c0f0
4 changed files with 258 additions and 125 deletions
|
|
@ -25,7 +25,10 @@ class MainWindowImpl : public QObject
|
|||
|
||||
public:
|
||||
explicit MainWindowImpl(MainWindow* mainWindow) :
|
||||
mainWindow_ {mainWindow}, map_ {nullptr}, elevationCuts_ {}
|
||||
mainWindow_ {mainWindow},
|
||||
map_ {nullptr},
|
||||
elevationCuts_ {},
|
||||
resizeElevationButtons_ {false}
|
||||
{
|
||||
}
|
||||
~MainWindowImpl() = default;
|
||||
|
|
@ -38,6 +41,8 @@ public:
|
|||
map::MapWidget* map_;
|
||||
|
||||
std::vector<float> elevationCuts_;
|
||||
|
||||
bool resizeElevationButtons_;
|
||||
};
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent) :
|
||||
|
|
@ -57,7 +62,8 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||
|
||||
// Add Level 2 Products
|
||||
QLayout* level2Layout = new ui::FlowLayout();
|
||||
ui->level2Products->setLayout(level2Layout);
|
||||
level2Layout->setContentsMargins(0, 0, 0, 0);
|
||||
ui->level2ProductFrame->setLayout(level2Layout);
|
||||
|
||||
for (common::Level2Product product : common::Level2ProductIterator())
|
||||
{
|
||||
|
|
@ -74,7 +80,10 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||
}
|
||||
|
||||
QLayout* elevationLayout = new ui::FlowLayout();
|
||||
ui->elevationSettings->setLayout(elevationLayout);
|
||||
ui->elevationGroupBox->setLayout(elevationLayout);
|
||||
|
||||
ui->settingsGroupBox->setVisible(false);
|
||||
ui->declutterCheckbox->setVisible(false);
|
||||
|
||||
p->InitializeConnections();
|
||||
}
|
||||
|
|
@ -84,30 +93,63 @@ MainWindow::~MainWindow()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
bool MainWindow::event(QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::Type::Paint)
|
||||
{
|
||||
if (p->resizeElevationButtons_)
|
||||
{
|
||||
// Set each elevation cut's tool button to the same size
|
||||
int elevationCutMaxWidth = 0;
|
||||
for (QToolButton* widget :
|
||||
ui->elevationGroupBox->findChildren<QToolButton*>())
|
||||
{
|
||||
elevationCutMaxWidth =
|
||||
std::max(elevationCutMaxWidth, widget->width());
|
||||
}
|
||||
for (QToolButton* widget :
|
||||
ui->elevationGroupBox->findChildren<QToolButton*>())
|
||||
{
|
||||
widget->setMinimumWidth(elevationCutMaxWidth);
|
||||
}
|
||||
|
||||
p->resizeElevationButtons_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
return QMainWindow::event(event);
|
||||
}
|
||||
|
||||
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*>())
|
||||
for (QToolButton* widget :
|
||||
ui->level2ProductFrame->findChildren<QToolButton*>())
|
||||
{
|
||||
level2MaxWidth = std::max(level2MaxWidth, widget->width());
|
||||
}
|
||||
for (QWidget* widget : ui->level2Products->findChildren<QWidget*>())
|
||||
for (QToolButton* widget :
|
||||
ui->level2ProductFrame->findChildren<QToolButton*>())
|
||||
{
|
||||
widget->setMinimumWidth(level2MaxWidth);
|
||||
}
|
||||
|
||||
// Set each elevation cut's tool button to the same size
|
||||
int elevationCutMaxWidth = 0;
|
||||
for (QToolButton* widget :
|
||||
ui->elevationGroupBox->findChildren<QToolButton*>())
|
||||
{
|
||||
elevationCutMaxWidth = std::max(elevationCutMaxWidth, widget->width());
|
||||
}
|
||||
for (QToolButton* widget :
|
||||
ui->elevationGroupBox->findChildren<QToolButton*>())
|
||||
{
|
||||
widget->setMinimumWidth(elevationCutMaxWidth);
|
||||
}
|
||||
|
||||
resizeDocks({ui->radarToolboxDock}, {150}, Qt::Horizontal);
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +171,7 @@ void MainWindowImpl::SelectRadarProduct(common::Level2Product product)
|
|||
<< logPrefix_ << "Selecting Level 2 radar product: " << productName;
|
||||
|
||||
for (QToolButton* toolButton :
|
||||
mainWindow_->ui->level2Products->findChildren<QToolButton*>())
|
||||
mainWindow_->ui->level2ProductFrame->findChildren<QToolButton*>())
|
||||
{
|
||||
if (toolButton->text().toStdString() == productName)
|
||||
{
|
||||
|
|
@ -157,12 +199,12 @@ void MainWindowImpl::UpdateRadarProductSettings(map::MapWidget* mapWidget)
|
|||
}
|
||||
|
||||
for (QToolButton* toolButton :
|
||||
mainWindow_->ui->elevationSettings->findChildren<QToolButton*>())
|
||||
mainWindow_->ui->elevationGroupBox->findChildren<QToolButton*>())
|
||||
{
|
||||
delete toolButton;
|
||||
}
|
||||
|
||||
QLayout* layout = mainWindow_->ui->elevationSettings->layout();
|
||||
QLayout* layout = mainWindow_->ui->elevationGroupBox->layout();
|
||||
|
||||
// Create elevation cut tool buttons
|
||||
for (float elevationCut : elevationCuts)
|
||||
|
|
@ -177,26 +219,8 @@ void MainWindowImpl::UpdateRadarProductSettings(map::MapWidget* mapWidget)
|
|||
});
|
||||
}
|
||||
|
||||
// Update toolbox active item to render
|
||||
QToolBox* toolbox = mainWindow_->ui->radarToolbox;
|
||||
int currentIndex = toolbox->currentIndex();
|
||||
toolbox->setCurrentWidget(mainWindow_->ui->productSettingsPage);
|
||||
toolbox->setCurrentIndex(currentIndex);
|
||||
|
||||
// Set each elevation cut's tool button to the same size
|
||||
int elevationCutMaxWidth = 0;
|
||||
for (QToolButton* widget :
|
||||
mainWindow_->ui->elevationSettings->findChildren<QToolButton*>())
|
||||
{
|
||||
elevationCutMaxWidth = std::max(elevationCutMaxWidth, widget->width());
|
||||
}
|
||||
for (QToolButton* widget :
|
||||
mainWindow_->ui->elevationSettings->findChildren<QToolButton*>())
|
||||
{
|
||||
widget->setMinimumWidth(elevationCutMaxWidth);
|
||||
}
|
||||
|
||||
elevationCuts_ = elevationCuts;
|
||||
resizeElevationButtons_ = true;
|
||||
}
|
||||
|
||||
} // namespace main
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ public:
|
|||
MainWindow(QWidget* parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
bool event(QEvent* event) override;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -62,78 +62,160 @@
|
|||
<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>
|
||||
<widget class="QFrame" name="radarInfoFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0">
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="radarSiteSelectButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<width>16777215</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="radarLocationLabel">
|
||||
<property name="text">
|
||||
<string notr="true">St. Louis, MO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="vcpLabel">
|
||||
<property name="toolTip">
|
||||
<string>Volume Coverage Pattern</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>VCP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="radarSiteValueLabel">
|
||||
<property name="text">
|
||||
<string notr="true">KLSX</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="radarSiteLabel">
|
||||
<property name="text">
|
||||
<string>Radar Site</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QLabel" name="vcpDescriptionLabel">
|
||||
<property name="text">
|
||||
<string>Clear Air Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QLabel" name="vcpValueLabel">
|
||||
<property name="text">
|
||||
<string notr="true">35</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="radarProductsPage">
|
||||
<attribute name="label">
|
||||
<string>Radar Products</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="level2Products">
|
||||
<widget class="QGroupBox" name="radarProductGroupBox">
|
||||
<property name="title">
|
||||
<string>Radar Products</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="level2Label">
|
||||
<property name="text">
|
||||
<string>Level 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="radarProductsSpacer">
|
||||
<widget class="QWidget" name="level2ProductFrame" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="level2Separator">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="level3Label">
|
||||
<property name="text">
|
||||
<string>Level 3</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="level3ProductFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="productSettingsPage">
|
||||
<attribute name="label">
|
||||
<string>Product Settings</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="elevationSettings">
|
||||
<widget class="QGroupBox" name="elevationGroupBox">
|
||||
<property name="title">
|
||||
<string>Elevation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="productSettingsSpacer">
|
||||
<widget class="QGroupBox" name="settingsGroupBox">
|
||||
<property name="title">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="declutterCheckbox">
|
||||
<property name="text">
|
||||
<string>Declutter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="radarToolboxSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
|
|
@ -141,10 +223,6 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
|||
|
|
@ -14,27 +14,57 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="68"/>
|
||||
<source>Radar Sites</source>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="82"/>
|
||||
<source>...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="91"/>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="170"/>
|
||||
<source>Level 3</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="197"/>
|
||||
<source>Settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="203"/>
|
||||
<source>Declutter</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="113"/>
|
||||
<source>Radar Site</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="96"/>
|
||||
<source>Volume Coverage Pattern</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="99"/>
|
||||
<source>VCP</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="120"/>
|
||||
<source>Clear Air Mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="137"/>
|
||||
<source>Radar Products</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="97"/>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="143"/>
|
||||
<source>Level 2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="118"/>
|
||||
<source>Product Settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="124"/>
|
||||
<location filename="../source/scwx/qt/main/main_window.ui" line="190"/>
|
||||
<source>Elevation</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue