Made managing of PanelState object consistent with the managing of other state objects

This commit is contained in:
Nav
2022-08-13 18:41:52 +01:00
parent d646e06efe
commit b0b167453d
7 changed files with 74 additions and 122 deletions

View File

@@ -24,10 +24,11 @@ namespace Bloom::Widgets
Q_OBJECT
Q_PROPERTY(int handleSize READ getHandleSize WRITE setHandleSize DESIGNABLE true)
Q_PROPERTY(int minimumResize READ getMinimumResize WRITE setMinimumResize DESIGNABLE true)
Q_PROPERTY(Bloom::Widgets::PanelWidgetType panelType READ getPanelType WRITE setPanelType DESIGNABLE true)
public:
explicit PanelWidget(QWidget* parent);
PanelState& state;
explicit PanelWidget(PanelWidgetType type, PanelState& state, QWidget* parent);
void setHandleSize(int handleSize) {
this->handleSize = handleSize;
@@ -37,8 +38,6 @@ namespace Bloom::Widgets
void setMaximumResize(int maximumResize);
void setPanelType(PanelWidgetType panelType);
void setSize(int size);
[[nodiscard]] int getHandleSize() const {
@@ -53,17 +52,6 @@ namespace Bloom::Widgets
return this->maximumResize;
}
PanelWidgetType getPanelType() {
return this->panelType;
}
PanelState getCurrentState() {
return PanelState(
this->panelType == PanelWidgetType::LEFT ? this->width() : this->height(),
this->isVisible()
);
}
/**
* Will evaluate whether the panel should still be visible or not (depending on whether there are any
* visible and attached child panes).