Corrected insight window sizing bug

This commit is contained in:
Nav
2021-12-27 04:10:25 +00:00
parent 5f77093c80
commit d7c6fd191f
2 changed files with 22 additions and 21 deletions

View File

@@ -207,6 +207,7 @@ void InsightWindow::resizeEvent(QResizeEvent* event) {
void InsightWindow::showEvent(QShowEvent* event) { void InsightWindow::showEvent(QShowEvent* event) {
this->adjustPanels(); this->adjustPanels();
this->adjustMinimumSize();
} }
bool InsightWindow::isVariantSupported(const TargetVariant& variant) { bool InsightWindow::isVariantSupported(const TargetVariant& variant) {
@@ -437,12 +438,8 @@ void InsightWindow::selectVariant(const TargetVariant* variant) {
}); });
} }
this->setMinimumSize(
this->targetPackageWidget->width() + 800,
this->targetPackageWidget->height() + 150
);
this->adjustPanels(); this->adjustPanels();
this->adjustMinimumSize();
this->targetPackageWidget->show(); this->targetPackageWidget->show();
} }
} }
@@ -593,6 +590,21 @@ void InsightWindow::adjustPanels() {
); );
} }
void InsightWindow::adjustMinimumSize() {
auto minSize = QSize(800, 500);
if (this->targetPackageWidget != nullptr) {
minSize.setWidth(this->targetPackageWidget->width() + 700);
minSize.setHeight(this->targetPackageWidget->height() + 150);
}
if (this->bottomPanel->isVisible()) {
minSize.setHeight(minSize.height() + this->bottomPanel->getMinimumResize());
}
this->setMinimumSize(minSize);
}
void InsightWindow::onTargetControllerSuspended() { void InsightWindow::onTargetControllerSuspended() {
if (this->activated) { if (this->activated) {
this->deactivate(); this->deactivate();
@@ -728,15 +740,9 @@ void InsightWindow::toggleRamInspectionPane() {
this->ramInspectionPane->activate(); this->ramInspectionPane->activate();
this->bottomPanel->show(); this->bottomPanel->show();
this->ramInspectionButton->setChecked(true); this->ramInspectionButton->setChecked(true);
if (this->targetPackageWidget != nullptr) {
this->setMinimumHeight(std::max(
this->minimumHeight(),
this->targetPackageWidget->height() + this->header->height() + this->footer->height()
+ this->menuBar()->height() + this->bottomPanel->getMinimumResize() + 30
));
}
} }
this->adjustMinimumSize();
} }
void InsightWindow::toggleEepromInspectionPane() { void InsightWindow::toggleEepromInspectionPane() {
@@ -753,13 +759,7 @@ void InsightWindow::toggleEepromInspectionPane() {
this->eepromInspectionPane->activate(); this->eepromInspectionPane->activate();
this->bottomPanel->show(); this->bottomPanel->show();
this->eepromInspectionButton->setChecked(true); this->eepromInspectionButton->setChecked(true);
if (this->targetPackageWidget != nullptr) {
this->setMinimumHeight(std::max(
this->minimumHeight(),
this->targetPackageWidget->height() + this->header->height() + this->footer->height()
+ this->menuBar()->height() + this->bottomPanel->getMinimumResize() + 30
));
}
} }
this->adjustMinimumSize();
} }

View File

@@ -113,6 +113,7 @@ namespace Bloom
void deactivate(); void deactivate();
void adjustPanels(); void adjustPanels();
void adjustMinimumSize();
void onTargetControllerSuspended(); void onTargetControllerSuspended();
void onTargetControllerResumed(const Bloom::Targets::TargetDescriptor& targetDescriptor); void onTargetControllerResumed(const Bloom::Targets::TargetDescriptor& targetDescriptor);