Update size policy on panel type configuration (for the PanelWidget)

This commit is contained in:
Nav
2021-11-17 21:45:25 +00:00
parent c1cac55a61
commit 3fee62d5ea
2 changed files with 14 additions and 4 deletions

View File

@@ -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<QHoverEvent*>(event);

View File

@@ -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;