Handled positioning of the target package widget in the container, instead of within the widget itself
This commit is contained in:
@@ -139,6 +139,7 @@ add_executable(Bloom
|
|||||||
src/Insight/InsightWorker/Tasks/SetTargetPinState.cpp
|
src/Insight/InsightWorker/Tasks/SetTargetPinState.cpp
|
||||||
|
|
||||||
# Target package widgets
|
# Target package widgets
|
||||||
|
src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/TargetPackageWidgetContainer.cpp
|
||||||
src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/TargetPackageWidget.cpp
|
src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/TargetPackageWidget.cpp
|
||||||
src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/TargetPinWidget.cpp
|
src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/TargetPinWidget.cpp
|
||||||
src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/TargetPinBodyWidget.cpp
|
src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/TargetPinBodyWidget.cpp
|
||||||
|
|||||||
@@ -64,7 +64,9 @@ InsightWindow::InsightWindow(
|
|||||||
+ "/src/Insight/UserInterfaces/InsightWindow/Images/BloomIcon.svg"
|
+ "/src/Insight/UserInterfaces/InsightWindow/Images/BloomIcon.svg"
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
this->ioContainerWidget = this->mainWindowWidget->findChild<QWidget*>("io-container");
|
this->ioContainerWidget = this->mainWindowWidget->findChild<InsightTargetWidgets::TargetPackageWidgetContainer*>(
|
||||||
|
"io-container"
|
||||||
|
);
|
||||||
this->ioUnavailableWidget = this->mainWindowWidget->findChild<QLabel*>("io-inspection-unavailable");
|
this->ioUnavailableWidget = this->mainWindowWidget->findChild<QLabel*>("io-inspection-unavailable");
|
||||||
this->mainMenuBar = this->mainWindowWidget->findChild<QMenuBar*>("menu-bar");
|
this->mainMenuBar = this->mainWindowWidget->findChild<QMenuBar*>("menu-bar");
|
||||||
|
|
||||||
@@ -345,6 +347,7 @@ void InsightWindow::selectVariant(const TargetVariant* variant) {
|
|||||||
this->targetPackageWidget->hide();
|
this->targetPackageWidget->hide();
|
||||||
this->targetPackageWidget->deleteLater();
|
this->targetPackageWidget->deleteLater();
|
||||||
this->targetPackageWidget = nullptr;
|
this->targetPackageWidget = nullptr;
|
||||||
|
this->ioContainerWidget->setPackageWidget(this->targetPackageWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->selectedVariant = variant;
|
this->selectedVariant = variant;
|
||||||
@@ -369,6 +372,7 @@ void InsightWindow::selectVariant(const TargetVariant* variant) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this->targetPackageWidget != nullptr) {
|
if (this->targetPackageWidget != nullptr) {
|
||||||
|
this->ioContainerWidget->setPackageWidget(this->targetPackageWidget);
|
||||||
this->targetPackageWidget->setTargetState(this->targetState);
|
this->targetPackageWidget->setTargetState(this->targetState);
|
||||||
|
|
||||||
if (this->targetState == TargetState::STOPPED) {
|
if (this->targetState == TargetState::STOPPED) {
|
||||||
@@ -379,6 +383,13 @@ void InsightWindow::selectVariant(const TargetVariant* variant) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->mainWindowWidget->setMinimumSize(
|
||||||
|
this->targetPackageWidget->width() + 500,
|
||||||
|
this->targetPackageWidget->height() + 150
|
||||||
|
);
|
||||||
|
|
||||||
|
this->ioContainerWidget->resize(this->ioContainerWidget->size());
|
||||||
|
|
||||||
this->targetPackageWidget->show();
|
this->targetPackageWidget->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "src/Targets/TargetDescriptor.hpp"
|
#include "src/Targets/TargetDescriptor.hpp"
|
||||||
#include "src/Targets/TargetVariant.hpp"
|
#include "src/Targets/TargetVariant.hpp"
|
||||||
|
|
||||||
|
#include "Widgets/TargetWidgets/TargetPackageWidgetContainer.hpp"
|
||||||
#include "Widgets/TargetWidgets/TargetPackageWidget.hpp"
|
#include "Widgets/TargetWidgets/TargetPackageWidget.hpp"
|
||||||
#include "Widgets/TargetRegistersPane/TargetRegistersPaneWidget.hpp"
|
#include "Widgets/TargetRegistersPane/TargetRegistersPaneWidget.hpp"
|
||||||
#include "AboutWindow.hpp"
|
#include "AboutWindow.hpp"
|
||||||
@@ -48,7 +49,7 @@ namespace Bloom
|
|||||||
Widgets::TargetRegistersPaneWidget* targetRegistersSidePane = nullptr;
|
Widgets::TargetRegistersPaneWidget* targetRegistersSidePane = nullptr;
|
||||||
QToolButton* targetRegistersButton = nullptr;
|
QToolButton* targetRegistersButton = nullptr;
|
||||||
|
|
||||||
QWidget* ioContainerWidget = nullptr;
|
Widgets::InsightTargetWidgets::TargetPackageWidgetContainer* ioContainerWidget = nullptr;
|
||||||
QLabel* ioUnavailableWidget = nullptr;
|
QLabel* ioUnavailableWidget = nullptr;
|
||||||
Widgets::InsightTargetWidgets::TargetPackageWidget* targetPackageWidget = nullptr;
|
Widgets::InsightTargetWidgets::TargetPackageWidget* targetPackageWidget = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -209,7 +209,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="io-container">
|
<widget class="TargetPackageWidgetContainer" name="io-container">
|
||||||
<layout class="QHBoxLayout">
|
<layout class="QHBoxLayout">
|
||||||
<item alignment="Qt::AlignHCenter">
|
<item alignment="Qt::AlignHCenter">
|
||||||
<widget class="QLabel" name="io-inspection-unavailable">
|
<widget class="QLabel" name="io-inspection-unavailable">
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include "Widgets/SvgToolButton.hpp"
|
#include "Widgets/SvgToolButton.hpp"
|
||||||
#include "Widgets/ExpandingWidget.hpp"
|
#include "Widgets/ExpandingWidget.hpp"
|
||||||
#include "Widgets/ExpandingHeightScrollAreaWidget.hpp"
|
#include "Widgets/ExpandingHeightScrollAreaWidget.hpp"
|
||||||
#include "Widgets/TargetRegistersPane/TargetRegistersPaneWidget.hpp"
|
#include "Widgets/TargetWidgets/TargetPackageWidgetContainer.hpp"
|
||||||
|
|
||||||
#include "src/Logger/Logger.hpp"
|
#include "src/Logger/Logger.hpp"
|
||||||
|
|
||||||
@@ -71,6 +71,15 @@ UiLoader::UiLoader(QObject* parent): QUiLoader(parent) {
|
|||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"TargetPackageWidgetContainer",
|
||||||
|
[this](QWidget* parent, const QString& name) {
|
||||||
|
auto widget = new InsightTargetWidgets::TargetPackageWidgetContainer(parent);
|
||||||
|
widget->setObjectName(name);
|
||||||
|
widget->setStyleSheet(parent->styleSheet());
|
||||||
|
return widget;
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#include "TargetPackageWidgetContainer.hpp"
|
||||||
|
|
||||||
|
using namespace Bloom;
|
||||||
|
using namespace Bloom::Widgets::InsightTargetWidgets;
|
||||||
|
|
||||||
|
TargetPackageWidgetContainer::TargetPackageWidgetContainer(QWidget* parent): QWidget(parent) {
|
||||||
|
this->packageWidget = this->findChild<TargetPackageWidget*>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetPackageWidgetContainer::resizeEvent(QResizeEvent* event) {
|
||||||
|
if (this->packageWidget == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto packageSize = this->packageWidget->size();
|
||||||
|
this->packageWidget->setGeometry(
|
||||||
|
(this->width() / 2) - (packageSize.width() / 2),
|
||||||
|
(this->height() / 2) - (packageSize.height() / 2),
|
||||||
|
packageSize.width(),
|
||||||
|
packageSize.height()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetPackageWidgetContainer::setPackageWidget(TargetPackageWidget* packageWidget) {
|
||||||
|
this->packageWidget = packageWidget;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QResizeEvent>
|
||||||
|
|
||||||
|
#include "TargetPackageWidget.hpp"
|
||||||
|
|
||||||
|
namespace Bloom::Widgets::InsightTargetWidgets
|
||||||
|
{
|
||||||
|
class TargetPackageWidgetContainer: public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
private:
|
||||||
|
TargetPackageWidget* packageWidget = nullptr;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void resizeEvent(QResizeEvent* event) override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
TargetPackageWidgetContainer(QWidget* parent);
|
||||||
|
|
||||||
|
void setPackageWidget(TargetPackageWidget* packageWidget);
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user