diff --git a/toonz/sources/toonzqt/docklayout.cpp b/toonz/sources/toonzqt/docklayout.cpp index f42d1b6..b00ef35 100644 --- a/toonz/sources/toonzqt/docklayout.cpp +++ b/toonz/sources/toonzqt/docklayout.cpp @@ -422,9 +422,15 @@ void DockLayout::applyTransform(const QTransform &transform) { //------------------------------------------------------ // check if the region will be with fixed width -bool Region::checkWidgetsToBeFixedWidth(std::vector &widgets) { +bool Region::checkWidgetsToBeFixedWidth(std::vector &widgets, + bool &fromDocking) { if (m_item) { - if ( (m_item->objectName() == "FilmStrip" && m_item->getCanFixWidth()) || + if (m_item->wasFloating()) { + fromDocking = true; + m_item->clearWasFloating(); + return false; + } + if ((m_item->objectName() == "FilmStrip" && m_item->getCanFixWidth()) || m_item->objectName() == "StyleEditor") { widgets.push_back(m_item); return true; @@ -436,7 +442,8 @@ bool Region::checkWidgetsToBeFixedWidth(std::vector &widgets) { if (m_orientation == horizontal) { bool ret = true; for (Region *childRegion : m_childList) { - if (!childRegion->checkWidgetsToBeFixedWidth(widgets)) ret = false; + if (!childRegion->checkWidgetsToBeFixedWidth(widgets, fromDocking)) + ret = false; } return ret; } @@ -444,7 +451,8 @@ bool Region::checkWidgetsToBeFixedWidth(std::vector &widgets) { else { bool ret = false; for (Region *childRegion : m_childList) { - if (childRegion->checkWidgetsToBeFixedWidth(widgets)) ret = true; + if (childRegion->checkWidgetsToBeFixedWidth(widgets, fromDocking)) + ret = true; } return ret; } @@ -464,9 +472,10 @@ void DockLayout::redistribute() { // check recursively from the root region, if the widgets can be fixed. // it avoids all widgets in horizontal alignment to be fixed, or UI becomes // glitchy. + bool fromDocking = false; bool widgetsCanBeFixedWidth = - !m_regions.front()->checkWidgetsToBeFixedWidth(widgets); - if (widgetsCanBeFixedWidth) { + !m_regions.front()->checkWidgetsToBeFixedWidth(widgets, fromDocking); + if (!fromDocking && widgetsCanBeFixedWidth) { for (QWidget *widget : widgets) widget->setFixedWidth(widget->width()); } @@ -487,7 +496,7 @@ void DockLayout::redistribute() { m_regions.front()->setGeometry(contentsRect()); m_regions.front()->redistribute(); - if (widgetsCanBeFixedWidth) { + if (!fromDocking && widgetsCanBeFixedWidth) { for (QWidget *widget : widgets) { widget->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); widget->setMinimumSize(0, 0); @@ -737,7 +746,8 @@ Region *DockLayout::dockItemPrivate(DockWidget *item, Region *r, int idx) { item->onDock(true); item->setDockedAppearance(); - item->m_floating = false; + item->m_floating = false; + item->m_wasFloating = true; if (!r) { // Insert new root region diff --git a/toonz/sources/toonzqt/docklayout.h b/toonz/sources/toonzqt/docklayout.h index 6502aad..f35c68c 100644 --- a/toonz/sources/toonzqt/docklayout.h +++ b/toonz/sources/toonzqt/docklayout.h @@ -176,7 +176,8 @@ public: protected: // Private attributes for dragging purposes - bool m_floating; // Whether this window is floating or docked + bool m_floating; // Whether this window is floating or docked + bool m_wasFloating; bool m_dragging; // Whether this window is being dragged bool m_undocking; // Still docked, but after a mouse button press on a title // bar. @@ -220,6 +221,8 @@ public: DockLayout *parentLayout() const { return m_parentLayout; } bool isFloating() const { return m_floating; } + bool wasFloating() const { return m_wasFloating; } + void clearWasFloating() { m_wasFloating = false; } bool isMaximized() const { return m_maximized; } // Query functions @@ -530,7 +533,8 @@ public: unsigned int find(const Region *subRegion) const; - bool checkWidgetsToBeFixedWidth(std::vector &widgets); + bool checkWidgetsToBeFixedWidth(std::vector &widgets, + bool &fromDocking); private: // Setters - private