From 3fee62d5ea9ee24aabf59bd3310df12bcad0ff59 Mon Sep 17 00:00:00 2001 From: Nav Date: Wed, 17 Nov 2021 21:45:25 +0000 Subject: [PATCH] Update size policy on panel type configuration (for the PanelWidget) --- .../InsightWindow/Widgets/PanelWidget.cpp | 13 +++++++++++++ .../InsightWindow/Widgets/PanelWidget.hpp | 5 +---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/PanelWidget.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/PanelWidget.cpp index bcd96775..c895a202 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/PanelWidget.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/PanelWidget.cpp @@ -35,6 +35,19 @@ void PanelWidget::setMaximumResize(int maximumResize) { } } +void PanelWidget::setPanelType(PanelWidgetType panelType) { + this->panelType = panelType; + + if (this->panelType == PanelWidgetType::LEFT) { + this->resizeCursor = Qt::SplitHCursor; + this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding); + + } else { + this->resizeCursor = Qt::SplitVCursor; + this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); + } +} + bool PanelWidget::event(QEvent* event) { if (event->type() == QEvent::Type::HoverMove) { auto hoverEvent = static_cast(event); diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/PanelWidget.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/PanelWidget.hpp index eb7cd41a..cdd0ba9c 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/PanelWidget.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/PanelWidget.hpp @@ -35,10 +35,7 @@ namespace Bloom::Widgets void setMaximumResize(int maximumResize); - void setPanelType(PanelWidgetType panelType) { - this->panelType = panelType; - this->resizeCursor = this->panelType == PanelWidgetType::LEFT ? Qt::SplitHCursor : Qt::SplitVCursor; - } + void setPanelType(PanelWidgetType panelType); [[nodiscard]] int getHandleSize() const { return this->handleSize;