mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 18:40:05 +00:00
Fix resizing of toolbar buttons
This commit is contained in:
parent
055bdecd33
commit
1655a7c571
2 changed files with 44 additions and 31 deletions
|
|
@ -48,6 +48,8 @@ public:
|
||||||
|
|
||||||
void ConfigureMapLayout();
|
void ConfigureMapLayout();
|
||||||
void HandleFocusChange(QWidget* focused);
|
void HandleFocusChange(QWidget* focused);
|
||||||
|
void NormalizeElevationButtons();
|
||||||
|
void NormalizeLevel2ProductButtons();
|
||||||
void SelectElevation(map::MapWidget* mapWidget, float elevation);
|
void SelectElevation(map::MapWidget* mapWidget, float elevation);
|
||||||
void SelectRadarProduct(map::MapWidget* mapWidget,
|
void SelectRadarProduct(map::MapWidget* mapWidget,
|
||||||
common::Level2Product product);
|
common::Level2Product product);
|
||||||
|
|
@ -143,21 +145,7 @@ bool MainWindow::event(QEvent* event)
|
||||||
}
|
}
|
||||||
else if (p->resizeElevationButtons_)
|
else if (p->resizeElevationButtons_)
|
||||||
{
|
{
|
||||||
// Set each elevation cut's tool button to the same size
|
p->NormalizeElevationButtons();
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,33 +156,58 @@ void MainWindow::showEvent(QShowEvent* event)
|
||||||
{
|
{
|
||||||
QMainWindow::showEvent(event);
|
QMainWindow::showEvent(event);
|
||||||
|
|
||||||
|
p->NormalizeLevel2ProductButtons();
|
||||||
|
p->NormalizeElevationButtons();
|
||||||
|
|
||||||
|
resizeDocks({ui->radarToolboxDock}, {150}, Qt::Horizontal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindowImpl::NormalizeLevel2ProductButtons()
|
||||||
|
{
|
||||||
// Set each level 2 product's tool button to the same size
|
// Set each level 2 product's tool button to the same size
|
||||||
int level2MaxWidth = 0;
|
int level2MaxWidth = 0;
|
||||||
for (QToolButton* widget :
|
for (QToolButton* widget :
|
||||||
ui->level2ProductFrame->findChildren<QToolButton*>())
|
mainWindow_->ui->level2ProductFrame->findChildren<QToolButton*>())
|
||||||
{
|
{
|
||||||
level2MaxWidth = std::max(level2MaxWidth, widget->width());
|
if (widget->isVisible())
|
||||||
}
|
{
|
||||||
for (QToolButton* widget :
|
level2MaxWidth = std::max(level2MaxWidth, widget->width());
|
||||||
ui->level2ProductFrame->findChildren<QToolButton*>())
|
}
|
||||||
{
|
|
||||||
widget->setMinimumWidth(level2MaxWidth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (level2MaxWidth > 0)
|
||||||
|
{
|
||||||
|
for (QToolButton* widget :
|
||||||
|
mainWindow_->ui->level2ProductFrame->findChildren<QToolButton*>())
|
||||||
|
{
|
||||||
|
widget->setMinimumWidth(level2MaxWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindowImpl::NormalizeElevationButtons()
|
||||||
|
{
|
||||||
// Set each elevation cut's tool button to the same size
|
// Set each elevation cut's tool button to the same size
|
||||||
int elevationCutMaxWidth = 0;
|
int elevationCutMaxWidth = 0;
|
||||||
for (QToolButton* widget :
|
for (QToolButton* widget :
|
||||||
ui->elevationGroupBox->findChildren<QToolButton*>())
|
mainWindow_->ui->elevationGroupBox->findChildren<QToolButton*>())
|
||||||
{
|
{
|
||||||
elevationCutMaxWidth = std::max(elevationCutMaxWidth, widget->width());
|
if (widget->isVisible())
|
||||||
}
|
{
|
||||||
for (QToolButton* widget :
|
elevationCutMaxWidth = std::max(elevationCutMaxWidth, widget->width());
|
||||||
ui->elevationGroupBox->findChildren<QToolButton*>())
|
}
|
||||||
{
|
|
||||||
widget->setMinimumWidth(elevationCutMaxWidth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeDocks({ui->radarToolboxDock}, {150}, Qt::Horizontal);
|
if (elevationCutMaxWidth > 0)
|
||||||
|
{
|
||||||
|
for (QToolButton* widget :
|
||||||
|
mainWindow_->ui->elevationGroupBox->findChildren<QToolButton*>())
|
||||||
|
{
|
||||||
|
widget->setMinimumWidth(elevationCutMaxWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
resizeElevationButtons_ = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionOpen_triggered()
|
void MainWindow::on_actionOpen_triggered()
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@
|
||||||
<context>
|
<context>
|
||||||
<name>scwx::qt::main::MainWindow</name>
|
<name>scwx::qt::main::MainWindow</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../source/scwx/qt/main/main_window.cpp" line="252"/>
|
<location filename="../source/scwx/qt/main/main_window.cpp" line="265"/>
|
||||||
<source>Unrecognized NEXRAD Product:</source>
|
<source>Unrecognized NEXRAD Product:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue